Changeset 16039
- Timestamp:
- Jan 8, 2008, 12:49:54 PM (18 years ago)
- Location:
- trunk/Ohana/src/kapa2
- Files:
-
- 9 edited
-
Makefile (modified) (1 diff)
-
include/Ximage.h (modified) (1 diff)
-
include/structures.h (modified) (2 diffs)
-
src/ButtonFunctions.c (modified) (4 diffs)
-
src/InterpretKeys.c (modified) (3 diffs)
-
src/SetColorScale.c (modified) (4 diffs)
-
src/SetColormap.c (modified) (1 diff)
-
src/SetUpGraphic.c (modified) (1 diff)
-
test/input (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/Makefile
r16011 r16039 79 79 $(SRC)/PSOverlay.$(ARCH).o $(SRC)/SetChannel.$(ARCH).o \ 80 80 $(SRC)/SetColorScale.$(ARCH).o $(SRC)/ColorCube.$(ARCH).o \ 81 $(SRC)/ColorHistogram.$(ARCH).o $(SRC)/sort.$(ARCH).o81 $(SRC)/ColorHistogram.$(ARCH).o 82 82 83 83 OBJ = $(KAPA) -
trunk/Ohana/src/kapa2/include/Ximage.h
r13320 r16039 1 # include <Xohana.h> 1 # include <X11/Xatom.h> 2 # include <X11/Xlib.h> 3 # include <X11/Xresource.h> 4 # include <X11/Xutil.h> 5 # include <X11/cursorfont.h> 6 # include <X11/keysym.h> 7 # include <X11/keysymdef.h> 8 9 # include <ohana.h> 2 10 # include <dvo.h> 3 11 # include <kapa.h> -
trunk/Ohana/src/kapa2/include/structures.h
r16011 r16039 1 2 /**************** Graphic carries X info around ****************/3 typedef struct {4 Display *display; // X display pointer5 int screen; // X screen number6 int depth;7 Window window;8 Visual *visual;9 int visualclass; // is visual dynamic? (XXX change name?)10 int Nbits; // pixel depth in bits (8, 16, 24, 32)11 GC gc;12 XFontStruct *font;13 Cursor cursor;14 int x, y;15 unsigned int dx, dy;16 XColor *cmap;17 Colormap colormap;18 unsigned long *color; // graph plotting colors19 int Ncolors;20 21 unsigned long *pixels; // image pixel colors22 int Npixels; // number of pixels23 24 int ColorScaleMode; // single colormap for all images??25 int nRed;26 int nBlue;27 int nGreen;28 29 unsigned long fore; // basic foreground color30 unsigned long back; // basic background color31 32 unsigned long overlay_color[NOVERLAYS]; // image plotting colors33 } Graphic;34 35 /**************** X related "widget" structures ****************/36 typedef struct {37 int x, y, dx, dy; /* position and size */38 int width, height; /* size of the bitmap */39 char *bitmap; /* picture on button */40 int (*function_1) (); /* mouse_button 1 function */41 int (*function_2) (); /* mouse_button 2 function */42 int (*function_3) (); /* mouse_button 3 function */43 } Button;44 45 typedef struct {46 int x, y, dx, dy; /* position and size */47 char *label; /* label on TextLine */48 char text[1024]; /* words of TextLine */49 char old_text[1024]; /* words of TextLine */50 int outline; /* draw an outline? */51 int cursor; /* location of cursor (if selected) */52 int (*function) (); /* textline function */53 } TextLine;54 55 typedef char STRING[1024];56 57 typedef struct {58 int x, y, dx, dy; /* position and size */59 STRING *text; /* words of TextLine */60 int Nlines;61 int outline; /* draw an outline? */62 int cursor_line; /* cursor line */63 int cursor_x; /* location of cursor (if selected) */64 int cursor_y; /* location of cursor (if selected) */65 int (*function) (); /* textline function */66 } TextBox;67 1 68 2 /*** 3C color cube histogram tree thingy ***/ … … 80 14 } CCNode; 81 15 16 /**************** Graphic carries X info around ****************/ 17 typedef struct { 18 Display *display; // X display pointer 19 int screen; // X screen number 20 int depth; 21 Window window; 22 Visual *visual; 23 int visualclass; // is visual dynamic? (XXX change name?) 24 int Nbits; // pixel depth in bits (8, 16, 24, 32) 25 GC gc; 26 XFontStruct *font; 27 Cursor cursor; 28 int x, y; 29 unsigned int dx, dy; 30 CCNode *cube; 31 XColor *cmap; 32 Colormap colormap; 33 unsigned long *color; // graph plotting colors 34 int Ncolors; 35 36 unsigned long *pixels; // image pixel colors 37 int Npixels; // number of pixels 38 39 int ColorScaleMode; // single colormap for all images?? 40 int nRed; 41 int nBlue; 42 int nGreen; 43 44 unsigned long fore; // basic foreground color 45 unsigned long back; // basic background color 46 47 unsigned long overlay_color[NOVERLAYS]; // image plotting colors 48 } Graphic; 49 50 /**************** X related "widget" structures ****************/ 51 typedef struct { 52 int x, y, dx, dy; /* position and size */ 53 int width, height; /* size of the bitmap */ 54 char *bitmap; /* picture on button */ 55 int (*function_1) (); /* mouse_button 1 function */ 56 int (*function_2) (); /* mouse_button 2 function */ 57 int (*function_3) (); /* mouse_button 3 function */ 58 } Button; 59 60 typedef struct { 61 int x, y, dx, dy; /* position and size */ 62 char *label; /* label on TextLine */ 63 char text[1024]; /* words of TextLine */ 64 char old_text[1024]; /* words of TextLine */ 65 int outline; /* draw an outline? */ 66 int cursor; /* location of cursor (if selected) */ 67 int (*function) (); /* textline function */ 68 } TextLine; 69 70 typedef char STRING[1024]; 71 72 typedef struct { 73 int x, y, dx, dy; /* position and size */ 74 STRING *text; /* words of TextLine */ 75 int Nlines; 76 int outline; /* draw an outline? */ 77 int cursor_line; /* cursor line */ 78 int cursor_x; /* location of cursor (if selected) */ 79 int cursor_y; /* location of cursor (if selected) */ 80 int (*function) (); /* textline function */ 81 } TextBox; 82 82 83 /**************** general structures ****************/ 83 84 typedef struct { -
trunk/Ohana/src/kapa2/src/ButtonFunctions.c
r16011 r16039 1 1 # include "Ximage.h" 2 3 static char *GREY = "greyscale";4 static char *HEAT = "Heat";5 static char *RAINBOW = "Rainbow";6 2 7 3 int PSfunction (Graphic *graphic, KapaImageWidget *image) { … … 14 10 15 11 int greycolors (Graphic *graphic, KapaImageWidget *image) { 16 char *name; 17 name = GREY; 18 SetColormap (name); 12 SetColormap ("greyscale"); 19 13 CreateColorbar (image, graphic); 20 14 SetColorScale (graphic, image); … … 27 21 28 22 int heat (Graphic *graphic, KapaImageWidget *image) { 29 char *name; 30 name = HEAT; 31 SetColormap ("ruffcolor"); 23 SetColormap ("heat"); 32 24 CreateColorbar (image, graphic); 33 25 SetColorScale (graphic, image); … … 40 32 41 33 int rainbow (Graphic *graphic, KapaImageWidget *image) { 42 char *name; 43 name = RAINBOW; 44 SetColormap ("fullcolor"); 34 SetColormap ("rainbow"); 45 35 CreateColorbar (image, graphic); 46 36 SetColorScale (graphic, image); -
trunk/Ohana/src/kapa2/src/InterpretKeys.c
r16011 r16039 91 91 case XK_F1: 92 92 image[0].image = &image[0].channel[0]; 93 SetColorScale (graphic, image); 94 Remap (graphic, image); 93 95 Reorient (graphic, image, image[0].X, image[0].Y, 0); 94 96 break; … … 96 98 case XK_F2: 97 99 image[0].image = &image[0].channel[1]; 100 SetColorScale (graphic, image); 101 Remap (graphic, image); 98 102 Reorient (graphic, image, image[0].X, image[0].Y, 0); 99 103 break; … … 101 105 case XK_F3: 102 106 image[0].image = &image[0].channel[2]; 107 SetColorScale (graphic, image); 108 Remap (graphic, image); 103 109 Reorient (graphic, image, image[0].X, image[0].Y, 0); 104 110 break; -
trunk/Ohana/src/kapa2/src/SetColorScale.c
r16011 r16039 148 148 149 149 // in 3D we use channels 0,1,2 to choose the pixel from the cube 150 int SetColor Scale3D_CC (Graphic *graphic, KapaImageWidget *image) {150 int SetColorCubeHistogram () { 151 151 152 152 int i, DX, DY, Nvalues, NVALUES, Npixels, Nmin; 153 153 float *values, *colors; 154 154 CCNode *cube; 155 Graphic *graphic; 156 Section *section; 157 KapaImageWidget *image; 158 159 graphic = GetGraphic (); 160 section = GetActiveSection(); 161 if (section->image == NULL) return (FALSE); 162 image = section->image; 155 163 156 164 DX = image[0].channel[KAPA_CHANNEL_RED].matrix.Naxis[0]; … … 162 170 163 171 // create the top-level cube 164 cube = CCNodeAlloc(); 172 if (graphic[0].cube != NULL) { 173 CCNodeFree (graphic[0].cube); 174 } 175 graphic[0].cube = CCNodeAlloc(); 176 177 cube = graphic[0].cube; 165 178 cube->min[CC_X] = cube->min[CC_Y] = cube->min[CC_Z] = 0.0; 166 179 cube->max[CC_X] = cube->max[CC_Y] = cube->max[CC_Z] = 1.0; … … 185 198 186 199 // select top N cells 187 sort (values, Nvalues);200 fsort (values, Nvalues); 188 201 189 202 // split nodes with more than value[n] … … 214 227 } 215 228 } 229 return TRUE; 230 } 231 232 // in 3D we use channels 0,1,2 to choose the pixel from the cube 233 int SetColorScale3D_CC (Graphic *graphic, KapaImageWidget *image) { 234 235 int i, DX, DY, Nvalues, NVALUES, Npixels, Nmin; 236 float *values, *colors; 237 CCNode *cube; 238 239 // create the top-level cube 240 cube = graphic[0].cube; 216 241 CCNodeSetColorPixels (image, cube); 217 242 return TRUE; -
trunk/Ohana/src/kapa2/src/SetColormap.c
r16011 r16039 23 23 if (!strcasecmp (name, "fullcolor")) { 24 24 graphic[0].ColorScaleMode = KAPA_SCALE_3D_FULL; 25 return TRUE;25 if (SetColorCubeHistogram ()) return TRUE; 26 26 } 27 27 -
trunk/Ohana/src/kapa2/src/SetUpGraphic.c
r16011 r16039 21 21 ALLOCATE (graphic[0].cmap, XColor, NPIXELS_STATIC); 22 22 graphic[0].Npixels = NPIXELS_STATIC; 23 graphic[0].cube = NULL; 23 24 return; 24 25 } -
trunk/Ohana/src/kapa2/test/input
r16037 r16039 5 5 set y = yramp(a) 6 6 set z = sqrt((x-256)^2 + (y-256)^2) 7 tvchannel 07 tvchannel 1 8 8 tv x 0 512 9 tvchannel 19 tvchannel 2 10 10 tv y 0 512 11 tvchannel 211 tvchannel 3 12 12 tv z 0 512 13 13 end … … 20 20 set G = g*(g >= 0) + (g + 256)*(g < 0) 21 21 set B = b*(b >= 0) + (b + 256)*(b < 0) 22 tvchannel 022 tvchannel 1 23 23 tv R 0 256 24 tvchannel 124 tvchannel 2 25 25 tv G 0 256 26 tvchannel 226 tvchannel 3 27 27 tv B 0 256 28 29 tvcolor ruffcolor 30 sleep 1 31 tvcolor fullcolor 28 32 end
Note:
See TracChangeset
for help on using the changeset viewer.
