Select Git revision
Colorbar_Window.cpp
Forked from
gmsh / gmsh
Source project has a limited visibility.
-
Christophe Geuzaine authored
Remove unused args in init/recompute routines
Christophe Geuzaine authoredRemove unused args in init/recompute routines
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;