#include #include #include #include #include #include #include "hisview_view.h" #include "hisview_macros.h" #include "hisview_widgets.h" #ifdef underscore #define hsv_to_rgb hsv_to_rgb_ #endif #ifdef f2c #define hsv_to_rgb hsv_to_rgb__ #endif #define MAXCOL 200 #define FIRSTCOL 50 #define MAXNHUE 10 #define MAXNSAT 4 #define MAXNVAL 5 #define INCRSAT 0.25 #define INCRVAL 0.2 static char dumstr[80]; static float hue[MAXCOL]; static float sat[MAXCOL]; static float val[MAXCOL]; float red[MAXCOL]; float green[MAXCOL]; float blue[MAXCOL]; float hue_to_red[MAXCOL]; float sat_to_green[MAXCOL]; float val_to_blue[MAXCOL]; float fullred[MAXCOL]; float fullgreen[MAXCOL]; float fullblue[MAXCOL]; float gray[MAXCOL]; unsigned long ncolors; int nhue, nsat, nval; float valhue[MAXNHUE]; float valsat[MAXNSAT]; float valval[MAXNVAL]; unsigned char colmap[MAXCOL]; static unsigned long colors[MAXCOL]; static unsigned long firstcolors[FIRSTCOL]; static char *namec[MAXCOL]; static XColor exact_defs[MAXCOL]; static XColor first_defs[FIRSTCOL]; static char colnam[8]; void transfert_function() { int k; for (k = 0; k < ncolors; k++) sprintf(namec[k], "#%02X%02X%02X", (unsigned short) (255*red[k]), (unsigned short) (255*green[k]), (unsigned short) (255*blue[k])); for (k=0; k < ncolors; k++) if (!XParseColor(display, cmap, namec[k], &exact_defs[k])){ sprintf(dumstr, "I can't parse col # %d, value %s.\n", k, namec[k]); printf(dumstr); } XStoreColors(display, cmap, exact_defs, ncolors); } void init_luts() { int i, j, k, n; float t, h; nhue = MAXNHUE; nsat = MAXNSAT; nval = MAXNVAL; for (i=0; i