Changeset 38465
- Timestamp:
- Jun 12, 2015, 10:28:02 PM (11 years ago)
- Location:
- trunk/Ohana/src/kapa2
- Files:
-
- 10 edited
-
include/prototypes.h (modified) (1 diff)
-
include/structures.h (modified) (1 diff)
-
src/CheckPipe.c (modified) (1 diff)
-
src/InterpretKeys.c (modified) (1 diff)
-
src/SetChannel.c (modified) (2 diffs)
-
src/SetColormap.c (modified) (10 diffs)
-
src/SetGraphSize.c (modified) (1 diff)
-
src/SetImageSize.c (modified) (1 diff)
-
src/SetUpGraphic.c (modified) (1 diff)
-
src/bDrawIt.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/include/prototypes.h
r33650 r38465 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)); -
trunk/Ohana/src/kapa2/include/structures.h
r37807 r38465 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 -
trunk/Ohana/src/kapa2/src/CheckPipe.c
r36833 r38465 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); -
trunk/Ohana/src/kapa2/src/InterpretKeys.c
r38153 r38465 102 102 UpdateStatusBox (graphic, image, X, Y, 0.0, 1); \ 103 103 Remap (graphic, image); \ 104 Refresh (); \ 104 105 break; 105 106 -
trunk/Ohana/src/kapa2/src/SetChannel.c
r37807 r38465 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 } -
trunk/Ohana/src/kapa2/src/SetColormap.c
r38153 r38465 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 } -
trunk/Ohana/src/kapa2/src/SetGraphSize.c
r34088 r38465 21 21 double X0 = graphic[0].dx * section[0].x + x0; 22 22 double Y0 = graphic[0].dy * section[0].y + y0; 23 double dX = graphic[0].dx * section[0].dx - x1;24 double dY = graphic[0].dy * section[0].dy - y1;23 double dX = MAX(graphic[0].dx * section[0].dx - x1, 1); 24 double dY = MAX(graphic[0].dy * section[0].dy - y1, 1); 25 25 26 26 /* define locations of coordinate axes */ -
trunk/Ohana/src/kapa2/src/SetImageSize.c
r29539 r38465 306 306 image[0].picture.x = Xs + PAD1; 307 307 image[0].picture.y = Ys + 2*PAD1 + COLORPAD; 308 image[0].picture.dx = dX - 3*PAD1 - 1 - ZOOM_X;309 image[0].picture.dy = dY - 3*PAD1 - 1 - COLORPAD;308 image[0].picture.dx = MAX(dX - 3*PAD1 - 1 - ZOOM_X, 1); 309 image[0].picture.dy = MAX(dY - 3*PAD1 - 1 - COLORPAD, 1); 310 310 } 311 311 -
trunk/Ohana/src/kapa2/src/SetUpGraphic.c
r32695 r38465 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; -
trunk/Ohana/src/kapa2/src/bDrawIt.c
r33650 r38465 23 23 section = GetSectionByNumber (i); 24 24 bDrawImage (buffer, section->image, graphic); 25 for (i = 0; section->image && (i < NOVERLAYS); i++) { 26 if (section->image->overlay[i].active) bDrawOverlay (buffer, section->image, i); 27 } 25 28 bDrawGraph (buffer, section->graph); 26 29 }
Note:
See TracChangeset
for help on using the changeset viewer.
