From e81704d22332f7e1603e5eca1c6387972f16a47f Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 28 Aug 2002 17:55:12 +0000 Subject: [PATCH] Ctrl+Up/Down to change alpha level in colormap --- Common/ColorTable.cpp | 12 ++++-------- Fltk/Colorbar_Window.cpp | 12 +++++++----- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Common/ColorTable.cpp b/Common/ColorTable.cpp index 1584c9c8fe..1c89f56bbd 100644 --- a/Common/ColorTable.cpp +++ b/Common/ColorTable.cpp @@ -1,4 +1,4 @@ -// $Id: ColorTable.cpp,v 1.12 2002-08-27 02:03:34 geuzaine Exp $ +// $Id: ColorTable.cpp,v 1.13 2002-08-28 17:55:12 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -44,7 +44,7 @@ void ColorTable_InitParam(int number, GmshColorTable *ct, ct->fpar[COLORTABLE_BETA] = 0.0; } if(alpha_flag) { - ct->fpar[COLORTABLE_ALPHAPOW] = 2.; + ct->fpar[COLORTABLE_ALPHAPOW] = 1.; ct->fpar[COLORTABLE_ALPHAVAL] = 255.; } @@ -209,12 +209,8 @@ void ColorTable_Recompute(GmshColorTable *ct, int rgb_flag, int alpha_flag){ } if (alpha_flag) { - if (ct->fpar[COLORTABLE_ALPHAVAL]<0) { - a = (int)( 255.0 * pow( s, ct->fpar[COLORTABLE_ALPHAPOW] ) ); - } - else { - a = (int)( ct->fpar[COLORTABLE_ALPHAVAL] ); - } + a = (int)( ct->fpar[COLORTABLE_ALPHAVAL] * + ct->fpar[COLORTABLE_ALPHAPOW] ); } else { a = UNPACK_ALPHA( ct->table[i] ); diff --git a/Fltk/Colorbar_Window.cpp b/Fltk/Colorbar_Window.cpp index 15ca1c2be3..61f7df7862 100644 --- a/Fltk/Colorbar_Window.cpp +++ b/Fltk/Colorbar_Window.cpp @@ -1,4 +1,4 @@ -// $Id: Colorbar_Window.cpp,v 1.25 2002-05-20 18:28:25 geuzaine Exp $ +// $Id: Colorbar_Window.cpp,v 1.26 2002-08-28 17:55:12 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -482,9 +482,9 @@ int Colorbar_Window::handle(int event){ compute = 1; } else if(Fl::test_shortcut(FL_CTRL + FL_Up)){ - ct->fpar[COLORTABLE_ALPHAPOW] -= 0.05; - if (ct->fpar[COLORTABLE_ALPHAPOW] < 0.0) - ct->fpar[COLORTABLE_ALPHAPOW] = 0.0; + ct->fpar[COLORTABLE_ALPHAPOW] += 0.05; + if (ct->fpar[COLORTABLE_ALPHAPOW] > 1.0) + ct->fpar[COLORTABLE_ALPHAPOW] = 1.0; compute = 1; } else if(Fl::test_shortcut(FL_Down)){ @@ -492,7 +492,9 @@ int Colorbar_Window::handle(int event){ compute = 1; } else if(Fl::test_shortcut(FL_CTRL + FL_Down)){ - ct->fpar[COLORTABLE_ALPHAPOW] += 0.05; + ct->fpar[COLORTABLE_ALPHAPOW] -= 0.05; + if (ct->fpar[COLORTABLE_ALPHAPOW] < 0.0) + ct->fpar[COLORTABLE_ALPHAPOW] = 0.0; compute = 1; } else{ -- GitLab