Changeset 15906
- Timestamp:
- Dec 22, 2007, 8:02:23 AM (18 years ago)
- Location:
- branches/eam_branch_20071222/Ohana/src/kapa2
- Files:
-
- 5 edited
-
include/structures.h (modified) (1 diff)
-
src/CheckVisual.c (modified) (1 diff)
-
src/InterpretKeys.c (modified) (1 diff)
-
src/Remap32.c (modified) (4 diffs)
-
src/SetColormap.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20071222/Ohana/src/kapa2/include/structures.h
r14590 r15906 14 14 int x, y; 15 15 unsigned int dx, dy; 16 XColor cmap[ 256];16 XColor cmap[1024]; 17 17 Colormap colormap; 18 18 unsigned long fore; 19 19 unsigned long back; 20 20 unsigned long *color; 21 unsigned long pixels[ 256];21 unsigned long pixels[1024]; 22 22 unsigned long overlay_color[NOVERLAYS]; 23 23 int Npixels; -
branches/eam_branch_20071222/Ohana/src/kapa2/src/CheckVisual.c
r13479 r15906 177 177 178 178 if (!dyn) { 179 graphic[0].Npixels = 256;179 graphic[0].Npixels = 1024; 180 180 // fprintf (stderr, "can't use dynamic colors, color scrollbar inactive\n"); 181 181 // fprintf (stderr, " this can be avoided by using a dynamic visual class\n"); -
branches/eam_branch_20071222/Ohana/src/kapa2/src/InterpretKeys.c
r14590 r15906 132 132 break; 133 133 134 case XK_KP_Add: 135 image[0].zero += 0.1*image[0].range; 136 Reorient (graphic, image, image[0].X, image[0].Y, 0); 137 break; 138 case XK_KP_Subtract: 139 image[0].zero -= 0.1*image[0].range; 140 Reorient (graphic, image, image[0].X, image[0].Y, 0); 141 break; 142 134 143 case XK_Tab: 135 144 image[0].MovePointer = image[0].MovePointer ^ TRUE; -
branches/eam_branch_20071222/Ohana/src/kapa2/src/Remap32.c
r13479 r15906 6 6 7 7 // XXX inline this if needed 8 # define PixelLookup(VALUE) (int)(MIN (MAX (slope * VALUE - start, 0), MaxValue)) 9 10 # if (0) 8 11 static int PixelLookup(float value) { 9 12 int out; … … 11 14 return (out); 12 15 } 16 # endif 13 17 14 18 void Remap32 (Graphic *graphic, KapaImageWidget *image, Matrix *matrix) { … … 22 26 unsigned int *out_pix, *out_pix2; 23 27 float *imdata, *in_pix, *in_pix2; 24 unsigned long pixel[256], pixvalue;28 unsigned long *pixel, pixvalue; 25 29 unsigned long back; 26 30 31 ALLOCATE (pixel, unsigned long, graphic[0].Npixels); 32 27 33 // local array for pixel values 28 for (i = 0; i < 256; i++) {34 for (i = 0; i < graphic[0].Npixels; i++) { 29 35 pixel[i] = graphic[0].cmap[i].pixel; 30 36 } … … 154 160 image[0].picture.pix = XCreateImage (graphic[0].display, graphic[0].visual, graphic[0].depth, ZPixmap, 0, 155 161 image[0].picture.data, image[0].picture.dx, image[0].picture.dy, 32, 0); 162 163 free (pixel); 156 164 } 157 165 -
branches/eam_branch_20071222/Ohana/src/kapa2/src/SetColormap.c
r13320 r15906 4 4 first to get better control over the smooth greyscales ***/ 5 5 6 /** red,green,blue are values in range 0x0000 to 0xffff **/ 7 6 8 int SetColormap (char *name) { 7 9 8 10 int i; 11 float scale; 9 12 Graphic *graphic; 10 13 … … 13 16 /* greyscale */ 14 17 if ((!strcmp (name, "grayscale")) || (!strcmp (name, "greyscale"))) { 18 19 scale = 0xffff / graphic[0].Npixels; 20 15 21 for (i = 0; i < graphic[0].Npixels; i++) { 16 graphic[0].cmap[i].red = 256*(255 - 255*i/graphic[0].Npixels); 17 graphic[0].cmap[i].green = 256*(255 - 255*i/graphic[0].Npixels); 18 graphic[0].cmap[i].blue = 256*(255 - 255*i/graphic[0].Npixels); 22 graphic[0].cmap[i].red = 0xffff - i*scale; 23 graphic[0].cmap[i].green = 0xffff - i*scale; 24 graphic[0].cmap[i].blue = 0xffff - i*scale; 25 graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue; 26 } 27 goto store_colors; 28 } 29 /* -grayscale */ 30 if ((!strcmp (name, "-grayscale")) || (!strcmp (name, "-greyscale"))) { 31 for (i = 0; i < graphic[0].Npixels; i++) { 32 graphic[0].cmap[i].red = 256*(255*i/graphic[0].Npixels); 33 graphic[0].cmap[i].green = 256*(255*i/graphic[0].Npixels); 34 graphic[0].cmap[i].blue = 256*(255*i/graphic[0].Npixels); 19 35 graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue; 20 36 } … … 45 61 graphic[0].cmap[i].green = 256*255; 46 62 graphic[0].cmap[i].blue = MIN (256*255, 256*255*2*(i/(1.0*graphic[0].Npixels) - 0.50)); 47 graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;48 }49 goto store_colors;50 }51 /* -grayscale */52 if ((!strcmp (name, "-grayscale")) || (!strcmp (name, "-greyscale"))) {53 for (i = 0; i < graphic[0].Npixels; i++) {54 graphic[0].cmap[i].red = 256*(255*i/graphic[0].Npixels);55 graphic[0].cmap[i].green = 256*(255*i/graphic[0].Npixels);56 graphic[0].cmap[i].blue = 256*(255*i/graphic[0].Npixels);57 63 graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue; 58 64 }
Note:
See TracChangeset
for help on using the changeset viewer.
