Changeset 38153 for trunk/Ohana/src/kapa2
- Timestamp:
- Apr 18, 2015, 6:33:51 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
- 2 copied
-
. (modified) (1 prop)
-
Ohana/src/kapa2/doc/rainbow.cm (copied) (copied from branches/eam_branches/ipp-20150405/Ohana/src/kapa2/doc/rainbow.cm )
-
Ohana/src/kapa2/doc/vista.cm (copied) (copied from branches/eam_branches/ipp-20150405/Ohana/src/kapa2/doc/vista.cm )
-
Ohana/src/kapa2/src/DrawObjects.c (modified) (4 diffs)
-
Ohana/src/kapa2/src/InterpretKeys.c (modified) (2 diffs)
-
Ohana/src/kapa2/src/PSObjects.c (modified) (4 diffs)
-
Ohana/src/kapa2/src/SetColormap.c (modified) (1 diff)
-
Ohana/src/kapa2/src/bDrawObjects.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20150405 (added) merged: 38084-38085,38098-38101,38135-38136,38139-38143,38146-38152
- Property svn:mergeinfo changed
-
trunk/Ohana/src/kapa2/src/DrawObjects.c
r38062 r38153 248 248 249 249 /* connect first point to second point */ 250 sxa = sx0 - 0.5*(sx1 - sx0);250 sxa = MIN (MAX (sx0 - 0.5*(sx1 - sx0), X0), X1); 251 251 sya = MAX (sy0, Y0); 252 252 DrawLine (sx0, sy0, sxa, sy0); … … 254 254 255 255 /* draw segment equal distance behind first point and down to x-axis */ 256 sxa = 0.5*(sx0 + sx1);256 sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1); 257 257 DrawLine (sx0, sy0, sxa, sy0); 258 258 DrawLine (sxa, sy0, sxa, sy1); … … 269 269 sx1 = MIN (MAX (sx1, X0), X1); 270 270 sy1 = MAX (MIN (sy1, Y0), Y1); 271 sxa = 0.5*(sx0 + sx1);271 sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1); 272 272 DrawLine (sx0, sy0, sxa, sy0); 273 273 DrawLine (sxa, sy0, sxa, sy1); … … 278 278 279 279 /* draw segment equal distance after last point and down to x-axis */ 280 sxa = sx1 + 0.5*(sx1 - sxo);280 sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1); 281 281 sya = MAX (sy1, Y0); 282 282 DrawLine (sx1, sy1, sxa, sy1); -
trunk/Ohana/src/kapa2/src/InterpretKeys.c
r38062 r38153 1 1 # include "Ximage.h" 2 # define FILTER_MODS 1 2 3 3 4 int InterpretKeys (Graphic *graphic, XKeyEvent *event) { … … 32 33 // skip the following keys: 33 34 if (name == NULL) goto skip_cursor; 34 if (!strcmp (name, "Shift_L")) goto skip_cursor; 35 if (!strcmp (name, "Shift_R")) goto skip_cursor; 36 if (!strcmp (name, "Control_L")) goto skip_cursor; 37 if (!strcmp (name, "Control_R")) goto skip_cursor; 38 if (!strcmp (name, "Alt_L")) goto skip_cursor; 39 if (!strcmp (name, "Alt_R")) goto skip_cursor; 40 if (!strcmp (name, "Super_L")) goto skip_cursor; 41 if (!strcmp (name, "Super_R")) goto skip_cursor; 42 if (!strcmp (name, "Caps_Lock")) goto skip_cursor; 43 if (!strcmp (name, "Pause")) goto skip_cursor; 44 if (!strcmp (name, "Continue")) goto skip_cursor; 45 if (!strcmp (name, "Num_Lock")) goto skip_cursor; 46 if (!strcmp (name, "Scroll_Lock")) goto skip_cursor; 47 if (!strcmp (name, "Print")) goto skip_cursor; 48 if (!strcmp (name, "(null)")) goto skip_cursor; 35 if (FILTER_MODS) { 36 if (!strcmp (name, "Shift_L")) goto skip_cursor; 37 if (!strcmp (name, "Shift_R")) goto skip_cursor; 38 if (!strcmp (name, "Control_L")) goto skip_cursor; 39 if (!strcmp (name, "Control_R")) goto skip_cursor; 40 if (!strcmp (name, "Alt_L")) goto skip_cursor; 41 if (!strcmp (name, "Alt_R")) goto skip_cursor; 42 if (!strcmp (name, "Super_L")) goto skip_cursor; 43 if (!strcmp (name, "Super_R")) goto skip_cursor; 44 if (!strcmp (name, "Caps_Lock")) goto skip_cursor; 45 if (!strcmp (name, "Pause")) goto skip_cursor; 46 if (!strcmp (name, "Continue")) goto skip_cursor; 47 if (!strcmp (name, "Num_Lock")) goto skip_cursor; 48 if (!strcmp (name, "Scroll_Lock")) goto skip_cursor; 49 if (!strcmp (name, "Print")) goto skip_cursor; 50 if (!strcmp (name, "(null)")) goto skip_cursor; 51 } 49 52 50 53 Z = -1; -
trunk/Ohana/src/kapa2/src/PSObjects.c
r38062 r38153 211 211 212 212 /* connect first point to second point */ 213 sxa = sx0 - 0.5*(sx1 - sx0);213 sxa = MIN (MAX (sx0 - 0.5*(sx1 - sx0), X0), X1); 214 214 sya = MAX (sy0, Y0); 215 215 DrawLine (sx0, sy0, sxa, sy0); … … 217 217 218 218 /* draw segment equal distance behind first point and down to x-axis */ 219 sxa = 0.5*(sx0 + sx1);219 sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1); 220 220 DrawLine (sx0, sy0, sxa, sy0); 221 221 DrawLine (sxa, sy0, sxa, sy1); … … 232 232 sx1 = MIN (MAX (sx1, X0), X1); 233 233 sy1 = MAX (MIN (sy1, Y0), Y1); 234 sxa = 0.5*(sx0 + sx1);234 sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1); 235 235 DrawLine (sx0, sy0, sxa, sy0); 236 236 DrawLine (sxa, sy0, sxa, sy1); … … 241 241 242 242 /* draw segment equal distance after last point and down to x-axis */ 243 sxa = sx1 + 0.5*(sx1 - sxo);243 sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1); 244 244 sya = MAX (sy1, Y0); 245 245 DrawLine (sx1, sy1, sxa, sy1); -
trunk/Ohana/src/kapa2/src/SetColormap.c
r35106 r38153 166 166 goto store_colors; 167 167 } 168 /* anuenue */ 169 if (!strcasecmp (name, "anuenue")) { 170 redRef = 0.25*MaxValue*scale*4.0; // value at 0.0 171 greenRef = 0.50*MaxValue*scale*4.0; 172 blueRef = 1.33*MaxValue*scale; 173 for (i = 0; i < (int)(0.50*MaxValue); i++) { 174 SETVALUE (graphic[0].cmap[i].green, 0.0, 0, 0xffff); // red is a ramp from 0 to 0xffff 175 graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue; 176 } 177 for (i = (int)(0.50*MaxValue); i < (int)(0.75*MaxValue); i++) { 178 SETVALUE (graphic[0].cmap[i].green, 4.0*i*scale - 0x20000, 0, 0xffff); // red is a ramp from 0 to 0xffff 179 graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue; 180 } 181 for (i = (int)(0.75*MaxValue); i < MaxValue; i++) { 182 SETVALUE (graphic[0].cmap[i].green, 0xffff, 0, 0xffff); // red is a ramp from 0 to 0xffff 183 graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue; 184 } 185 186 for (i = 0; i < (int)(0.25*MaxValue); i++) { 187 SETVALUE (graphic[0].cmap[i].red, 4*i*scale, 0, 0xffff); 188 } 189 for (i = (int)(0.25*MaxValue); i < (int)(0.50*MaxValue); i++) { 190 SETVALUE (graphic[0].cmap[i].red, 0x20000 - 4*i*scale, 0, 0xffff); 191 } 192 for (i = (int)(0.50*MaxValue); i < MaxValue; i++) { 193 SETVALUE (graphic[0].cmap[i].red, 2*i*scale - 0xffff, 0, 0xffff); 194 } 195 196 for (i = 0; i < (int)(0.50*MaxValue); i++) { 197 SETVALUE (graphic[0].cmap[i].blue, 2*i*scale, 0, 0xffff); 198 } 199 for (i = (int)(0.50*MaxValue); i < (int)(0.75*MaxValue); i++) { 200 SETVALUE (graphic[0].cmap[i].blue, 0x30000 - 4*i*scale, 0, 0xffff); 201 } 202 for (i = (int)(0.75*MaxValue); i < MaxValue; i++) { 203 SETVALUE (graphic[0].cmap[i].blue, 4*i*scale - 0x30000, 0, 0xffff); 204 } 205 goto store_colors; 206 } 207 208 /* anuenue */ 209 if (!strncmp (name, "file:", 5)) { 210 FILE *f = fopen (&name[5], "r"); 211 if (!f) { 212 fprintf (stderr, "failed to open colormap file %s\n", &name[5]); 213 return FALSE; 214 } 215 char line[1024]; 216 217 int lastIndex = 0; 218 float lastRed = 0.0; 219 float lastBlue = 0.0; 220 float lastGreen = 0.0; 221 222 float fracIndex, fracRed, fracBlue, fracGreen; 223 224 while (scan_line_maxlen (f, line, 1024) != EOF) { 225 // file contains f R G B : f = 0.0 - 1.0, R,G,B = 0.0 - 1.0 226 int Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracBlue, &fracGreen); 227 if (Nscan != 4) continue; 228 229 int nextIndex = fracIndex * MaxValue; 230 if (nextIndex <= lastIndex) { 231 lastRed = fracRed; 232 lastBlue = fracBlue; 233 lastGreen = fracGreen; 234 continue; 235 } 236 float dRdI = (fracRed - lastRed) / (float) (nextIndex - lastIndex); 237 float dBdI = (fracBlue - lastBlue) / (float) (nextIndex - lastIndex); 238 float dGdI = (fracGreen - lastGreen) / (float) (nextIndex - lastIndex); 239 for (i = lastIndex; i < nextIndex; i++) { 240 float redValue = 0xffff * (dRdI * (i - lastIndex) + lastRed); 241 float blueValue = 0xffff * (dBdI * (i - lastIndex) + lastBlue); 242 float greenValue = 0xffff * (dGdI * (i - lastIndex) + lastGreen); 243 SETVALUE (graphic[0].cmap[i].red, redValue, 0, 0xffff); 244 SETVALUE (graphic[0].cmap[i].blue, blueValue, 0, 0xffff); 245 SETVALUE (graphic[0].cmap[i].green, greenValue, 0, 0xffff); 246 } 247 lastRed = fracRed; 248 lastBlue = fracBlue; 249 lastGreen = fracGreen; 250 lastIndex = nextIndex; 251 } 252 fclose (f); 253 254 if ((int) (MaxValue*fracIndex) < MaxValue) { 255 float dRdI = (1.0 - lastRed) / (float) (MaxValue - lastIndex); 256 float dBdI = (1.0 - lastBlue) / (float) (MaxValue - lastIndex); 257 float dGdI = (1.0 - lastGreen) / (float) (MaxValue - lastIndex); 258 for (i = lastIndex; i < MaxValue; i++) { 259 float redValue = 0xffff * (dRdI * (i - lastIndex) + lastRed); 260 float blueValue = 0xffff * (dBdI * (i - lastIndex) + lastBlue); 261 float greenValue = 0xffff * (dGdI * (i - lastIndex) + lastGreen); 262 SETVALUE (graphic[0].cmap[i].red, redValue, 0, 0xffff); 263 SETVALUE (graphic[0].cmap[i].blue, blueValue, 0, 0xffff); 264 SETVALUE (graphic[0].cmap[i].green, greenValue, 0, 0xffff); 265 } 266 } 267 goto store_colors; 268 } 269 168 270 return (FALSE); 169 271 -
trunk/Ohana/src/kapa2/src/bDrawObjects.c
r38062 r38153 198 198 199 199 /* connect first point to second point */ 200 sxa = sx0 - 0.5*(sx1 - sx0);200 sxa = MIN (MAX (sx0 - 0.5*(sx1 - sx0), X0), X1); 201 201 sya = MAX (sy0, Y0); 202 202 DrawLine (buffer, sx0, sy0, sxa, sy0); … … 204 204 205 205 /* draw segment equal distance behind first point and down to x-axis */ 206 sxa = 0.5*(sx0 + sx1);206 sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1); 207 207 DrawLine (buffer, sx0, sy0, sxa, sy0); 208 208 DrawLine (buffer, sxa, sy0, sxa, sy1); … … 219 219 sx1 = MIN (MAX (sx1, X0), X1); 220 220 sy1 = MAX (MIN (sy1, Y0), Y1); 221 sxa = 0.5*(sx0 + sx1);221 sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1); 222 222 DrawLine (buffer, sx0, sy0, sxa, sy0); 223 223 DrawLine (buffer, sxa, sy0, sxa, sy1); … … 228 228 229 229 /* draw segment equal distance after last point and down to x-axis */ 230 sxa = sx1 + 0.5*(sx1 - sxo);230 sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1); 231 231 sya = MAX (sy1, Y0); 232 232 DrawLine (buffer, sx1, sy1, sxa, sy1);
Note:
See TracChangeset
for help on using the changeset viewer.
