diff --git a/Common/ColorTable.cpp b/Common/ColorTable.cpp index e39463f7dc874c1ff45d4f3c099270d5ed87f4e0..ec01a143eddbab398682681c4ff7e5df5a45d86b 100644 --- a/Common/ColorTable.cpp +++ b/Common/ColorTable.cpp @@ -1,4 +1,4 @@ -// $Id: ColorTable.cpp,v 1.26 2004-12-24 18:12:22 geuzaine Exp $ +// $Id: ColorTable.cpp,v 1.27 2004-12-24 20:25:11 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -315,7 +315,10 @@ void ColorTable_Recompute(GmshColorTable * ct) break; } - a = (int)(255. * ct->dpar[COLORTABLE_ALPHA]); + double aa = 1.0; + if(ct->dpar[COLORTABLE_ALPHAPOW]) + aa = pow(s ? s : 1.e-10, ct->dpar[COLORTABLE_ALPHAPOW]); + a = (int)(255. * aa * ct->dpar[COLORTABLE_ALPHA]); if(ct->dpar[COLORTABLE_BETA]) { if(ct->dpar[COLORTABLE_BETA] > 0.0) diff --git a/Common/ColorTable.h b/Common/ColorTable.h index 57357afda78404f1be934ace71b60a031dc309f0..dd714b6650c13d3bfb59c9f05cec2660ad4bffb7 100644 --- a/Common/ColorTable.h +++ b/Common/ColorTable.h @@ -49,6 +49,7 @@ typedef struct{ #define COLORTABLE_BIAS 1 // offset #define COLORTABLE_ALPHA 2 // alpha channel value #define COLORTABLE_BETA 3 // beta coeff for brighten +#define COLORTABLE_ALPHAPOW 4 // alpha channel power value void ColorTable_InitParam(int number, GmshColorTable *ct); void ColorTable_Recompute(GmshColorTable *ct); diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 0a4fe5be9577c26f99aeb47dde98b5a277655bff..c59cb43acba71ce223d67ecd0edd38212572b1df 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -1005,6 +1005,8 @@ StringXNumber ViewOptions_Number[] = { { F|O, "ColormapAlpha" , opt_view_colormap_alpha , 1.0 , "Colormap alpha channel value (used only if != 1)" }, + { F|O, "ColormapAlphaPower" , opt_view_colormap_alpha_power , 0.0 , + "Colormap alpha channel power" }, { F|O, "ColormapBeta" , opt_view_colormap_beta , 0.0 , "Colormap beta parameter (gamma = 1-beta)" }, { F|O, "ColormapBias" , opt_view_colormap_bias , 0.0 , diff --git a/Common/Options.cpp b/Common/Options.cpp index b844e4682d540cd9ac6c0da835c96d195adeb8b8..c40b8681106e1ea0ceea6ab4600ede2fd458ce2c 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.214 2004-12-24 04:58:20 geuzaine Exp $ +// $Id: Options.cpp,v 1.215 2004-12-24 20:25:11 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -5418,6 +5418,22 @@ double opt_view_colormap_alpha(OPT_ARGS_NUM) return v->CT.dpar[COLORTABLE_ALPHA]; } +double opt_view_colormap_alpha_power(OPT_ARGS_NUM) +{ + GET_VIEW(0.); + if(action & GMSH_SET) { + v->CT.dpar[COLORTABLE_ALPHAPOW] = val; + ColorTable_Recompute(&v->CT); + v->Changed = 1; + } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)) { + WID->view_colorbar_window->redraw(); + } +#endif + return v->CT.dpar[COLORTABLE_ALPHAPOW]; +} + double opt_view_colormap_beta(OPT_ARGS_NUM) { GET_VIEW(0.); diff --git a/Common/Options.h b/Common/Options.h index c06cc088227e92e1699032c8a3d049239bb3338d..2aa227d09f2b1e60d3719d7a324e51c71ccaa2ca 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -484,6 +484,7 @@ double opt_view_saturate_values(OPT_ARGS_NUM); double opt_view_max_recursion_level(OPT_ARGS_NUM); double opt_view_target_error(OPT_ARGS_NUM); double opt_view_colormap_alpha(OPT_ARGS_NUM); +double opt_view_colormap_alpha_power(OPT_ARGS_NUM); double opt_view_colormap_beta(OPT_ARGS_NUM); double opt_view_colormap_bias(OPT_ARGS_NUM); double opt_view_colormap_curvature(OPT_ARGS_NUM); diff --git a/Fltk/Colorbar_Window.cpp b/Fltk/Colorbar_Window.cpp index ec60e07f78326f9b3a06c8f21636fa5cb7fc44b4..f9aeb51832d5b4640e1d1909b9abfd0456df4682 100644 --- a/Fltk/Colorbar_Window.cpp +++ b/Fltk/Colorbar_Window.cpp @@ -1,4 +1,4 @@ -// $Id: Colorbar_Window.cpp,v 1.42 2004-12-24 18:12:22 geuzaine Exp $ +// $Id: Colorbar_Window.cpp,v 1.43 2004-12-24 20:25:11 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -223,7 +223,7 @@ void Colorbar_Window::redraw_range(int a, int b) // print colortable mode and help fl_font(FL_HELVETICA, font_height); fl_color(fl_contrast(FL_BLACK, color_bg)); - int xx0 = 10, xx1 = 12 * font_height, yy0 = 10; + int xx0 = 8, xx1 = 12 * font_height, yy0 = 8; if(help_flag) { i = 0; fl_draw("0, 1, 2, 3, ...", xx0, yy0 + (i + 1) * font_height); @@ -244,7 +244,7 @@ void Colorbar_Window::redraw_range(int a, int b) fl_draw("Ctrl+mouse1", xx0, yy0 + (i + 1) * font_height); fl_draw("draw alpha channel", xx1, yy0 + (i + 1) * font_height); i++; - fl_draw("c, p, r", xx0, yy0 + (i + 1) * font_height); + fl_draw("Ctrl+c, Ctrl+v, r", xx0, yy0 + (i + 1) * font_height); fl_draw("copy, paste or reset colormap", xx1, yy0 + (i + 1) * font_height); i++; fl_draw("m", xx0, yy0 + (i + 1) * font_height); @@ -262,6 +262,9 @@ void Colorbar_Window::redraw_range(int a, int b) fl_draw("a, Ctrl+a", xx0, yy0 + (i + 1) * font_height); fl_draw("increase or decrease alpha", xx1, yy0 + (i + 1) * font_height); i++; + fl_draw("p, Ctrl+p", xx0, yy0 + (i + 1) * font_height); + fl_draw("modify alpha channel power law", xx1, yy0 + (i + 1) * font_height); + i++; fl_draw("b, Ctrl+b", xx0, yy0 + (i + 1) * font_height); fl_draw("increase or decrease gamma", xx1, yy0 + (i + 1) * font_height); i++; @@ -443,10 +446,10 @@ int Colorbar_Window::handle(int event) ColorTable_InitParam(19, ct); compute = 1; } - else if(Fl::test_shortcut('c')) { + else if(Fl::test_shortcut(FL_CTRL + 'c')) { ColorTable_Copy(ct); } - else if(Fl::test_shortcut('p')) { + else if(Fl::test_shortcut(FL_CTRL + 'v')) { ColorTable_Paste(ct); draw(); *viewchanged = 1; @@ -498,6 +501,14 @@ int Colorbar_Window::handle(int event) ct->dpar[COLORTABLE_ALPHA] = 1.0; compute = 1; } + else if(Fl::test_shortcut('p')) { + ct->dpar[COLORTABLE_ALPHAPOW] += 0.05; + compute = 1; + } + else if(Fl::test_shortcut(FL_CTRL + 'p')) { + ct->dpar[COLORTABLE_ALPHAPOW] -= 0.05; + compute = 1; + } else if(Fl::test_shortcut(FL_Left)) { ct->dpar[COLORTABLE_BIAS] -= 0.05; compute = 1; diff --git a/doc/texinfo/opt_view.texi b/doc/texinfo/opt_view.texi index f414ec02497652c7ddea78a8361bc238a10e52b6..2c42ae27916ea8f104b6a469231bf349baee99b6 100644 --- a/doc/texinfo/opt_view.texi +++ b/doc/texinfo/opt_view.texi @@ -89,6 +89,11 @@ Colormap alpha channel value (used only if != 1)@* Default value: @code{1}@* Saved in: @code{General.OptionsFileName} +@item View.ColormapAlphaPower +Colormap alpha channel power@* +Default value: @code{0}@* +Saved in: @code{General.OptionsFileName} + @item View.ColormapBeta Colormap beta parameter (gamma = 1-beta)@* Default value: @code{0}@*