Changeset 38439
- Timestamp:
- Jun 12, 2015, 5:00:31 PM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150419/Ohana/src
- Files:
-
- 10 edited
-
kapa2/include/prototypes.h (modified) (1 diff)
-
kapa2/include/structures.h (modified) (1 diff)
-
kapa2/src/CheckPipe.c (modified) (1 diff)
-
kapa2/src/InterpretKeys.c (modified) (1 diff)
-
kapa2/src/SetChannel.c (modified) (2 diffs)
-
kapa2/src/SetColormap.c (modified) (10 diffs)
-
kapa2/src/SetUpGraphic.c (modified) (1 diff)
-
libkapa/include/kapa.h (modified) (1 diff)
-
libkapa/src/KiiPicture.c (modified) (1 diff)
-
opihi/cmd.data/tvcolors.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150419/Ohana/src/kapa2/include/prototypes.h
r33650 r38439 83 83 int SetChannel PROTO((int sock)); 84 84 int SetColormapFromPipe PROTO((int sock)); 85 int SetNanColorFromPipe PROTO((int sock)); 85 86 86 87 int LoadVectorData PROTO((int sock, KapaGraphWidget *graph, int N, char *type)); -
branches/eam_branches/ipp-20150419/Ohana/src/kapa2/include/structures.h
r37807 r38439 35 35 unsigned long *color; // graph plotting colors 36 36 int Ncolors; 37 char *colormapName; 37 38 38 39 unsigned long *pixels; // image pixel colors -
branches/eam_branches/ipp-20150419/Ohana/src/kapa2/src/CheckPipe.c
r36833 r38439 316 316 } 317 317 318 if (!strcmp (word, "CNAN")) { 319 status = SetNanColorFromPipe (sock); 320 KiiSendCommand (sock, 4, "DONE"); 321 FINISHED (status); 322 } 323 318 324 if (!strcmp (word, "SAVE")) { 319 325 status = SaveOverlay (sock); -
branches/eam_branches/ipp-20150419/Ohana/src/kapa2/src/InterpretKeys.c
r38153 r38439 102 102 UpdateStatusBox (graphic, image, X, Y, 0.0, 1); \ 103 103 Remap (graphic, image); \ 104 Refresh (); \ 104 105 break; 105 106 -
branches/eam_branches/ipp-20150419/Ohana/src/kapa2/src/SetChannel.c
r37807 r38439 57 57 // image = section->image; 58 58 SetColorScale (graphic, section->image); 59 if (!USE_XWINDOW) return (TRUE);59 if (!USE_XWINDOW) return TRUE; 60 60 Remap (graphic, section->image); 61 61 } … … 66 66 return (TRUE); 67 67 } 68 69 int SetNanColorFromPipe (int sock) { 70 71 int i, red_value, green_value, blue_value; 72 KiiScanMessage (sock, "%d %d %d", &red_value, &green_value, &blue_value); 73 74 NAN_RED = red_value; 75 NAN_GREEN = green_value; 76 NAN_BLUE = blue_value; 77 78 // use graphic->colormapName saved value 79 SetColormap (NULL); 80 81 if (!USE_XWINDOW) return (TRUE); 82 83 Graphic *graphic = GetGraphic (); 84 85 int NeedRefresh = FALSE; 86 int Nsection = GetNumberOfSections (); 87 for (i = 0; i < Nsection; i++) { 88 Section *section = GetSectionByNumber (i); 89 if (section->image) { 90 NeedRefresh = TRUE; 91 SetColorScale (graphic, section->image); 92 Remap (graphic, section->image); 93 } 94 } 95 if (NeedRefresh) { 96 Refresh (); 97 XFlush (graphic[0].display); 98 } 99 100 return (TRUE); 101 } -
branches/eam_branches/ipp-20150419/Ohana/src/kapa2/src/SetColormap.c
r38153 r38439 16 16 // display of) an image, we simply remap the lit pixels (in Remap32.c, etc). 17 17 18 int SetColormap (char * name) {18 int SetColormap (char *inName) { 19 19 20 20 int i, red, blue, green; … … 24 24 graphic = GetGraphic(); 25 25 26 if (!inName && !graphic->colormapName) abort(); 27 28 if (inName) { 29 if (graphic->colormapName) free (graphic->colormapName); 30 graphic->colormapName = strcreate (inName); 31 } 32 26 33 int NANValue = graphic[0].Npixels - 1; 27 34 int MaxValue = graphic[0].Npixels - 1; … … 29 36 // the "fullcolor" colormap is uniquely defined for each image; 30 37 // defer to the 'SetColorScale' step 31 if (!strcasecmp ( name, "fullcolor")) {38 if (!strcasecmp (graphic->colormapName, "fullcolor")) { 32 39 graphic[0].ColorScaleMode = KAPA_SCALE_3D_FULL; 33 40 if (SetColorCubeHistogram ()) return TRUE; … … 44 51 45 52 // very simple color model: evenly spaced cube 46 if (!strcasecmp ( name, "ruffcolor")) {53 if (!strcasecmp (graphic->colormapName, "ruffcolor")) { 47 54 graphic[0].nRed = pow (graphic[0].Npixels, 0.333); 48 55 graphic[0].nBlue = pow (graphic[0].Npixels, 0.333); … … 79 86 80 87 /* greyscale */ 81 if ((!strcasecmp ( name, "grayscale")) || (!strcasecmp (name, "greyscale"))) {88 if ((!strcasecmp (graphic->colormapName, "grayscale")) || (!strcasecmp (graphic->colormapName, "greyscale"))) { 82 89 for (i = 0; i < MaxValue; i++) { 83 90 SETVALUE (graphic[0].cmap[i].red, 0xffff - i*scale, 0, 0xffff); … … 89 96 } 90 97 /* -grayscale */ 91 if ((!strcasecmp ( name, "-grayscale")) || (!strcasecmp (name, "-greyscale"))) {98 if ((!strcasecmp (graphic->colormapName, "-grayscale")) || (!strcasecmp (graphic->colormapName, "-greyscale"))) { 92 99 for (i = 0; i < MaxValue; i++) { 93 100 SETVALUE (graphic[0].cmap[i].red, i*scale, 0, 0xffff); … … 99 106 } 100 107 /* heat */ 101 if (!strcasecmp ( name, "Heat")) {108 if (!strcasecmp (graphic->colormapName, "Heat")) { 102 109 greenRef = 0.25*MaxValue*scale*2.0; 103 110 blueRef = 0.50*MaxValue*scale*2.0; … … 129 136 } 130 137 /* rainbow */ 131 if (!strcasecmp ( name, "Rainbow")) {138 if (!strcasecmp (graphic->colormapName, "Rainbow")) { 132 139 redRef = 0.25*MaxValue*scale*4.0; 133 140 greenRef = 0.50*MaxValue*scale*4.0; … … 167 174 } 168 175 /* anuenue */ 169 if (!strcasecmp ( name, "anuenue")) {176 if (!strcasecmp (graphic->colormapName, "anuenue")) { 170 177 redRef = 0.25*MaxValue*scale*4.0; // value at 0.0 171 178 greenRef = 0.50*MaxValue*scale*4.0; … … 207 214 208 215 /* anuenue */ 209 if (!strncmp ( name, "file:", 5)) {210 FILE *f = fopen (& name[5], "r");216 if (!strncmp (graphic->colormapName, "file:", 5)) { 217 FILE *f = fopen (&graphic->colormapName[5], "r"); 211 218 if (!f) { 212 fprintf (stderr, "failed to open colormap file %s\n", & name[5]);219 fprintf (stderr, "failed to open colormap file %s\n", &graphic->colormapName[5]); 213 220 return FALSE; 214 221 } -
branches/eam_branches/ipp-20150419/Ohana/src/kapa2/src/SetUpGraphic.c
r32695 r38439 42 42 CheckColors (graphic, argc, argv); 43 43 44 graphic->colormapName = NULL; 45 44 46 icon.width = icon_width; 45 47 icon.height = icon_height; -
branches/eam_branches/ipp-20150419/Ohana/src/libkapa/include/kapa.h
r35761 r38439 146 146 int KiiSetChannel (int fd, int channel); 147 147 int KiiSetColormap (int fd, char *colormap); 148 int KiiSetNanColor (int fd, int red, int green, int blue); 148 149 int KiiNewPicture1D (int fd, KiiImage *image, KapaImageData *data, Coords *coords); 149 150 int KiiNewPicture2D (int fd, KiiImage *image, KapaImageData *data, Coords *coords); -
branches/eam_branches/ipp-20150419/Ohana/src/libkapa/src/KiiPicture.c
r36833 r38439 14 14 KiiSendCommand (fd, 4, "CMAP"); /* tell kapa to look for the incoming image */ 15 15 KiiSendMessage (fd, "%s", colormap); 16 17 KiiWaitAnswer (fd, "DONE"); 18 return (TRUE); 19 } 20 21 int KiiSetNanColor (int fd, int red, int green, int blue) { 22 23 KiiSendCommand (fd, 4, "CNAN"); /* tell kapa to look for the incoming image */ 24 KiiSendMessage (fd, "%d %d %d ", red, green, blue); 16 25 17 26 KiiWaitAnswer (fd, "DONE"); -
branches/eam_branches/ipp-20150419/Ohana/src/opihi/cmd.data/tvcolors.c
r31667 r38439 16 16 FREE (name); 17 17 18 int SetNAN = FALSE; 19 int red, green, blue; 20 if ((N = get_argument (argc, argv, "-nan"))) { 21 if (N > argc - 4) { 22 gprint (GP_ERR, "ERROR: -nan (red) (green) (blue) does not have enough arguments\n"); 23 return FALSE; 24 } 25 remove_argument (N, &argc, argv); 26 red = strtol (argv[N], NULL, 0); 27 remove_argument (N, &argc, argv); 28 green = strtol (argv[N], NULL, 0); 29 remove_argument (N, &argc, argv); 30 blue = strtol (argv[N], NULL, 0); 31 remove_argument (N, &argc, argv); 32 SetNAN = TRUE; 33 } 34 18 35 // use the currently-set zero,range values if not supplied 19 if ( argc != 2) {20 gprint (GP_ERR, "USAGE: tvcolors (colormap) \n");36 if (!SetNAN && (argc != 2)) { 37 gprint (GP_ERR, "USAGE: tvcolors (colormap) [-nan red green blue]\n"); 21 38 gprint (GP_ERR, " colormap options : greyscale, -greyscale, rainbow, heat, fullcolor, ruffcolor (also grayscale, -grayscale)\n"); 22 39 return (FALSE); 23 40 } 24 41 25 KiiSetColormap (kapa, argv[1]); 42 if (SetNAN) { 43 KiiSetNanColor (kapa, red, green, blue); 44 } 45 if (argc == 2) { 46 KiiSetColormap (kapa, argv[1]); 47 } 26 48 return (TRUE); 27 49 }
Note:
See TracChangeset
for help on using the changeset viewer.
