Skip to content
Snippets Groups Projects
Select Git revision
  • 90c2aad2cb82d4c095fbe9b1ea485c0fbee4e14c
  • master default
  • cgnsUnstructured
  • partitioning
  • poppler
  • HighOrderBLCurving
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
  • gmsh_2_8_6
26 results

Colorbar_Window.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    Colorbar_Window.cpp 17.76 KiB
    // $Id: Colorbar_Window.cpp,v 1.36 2003-12-08 19:18:13 geuzaine Exp $
    //
    // Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle
    //
    // This program is free software; you can redistribute it and/or modify
    // it under the terms of the GNU General Public License as published by
    // the Free Software Foundation; either version 2 of the License, or
    // (at your option) any later version.
    //
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
    //
    // You should have received a copy of the GNU General Public License
    // along with this program; if not, write to the Free Software
    // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
    // USA.
    // 
    // Please report all bugs and problems to "gmsh@geuz.org".
    
    // This class was inspired by the colorbar widget provided in Vis5d, a
    // program for visualizing five dimensional gridded data sets
    // Copyright (C) 1990 - 1995 Bill Hibbard, Brian Paul, Dave Santek,
    // and Andre Battaiola.
       
    #include "Gmsh.h"
    #include "GmshUI.h"
    #include "Numeric.h"
    #include "GUI.h"
    #include "ColorTable.h"
    #include "Colorbar_Window.h"
    #include "Context.h"
    
    extern Context_T CTX;
    
    #define UNDEFINED   0
    #define EPS         1.e-10
    
    #if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 0)
    #define fl_contrast contrast
    #endif
    
    // This file defines the Colorbar_Window class (subclass of Fl_Window)
    
    // The constructor
    
    Colorbar_Window::Colorbar_Window(int x, int y, int w, int h, const char *l)
      : Fl_Window(x, y, w, h, l)
    {
      ct = NULL;
      label = NULL;
      help_flag = 1;
      font_height = CTX.fontsize;
      marker_height = font_height;
      wedge_height = marker_height;
      marker_pos = 0;
      minval = maxval = 0.0;
    }
    
    
    // rgb on [0, 1], sv returned on [0, 1] and h on [0, 6]. 
    // Exception: h is returned UNDEFINED if S==0.
    
    #define RETURN_HSV(h,s,v) {*H=h; *S=s; *V=v; return;}
    
    static void RGB_to_HSV(double R, double G, double B,
                           double *H, double *S, double *V)
    {
      double v, x, f;