- Timestamp:
- Nov 27, 2019, 11:00:17 AM (7 years ago)
- Location:
- trunk/Ohana/src/kapa2
- Files:
-
- 23 edited
- 2 copied
-
Makefile (modified) (1 diff)
-
doc/outline.txt (copied) (copied from branches/eam_branches/ohana.20190329/src/kapa2/doc/outline.txt )
-
include/prototypes.h (modified) (6 diffs)
-
include/structures.h (modified) (2 diffs)
-
src/CheckPipe.c (modified) (1 diff)
-
src/DrawObjects.c (modified) (6 diffs)
-
src/Image.c (modified) (3 diffs)
-
src/InterpretKeys.c (modified) (2 diffs)
-
src/JPEGit24.c (modified) (1 diff)
-
src/Layout.c (modified) (1 diff)
-
src/LoadFrame.c (modified) (1 diff)
-
src/LoadLabels.c (modified) (1 diff)
-
src/LoadObject.c (modified) (2 diffs)
-
src/MemoryDump.c (copied) (copied from branches/eam_branches/ohana.20190329/src/kapa2/src/MemoryDump.c )
-
src/PNGit.c (modified) (2 diffs)
-
src/PPMit.c (modified) (1 diff)
-
src/Refresh.c (modified) (2 diffs)
-
src/SetColormap.c (modified) (6 diffs)
-
src/SetUpGraphic.c (modified) (3 diffs)
-
src/args.c (modified) (1 diff)
-
src/bDrawImage.c (modified) (4 diffs)
-
src/bDrawIt.c (modified) (1 diff)
-
src/bDrawObjects.c (modified) (6 diffs)
-
src/bDrawOverlay.c (modified) (2 diffs)
-
src/kapa.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/Makefile
r39401 r41157 42 42 $(SRC)/bDrawObjects.$(ARCH).o $(SRC)/bDrawFrame.$(ARCH).o \ 43 43 $(SRC)/bDrawLabels.$(ARCH).o $(SRC)/bDrawIt.$(ARCH).o \ 44 $(SRC)/bDrawImage.$(ARCH).o \44 $(SRC)/bDrawImage.$(ARCH).o $(SRC)/MemoryDump.$(ARCH).o \ 45 45 $(SRC)/PNGit.$(ARCH).o $(SRC)/PPMit.$(ARCH).o \ 46 46 $(SRC)/PSit.$(ARCH).o $(SRC)/CrossHairs.$(ARCH).o \ -
trunk/Ohana/src/kapa2/include/prototypes.h
r40165 r41157 3 3 int args PROTO((int *argc, char **argv)); 4 4 void SetUpGraphic PROTO((int *argc, char **argv)); 5 void FreeGraphic PROTO((void)); 5 6 void DefineLayout PROTO((int, char **)); 6 7 int EventLoop PROTO((void)); 7 8 void CloseDisplay PROTO((void)); 9 int MemoryDump PROTO((int sock)); 10 int MemoryDumpLines PROTO((int sock)); 11 int MemoryDumpOnExit PROTO((int sock)); 12 int MemoryDumpSetOnExit PROTO((int state)); 13 int MemoryDumpAndExit PROTO((void)); 8 14 9 15 /* SetUpGraphic */ … … 33 39 void DrawTextlines PROTO((KapaGraphWidget *graph)); 34 40 void DrawConnect PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 41 void DrawPolygon PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 42 void DrawPolyfill PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 35 43 void DrawHistogram PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 36 44 int DrawObjectN PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); … … 85 93 int SetColormapFromPipe PROTO((int sock)); 86 94 int SetNanColorFromPipe PROTO((int sock)); 95 int SetSmoothSigma PROTO((int sock)); 87 96 88 97 int LoadVectorData PROTO((int sock, KapaGraphWidget *graph, int N, char *type)); … … 109 118 110 119 void InitLayout PROTO((int argc, char **argv)); 120 void FreeLayout PROTO((void)); 111 121 112 122 /* PS drawing utilities */ … … 142 152 void bDrawBars PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object, int mode)); 143 153 void bDrawPoints PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 154 void bDrawPolygons PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 155 void bDrawFillPolygons PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 144 156 void bDrawXErrors PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 145 157 void bDrawYErrors PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); … … 179 191 void InitButtonFunc PROTO((Button *button, int (*function)(Graphic *graphic, KapaImageWidget *image))); 180 192 void DrawImage PROTO((KapaImageWidget *image)); 193 void DrawImageTool PROTO((KapaImageWidget *image)); 181 194 void DrawButton PROTO((Graphic *graphic, Button *button)); 182 195 void DrawBitmap PROTO((Graphic *graphic, int x, int y, int dx, int dy, unsigned char *bitmap, int mode)); -
trunk/Ohana/src/kapa2/include/structures.h
r40570 r41157 48 48 unsigned long back; // basic background color 49 49 50 float smooth_sigma; // anti-aliasing smoothing scale 51 50 52 unsigned long overlay_color[NOVERLAYS]; // image plotting colors 51 53 } Graphic; … … 131 133 } Overlay; 132 134 133 typedef struct { 134 float *x, *y, *z, *dxp, *dxm, *dyp, *dym; 135 int Npts; 136 int style, ptype, ltype, color, etype, ebar; 137 double lweight, size; 135 // a set of objects all have the same basic properties 136 typedef struct { 137 float *x; // x-coordinates of the points 138 float *y; // y-coordinates of the points 139 float *z; // size/colorscale for points 140 float *dxp; // lower-errorbar in x 141 float *dxm; // upper-errorbar in x 142 float *dyp; // lower-errorbar in y 143 float *dym; // upper-errorbar in y 144 int Npts; // number of points in this set 145 int style; // how are the object draw: CONNECT, HISTOGRAM, 146 int ptype; // shape of object at each point 147 // ptype is overloaded for NPOLYGON to be the number of points / polygon 148 int ltype; // style of line (solid, dot, dash, etc) 149 int color; // color for point (if not colorscaled) 150 int etype; // errorbars to draw (0x01 = y, 0x02 = x) 151 int ebar; // draw a cap on the error bar 152 double lweight; // line thickness 153 double size; // size of the object 138 154 double x0, x1, y0, y1; /* limits for this object */ 139 155 double alpha; -
trunk/Ohana/src/kapa2/src/CheckPipe.c
r38465 r41157 352 352 } 353 353 354 if (!strcmp (word, "SIGM")) { 355 SetSmoothSigma (sock); 356 KiiSendCommand (sock, 4, "DONE"); 357 FINISHED (TRUE); 358 } 359 360 if (!strcmp (word, "MEMD")) { 361 MemoryDump (sock); 362 KiiSendCommand (sock, 4, "DONE"); 363 FINISHED (TRUE); 364 } 365 366 if (!strcmp (word, "MEML")) { 367 MemoryDumpLines (sock); 368 KiiSendCommand (sock, 4, "DONE"); 369 FINISHED (TRUE); 370 } 371 372 if (!strcmp (word, "MEMX")) { 373 MemoryDumpOnExit (sock); 374 KiiSendCommand (sock, 4, "DONE"); 375 FINISHED (TRUE); 376 } 377 354 378 fprintf (stderr, "unknown signal %s\n", word); 355 379 KiiSendCommand (sock, 4, "DONE"); -
trunk/Ohana/src/kapa2/src/DrawObjects.c
r40291 r41157 97 97 switch (object[0].style) { 98 98 case KAPA_PLOT_CONNECT: 99 // fprintf (stderr, "plot KAPA_PLOT_CONNECT: \n");100 99 DrawConnect (graphic, graph, object); 101 100 break; 101 case KAPA_PLOT_POLYGON: 102 DrawPolygon (graphic, graph, object); 103 break; 104 case KAPA_PLOT_POLYFILL: 105 DrawPolyfill (graphic, graph, object); 106 break; 102 107 case KAPA_PLOT_HISTOGRAM: 103 // fprintf (stderr, "plot KAPA_PLOT_HISTOGRAM:\n");104 108 DrawHistogram (graphic, graph, object); 105 109 break; 106 110 case KAPA_PLOT_BARS_SOLID: 107 // fprintf (stderr, "plot KAPA_PLOT_BARS_SOLID:\n");108 111 DrawBars (graphic, graph, object, KAPA_PLOT_BARS_SOLID); 109 112 break; 110 113 case KAPA_PLOT_BARS_OUTLINE: 111 // fprintf (stderr, "plot KAPA_PLOT_BARS_OUTLINE:\n");112 114 DrawBars (graphic, graph, object, KAPA_PLOT_BARS_OUTLINE); 113 115 break; 114 116 case KAPA_PLOT_BARS_OUTFILL: 115 // fprintf (stderr, "plot KAPA_PLOT_BARS_OUTFILL:\n");116 117 DrawBars (graphic, graph, object, KAPA_PLOT_BARS_OUTFILL); 117 118 break; 118 119 case KAPA_PLOT_POINTS: 119 120 default: 120 // fprintf (stderr, "plot KAPA_PLOT_POINTS:\n");121 121 DrawPoints (graphic, graph, object); 122 122 break; … … 172 172 sx0 = sx1; sy0 = sy1; 173 173 } 174 174 } 175 176 /******/ 177 void DrawPolygon (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 178 179 float *x, *y; 180 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by; 181 double sx0, sy0, sx1, sy1; 182 double X0, X1, Y0, Y1; 183 184 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); 185 mxj = graph[0].axis[1].dfx / (object[0].y1 - object[0].y0); 186 myi = graph[0].axis[0].dfy / (object[0].x1 - object[0].x0); 187 myj = graph[0].axis[1].dfy / (object[0].y1 - object[0].y0); 188 189 bxi = graph[0].axis[0].fx - object[0].x0*graph[0].axis[0].dfx/(object[0].x1 - object[0].x0); 190 bxj = -object[0].y0*graph[0].axis[1].dfx/(object[0].y1 - object[0].y0); 191 byi = -object[0].x0*graph[0].axis[0].dfy/(object[0].x1 - object[0].x0); 192 byj = graph[0].axis[1].fy - object[0].y0*graph[0].axis[1].dfy/(object[0].y1 - object[0].y0); 193 194 bx = bxi + bxj; 195 by = byi + byj; 196 197 X0 = graph[0].axis[0].fx; 198 X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 199 Y0 = graph[0].axis[1].fy; 200 Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 201 202 x = object[0].x; y = object[0].y; 203 204 // ptype must > 2 205 // Npts % ptype must be 0 206 // who must validate that? 207 208 // each polygon is made of (N = ptype) points 209 // we connect each point and the last one back 210 for (int i = 0; i < object[0].Npts; i += object[0].ptype) { 211 // first check for any invalid values for this polygon 212 int skipObject = FALSE; 213 for (int j = 0; (j < object[0].ptype) && !skipObject; j++) { 214 int k = i + j; 215 if (!(finite(x[k]) && finite(y[k]))) skipObject = TRUE; 216 } 217 if (skipObject) continue; 218 219 for (int j = 0; (j < object[0].ptype); j++) { 220 int k = i + j; 221 sx0 = x[k]*mxi + y[k]*mxj + bx + XCENTER; 222 sy0 = x[k]*myi + y[k]*myj + by + YCENTER; 223 224 // last point connects to first 225 if (j == object[0].ptype - 1) { 226 sx1 = x[i]*mxi + y[i]*mxj + bx + XCENTER; 227 sy1 = x[i]*myi + y[i]*myj + by + YCENTER; 228 } else { 229 sx1 = x[k+1]*mxi + y[k+1]*mxj + bx + XCENTER; 230 sy1 = x[k+1]*myi + y[k+1]*myj + by + YCENTER; 231 } 232 ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 233 } 234 } 235 } 236 237 /******/ 238 void DrawPolyfill (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 239 240 float *x, *y, *z; 241 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by; 242 double sx0, sy0; 243 // double X0, X1, Y0, Y1; 244 245 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); 246 mxj = graph[0].axis[1].dfx / (object[0].y1 - object[0].y0); 247 myi = graph[0].axis[0].dfy / (object[0].x1 - object[0].x0); 248 myj = graph[0].axis[1].dfy / (object[0].y1 - object[0].y0); 249 250 bxi = graph[0].axis[0].fx - object[0].x0*graph[0].axis[0].dfx/(object[0].x1 - object[0].x0); 251 bxj = -object[0].y0*graph[0].axis[1].dfx/(object[0].y1 - object[0].y0); 252 byi = -object[0].x0*graph[0].axis[0].dfy/(object[0].x1 - object[0].x0); 253 byj = graph[0].axis[1].fy - object[0].y0*graph[0].axis[1].dfy/(object[0].y1 - object[0].y0); 254 255 bx = bxi + bxj; 256 by = byi + byj; 257 258 /* 259 window boundary so we can clip objects 260 X0 = graph[0].axis[0].fx; 261 X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 262 Y0 = graph[0].axis[1].fy; 263 Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 264 */ 265 266 x = object[0].x; y = object[0].y; z = object[0].z; 267 268 // ptype must > 2 269 // Npts % ptype must be 0 270 // who must validate that? 271 272 ALLOCATE_PTR (points, XPoint, object[0].ptype); 273 274 // NOTE that LoadObject.c:45 limits the allow 275 // object styles which may have negative (scaled) colors 276 int scaleColor = (object[0].color < 0); 277 278 // each polygon is made of (N = ptype) points 279 // we connect each point and the last one back 280 for (int i = 0; i < object[0].Npts; i += object[0].ptype) { 281 // first check for any invalid values for this polygon 282 int skipObject = FALSE; 283 for (int j = 0; (j < object[0].ptype) && !skipObject; j++) { 284 int k = i + j; 285 if (!(finite(x[k]) && finite(y[k]))) skipObject = TRUE; 286 } 287 if (skipObject) continue; 288 289 for (int j = 0; (j < object[0].ptype); j++) { 290 int k = i + j; 291 sx0 = x[k]*mxi + y[k]*mxj + bx + XCENTER; 292 sy0 = x[k]*myi + y[k]*myj + by + YCENTER; 293 294 points[j].x = sx0; 295 points[j].y = sy0; 296 } 297 298 if (scaleColor) { 299 if (!finite(z[i])) continue; 300 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 301 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 302 } 303 XFillPolygon (graphic->display, graphic->window, graphic->gc, points, object[0].ptype, Convex, CoordModeOrigin); 304 } 305 306 free (points); 175 307 } 176 308 … … 580 712 int scaleColor = (object[0].color < 0); 581 713 714 // NOTE that LoadObject.c:45 limits the allow 715 // object styles which may have negative (scaled) colors 716 582 717 ds = 0.5 * (graphic->dx + graphic->dy) * 0.003 * object[0].size; 583 718 dz = 0.5 * (graphic->dx + graphic->dy) * 0.010; … … 916 1051 // for open circles, only go to the outer radius 917 1052 D = 0; 918 if (object[0].ptype == 7) { D = scaleSize ? dz*z[i] : ds; }919 if (object[0].ptype == 1) { D = scaleSize ? dz*z[i] : ds; }920 if (object[0].ptype == 5) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; }921 if (object[0].ptype == 15) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; }1053 if (object[0].ptype == KAPA_POINT_CIRCLE_OPEN ) { D = scaleSize ? dz*z[i] : ds; } 1054 if (object[0].ptype == KAPA_POINT_BOX_OPEN ) { D = scaleSize ? dz*z[i] : ds; } 1055 if (object[0].ptype == KAPA_POINT_TRIANGLE_OPEN ) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; } 1056 if (object[0].ptype == KAPA_POINT_TRIANGLE_OPEN_DOWN) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; } 922 1057 if (!(finite(x[i]) && finite(y[i]) && finite(dxp[i]))) goto skip_dxp; 923 1058 if (D > fabs(dxp[i]*mxi)) goto skip_dxp; … … 999 1134 // for open circles, only go to the outer radius 1000 1135 D = 0; 1001 if (object[0].ptype == 7) { D = scaleSize ? dz*z[i] : ds; }1002 if (object[0].ptype == 1) { D = scaleSize ? dz*z[i] : ds; }1003 if (object[0].ptype == 5) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; }1004 if (object[0].ptype == 15) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; }1136 if (object[0].ptype == KAPA_POINT_CIRCLE_OPEN ) { D = scaleSize ? dz*z[i] : ds; } 1137 if (object[0].ptype == KAPA_POINT_BOX_OPEN ) { D = scaleSize ? dz*z[i] : ds; } 1138 if (object[0].ptype == KAPA_POINT_TRIANGLE_OPEN ) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; } 1139 if (object[0].ptype == KAPA_POINT_TRIANGLE_OPEN_DOWN) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; } 1005 1140 if (!(finite(x[i]) && finite(y[i]) && finite(dyp[i]))) goto skip_dyp; 1006 1141 if (D > fabs(dyp[i]*myj)) goto skip_dyp; … … 1023 1158 skip_dyp: 1024 1159 if (!(finite(x[i]) && finite(y[i]) && finite(dym[i]))) continue; 1025 if (object[0].ptype == 5) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; }1026 if (object[0].ptype == 15) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; }1160 if (object[0].ptype == KAPA_POINT_TRIANGLE_OPEN ) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; } 1161 if (object[0].ptype == KAPA_POINT_TRIANGLE_OPEN_DOWN) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; } 1027 1162 if (D > fabs(dym[i]*myj)) continue; 1028 1163 sx0 = x[i]*mxi + y[i]*mxj + bx + XCENTER; -
trunk/Ohana/src/kapa2/src/Image.c
r39457 r41157 148 148 void DrawImage (KapaImageWidget *image) { 149 149 150 Graphic *graphic; 151 152 if (image == NULL) return; 153 154 graphic = GetGraphic (); 155 156 if (image[0].picture.pix) { 157 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, 158 image[0].picture.pix, 0, 0, 159 image[0].picture.x + 1, image[0].picture.y + 1, 160 image[0].picture.dx, image[0].picture.dy); 161 } 162 } 163 164 // add the zoom, pan, crosshairs, status box, buttons 165 void DrawImageTool (KapaImageWidget *image) { 166 150 167 int i; 151 168 Graphic *graphic; … … 160 177 image[0].picture.dx+1, image[0].picture.dy+1); 161 178 162 if (image[0].picture.pix) {163 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc,164 image[0].picture.pix, 0, 0,165 image[0].picture.x + 1, image[0].picture.y + 1,166 image[0].picture.dx, image[0].picture.dy);167 }168 169 for (i = 0; i < NOVERLAYS; i++) {170 if (image[0].overlay[i].active) {171 PaintOverlay (graphic, image, i);172 }173 }174 175 179 if (image[0].location) { 176 180 if (image[0].cmapbar.pix) { … … 211 215 StatusBox (graphic, image); 212 216 } 213 214 FlushDisplay ();215 217 } 216 218 -
trunk/Ohana/src/kapa2/src/InterpretKeys.c
r38465 r41157 160 160 break; 161 161 162 case XK_plus: 163 case XK_equal: 162 164 case XK_KP_Add: 163 165 if (modstate & ControlMask) { … … 171 173 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 172 174 break; 175 176 case XK_minus: 177 case XK_underscore: 173 178 case XK_KP_Subtract: 174 179 if (modstate & ControlMask) { -
trunk/Ohana/src/kapa2/src/JPEGit24.c
r34088 r41157 212 212 } 213 213 bDrawBufferFree (buffer); 214 free (palette); 214 215 } 215 216 -
trunk/Ohana/src/kapa2/src/Layout.c
r35237 r41157 45 45 AddSection ("default", 0.0, 0.0, 1.0, 1.0, -1); 46 46 } 47 48 void FreeLayout (void) { 49 FreeSections (); 50 FreeRotFonts (); 51 } -
trunk/Ohana/src/kapa2/src/LoadFrame.c
r38986 r41157 93 93 SetSectionSizes (section); 94 94 Refresh(); 95 // if (USE_XWINDOW) DrawFrame (graph);96 // FlushDisplay ();97 98 /* XXX why did I do this??? */99 # if (0)100 status = TRUE;101 if (status) {102 for (i = 0; i < Nsection; i++) {103 PositionPicture (§ion[i]);104 }105 if (USE_XWINDOW) XClearWindow (graphic.display, graphic.window);106 Refresh ();107 } else {108 FlushDisplay ();109 }110 # endif111 95 112 96 return (TRUE); -
trunk/Ohana/src/kapa2/src/LoadLabels.c
r39577 r41157 26 26 label[Nbytes] = 0; 27 27 28 FREE (label); 29 28 30 c = GetRotFont (&size); 29 31 -
trunk/Ohana/src/kapa2/src/LoadObject.c
r40570 r41157 42 42 graph[0].objects[N].color = KapaColormapSize() - 1; 43 43 } 44 if ((graph[0].objects[N].style != KAPA_PLOT_POINTS) && (graph[0].objects[N].color < 0)) { 44 45 // XXX watch out for this restriction in DrawObjects / bDrawObjects 46 int canScaleColor = FALSE; 47 canScaleColor |= (graph[0].objects[N].style == KAPA_PLOT_POINTS); 48 canScaleColor |= (graph[0].objects[N].style == KAPA_PLOT_POLYFILL); 49 50 if (!canScaleColor && (graph[0].objects[N].color < 0)) { 45 51 graph[0].objects[N].color = 0; 46 52 } … … 103 109 104 110 if (USE_XWINDOW) { 105 Graphic *graphic = GetGraphic(); 106 DrawObjectN (graphic, graph, &graph[0].objects[graph[0].Nobjects-1]); 107 } 108 FlushDisplay (); 111 if (0) { 112 // use this if we are not using buffered plotting 113 Graphic *graphic = GetGraphic(); 114 DrawObjectN (graphic, graph, &graph[0].objects[graph[0].Nobjects-1]); 115 FlushDisplay (); 116 } else { 117 Refresh (); 118 } 119 } 109 120 110 121 return (TRUE); -
trunk/Ohana/src/kapa2/src/PNGit.c
r39457 r41157 98 98 png_write_info (png_ptr, info_ptr); 99 99 100 if (graphic->smooth_sigma == 0.0) { 101 fprintf (stderr, "making PNG without antialias smoothing\n"); 102 fprintf (stderr, "use 'antialias (value)' to set smoothing scale (0.4 - 0.7 recommended)\n"); 103 } 104 100 105 if (haveImage) { 101 106 buffer = bDrawIt (palette, Npalette, 3); … … 109 114 110 115 bDrawBufferFree (buffer); 116 free (palette); 117 111 118 fclose (f); 112 119 return (TRUE); -
trunk/Ohana/src/kapa2/src/PPMit.c
r29938 r41157 46 46 47 47 bDrawBufferFree (buffer); 48 free (palette); 49 48 50 return (TRUE); 49 51 } -
trunk/Ohana/src/kapa2/src/Refresh.c
r36833 r41157 1 1 # include "Ximage.h" 2 2 3 # define USE_BUFFERED_DRAW 1 4 5 void bDrawXimage (bDrawBuffer *buffer); 6 void Refresh_Buffered (void); 7 void Refresh_Unbuffered (void); 8 3 9 void Refresh (void) { 10 if (USE_BUFFERED_DRAW) { 11 Refresh_Buffered(); 12 } else { 13 Refresh_Unbuffered(); 14 } 15 } 16 17 void Refresh_Buffered (void) { 18 19 int Npalette; 20 Graphic *graphic; 21 22 if (!USE_XWINDOW) return; 23 // if (HAVE_BACKING) return; 24 25 graphic = GetGraphic(); 26 27 // limit the png window to the min needed to contain the active graphic regions 28 SectionMinBoundary (graphic); 29 30 // is the palette reasonable in modern context? 31 png_color *palette = KapaPNGPalette (&Npalette); 32 33 bDrawBuffer *buffer = bDrawIt (palette, Npalette, 3); 34 35 /* XClearWindow (graphic.display, graphic.window); */ 36 XSetForeground (graphic->display, graphic->gc, graphic->back); 37 XFillRectangle (graphic->display, graphic->window, graphic->gc, 0, 0, graphic->dx, graphic->dy); 38 XSetForeground (graphic->display, graphic->gc, graphic->fore); 39 40 // copy buffer to Xwindow as image? 41 bDrawXimage (buffer); 42 bDrawBufferFree (buffer); 43 free (palette); 44 45 // draw image tool for all sections 46 int Nsection = GetNumberOfSections (); 47 for (int i = 0; i < Nsection; i++) { 48 Section *section = GetSectionByNumber (i); 49 50 KapaImageWidget *image = section->image; 51 DrawImageTool (image); 52 53 /*** PaintOverlay is called in DrawImage *** 54 if (!image) continue; 55 for (int j = 0; j < NOVERLAYS; j++) { 56 if (image[0].overlay[j].active) { 57 PaintOverlay (graphic, image, j); 58 } 59 } 60 */ 61 } 62 63 FlushDisplay (); 64 } 65 66 void Refresh_Unbuffered (void) { 4 67 5 68 int i, Nsection; … … 20 83 Nsection = GetNumberOfSections (); 21 84 for (i = 0; i < Nsection; i++) { 22 section = GetSectionByNumber (i); 23 DrawSectionBG (graphic, section); 24 DrawImage (section->image); 25 DrawGraph (section->graph); 85 section = GetSectionByNumber (i); 86 DrawSectionBG (graphic, section); 87 88 KapaImageWidget *image = section->image; 89 DrawImage (image); 90 DrawImageTool (image); 91 92 /*** the overlay is added in DrawImage ***/ 93 if (image) { 94 for (int j = 0; j < NOVERLAYS; j++) { 95 if (image[0].overlay[j].active) { 96 PaintOverlay (graphic, image, j); 97 } 98 } 99 } 100 101 DrawGraph (section->graph); 26 102 } 27 103 -
trunk/Ohana/src/kapa2/src/SetColormap.c
r40627 r41157 72 72 } 73 73 } 74 fprintf (stderr, "ruff Npix: %d vs %d\n", i, graphic[0].Npixels);74 // fprintf (stderr, "ruff Npix: %d vs %d\n", i, graphic[0].Npixels); 75 75 76 76 // all other modes are 1D: set the flag: … … 217 217 !strncmp (graphic->colormapName, "lgcy:", 5) || 218 218 !strncmp (graphic->colormapName, "cetf:", 5) || 219 !strncmp (graphic->colormapName, "cetr:", 5) || 219 220 !strncmp (graphic->colormapName, "csvf:", 5)) { 220 221 … … 233 234 int isCSV = !strncmp (graphic->colormapName, "csvf:", 5); 234 235 int isCET = !strncmp (graphic->colormapName, "cetf:", 5); 236 int isCETRev = !strncmp (graphic->colormapName, "cetr:", 5); 235 237 int isLegacy = !strncmp (graphic->colormapName, "lgcy:", 5); 236 238 237 239 float fracIndex, fracRed, fracBlue, fracGreen; 238 240 239 if (isCET ) fracIndex = 0.0;241 if (isCET || isCETRev) fracIndex = 0.0; 240 242 241 243 while (scan_line_maxlen (f, line, 1024) != EOF) { … … 247 249 if (Nscan != 4) continue; 248 250 } 249 if (isCET ) {251 if (isCET || isCETRev) { 250 252 Nscan = sscanf (line, "%f,%f,%f", &fracRed, &fracGreen, &fracBlue); 251 253 fracIndex += 1.0 / 256.0; … … 256 258 if (Nscan != 4) continue; 257 259 } 258 if (!isCSV && !isLegacy && !isCET ) {260 if (!isCSV && !isLegacy && !isCET && !isCETRev) { 259 261 Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracGreen, &fracBlue); 260 262 if (Nscan != 4) continue; … … 299 301 } 300 302 } 303 304 // reverse the color sequence: 305 if (isCETRev) { 306 for (i = 0; i < MaxValue / 2; i++) { 307 unsigned short tmp; 308 // fprintf (stderr, "swap: %d %d\n", graphic[0].cmap[i].red, graphic[0].cmap[MaxValue - 1 - i].red); 309 tmp = graphic[0].cmap[i].red; graphic[0].cmap[i].red = graphic[0].cmap[MaxValue - 1 - i].red; graphic[0].cmap[MaxValue - 1 - i].red = tmp; 310 tmp = graphic[0].cmap[i].blue; graphic[0].cmap[i].blue = graphic[0].cmap[MaxValue - 1 - i].blue; graphic[0].cmap[MaxValue - 1 - i].blue = tmp; 311 tmp = graphic[0].cmap[i].green; graphic[0].cmap[i].green = graphic[0].cmap[MaxValue - 1 - i].green; graphic[0].cmap[MaxValue - 1 - i].green = tmp; 312 } 313 } 314 301 315 goto store_colors; 302 316 } -
trunk/Ohana/src/kapa2/src/SetUpGraphic.c
r39532 r41157 32 32 graphic->pixels = NULL; 33 33 34 graphic->smooth_sigma = 0.0; 35 34 36 if (!USE_XWINDOW) { 35 37 ALLOCATE (graphic[0].pixels, unsigned long, NPIXELS_STATIC); … … 50 52 CheckVisual (graphic, argc, argv); 51 53 CheckColors (graphic, argc, argv); 52 53 54 54 55 icon.width = icon_width; … … 84 85 } 85 86 87 int SetSmoothSigma (int sock) { 88 89 float sigma; 90 KiiScanMessage (sock, "%f", &sigma); 91 92 if (isfinite(sigma)) { 93 if ((sigma <= 1.1) && (sigma >= 0.0)) { 94 graphic->smooth_sigma = sigma; 95 } 96 } 97 return TRUE; 98 } 99 100 void FreeGraphic () { 101 free (graphic->pixels); 102 free (graphic->cmap); 103 free (graphic->color); 104 free (graphic->colormapName); 105 free (graphic); 106 } -
trunk/Ohana/src/kapa2/src/args.c
r39225 r41157 23 23 NAME_WINDOW = strcreate (argv[N]); 24 24 remove_argument(N, argc, argv); 25 } 26 27 if ((N = get_argument (*argc, argv, "-memdump"))) { 28 remove_argument(N, argc, argv); 29 MemoryDumpSetOnExit (TRUE); 25 30 } 26 31 -
trunk/Ohana/src/kapa2/src/bDrawImage.c
r34088 r41157 1 1 # include "Ximage.h" 2 3 // XXX for the moment, this function does NOT set the mask bits. 4 // since we lay graphics on top of images, this is OK for now 2 5 3 6 # define WHITE_R 255 … … 54 57 55 58 // the created buffer is supposed to contain the output windows 59 if (Xs < 0) { 60 fprintf (stderr, "image display boundaries out of range of window (invalid condition) : fix Kapa\n"); 61 abort(); 62 } 56 63 if (buffer[0].Nx < Xs + dx) { 57 fprintf (stderr, "invalid condition\n"); 64 fprintf (stderr, "image display boundaries out of range of window (invalid condition) : fix Kapa\n"); 65 abort(); 66 } 67 if (Ys < 0) { 68 fprintf (stderr, "image display boundaries out of range of window (invalid condition) : fix Kapa\n"); 58 69 abort(); 59 70 } 60 71 if (buffer[0].Ny < Ys + dy) { 61 fprintf (stderr, "i nvalid condition\n");72 fprintf (stderr, "image display boundaries out of range of window (invalid condition) : fix Kapa\n"); 62 73 abort(); 63 74 } … … 153 164 154 165 return (TRUE); 166 } 167 168 void bDrawXimage (bDrawBuffer *buffer) { 169 170 Graphic *graphic = GetGraphic (); 171 172 ALLOCATE_PTR (data, char, 4*buffer->Nx*buffer->Ny); 173 174 for (int iy = 0; iy < buffer->Ny; iy++) { 175 for (int ix = 0; ix < buffer->Nx; ix++) { 176 data[4*(iy*buffer->Nx + ix) + 0] = buffer->pixels[iy][3*ix + 2]; 177 data[4*(iy*buffer->Nx + ix) + 1] = buffer->pixels[iy][3*ix + 1]; 178 data[4*(iy*buffer->Nx + ix) + 2] = buffer->pixels[iy][3*ix + 0]; 179 data[4*(iy*buffer->Nx + ix) + 3] = 0; 180 } 181 } 182 183 XImage *pix = XCreateImage (graphic[0].display, graphic[0].visual, graphic[0].depth, ZPixmap, 0, 184 data, buffer->Nx, buffer->Ny, 32, 0); 185 186 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, pix, 0, 0, 1, 1, buffer->Nx, buffer->Ny); 187 188 free (data); 155 189 } 156 190 … … 186 220 } 187 221 bDrawBufferFree (buffer); 222 free (palette); 188 223 } 189 224 -
trunk/Ohana/src/kapa2/src/bDrawIt.c
r40558 r41157 3 3 bDrawBuffer *bDrawIt (png_color *palette, int Npalette, int Nbyte) { 4 4 5 int i, j, Nsection; 6 bDrawBuffer *buffer; 7 bDrawColor black; 8 Graphic *graphic; 9 Section *section; 5 Graphic *graphic = GetGraphic(); 6 bDrawColor black = KapaColorByName ("black"); 10 7 11 graphic = GetGraphic(); 8 // get the number of sections 9 int Nsection = GetNumberOfSections (); 12 10 13 black = KapaColorByName ("black"); 11 // in order to allow the anti-aliasing to affect the text & graphs but not the images 12 // I need to generate the images in one buffer and the graphs in a second buffer 13 // then merge the two buffers. 14 14 15 // if we want to trim, we'll need to carry about the start in graphic coords and 16 // the dx,dy size. 17 buffer = bDrawBufferCreate (graphic->dxwin, graphic->dywin, Nbyte, palette, Npalette); 18 bDrawSetStyle (buffer, black, 0, 0, 1.0); 15 // base will hold the images 16 bDrawBuffer *base = bDrawBufferCreate (graphic->dxwin, graphic->dywin, Nbyte, palette, Npalette); 17 bDrawSetStyle (base, black, 0, 0, 1.0); 19 18 20 // reset the sizes for all sections 21 Nsection = GetNumberOfSections (); 22 for (i = 0; i < Nsection; i++) { 23 section = GetSectionByNumber (i); 24 bDrawImage (buffer, section->image, graphic); 25 for (j = 0; section->image && (j < NOVERLAYS); j++) { 26 if (section->image->overlay[j].active) bDrawOverlay (buffer, section->image, j); 27 } 28 bDrawGraph (buffer, section->graph); 19 for (int i = 0; i < Nsection; i++) { 20 Section *section = GetSectionByNumber (i); 21 bDrawImage (base, section->image, graphic); 29 22 } 30 23 31 return (buffer); 24 // graph will hold the graphic overlay 25 bDrawBuffer *graph = bDrawBufferCreate (graphic->dxwin, graphic->dywin, Nbyte, palette, Npalette); 26 bDrawSetStyle (graph, black, 0, 0, 1.0); 27 28 for (int i = 0; i < Nsection; i++) { 29 Section *section = GetSectionByNumber (i); 30 for (int j = 0; section->image && (j < NOVERLAYS); j++) { 31 if (section->image->overlay[j].active) bDrawOverlay (graph, section->image, j); 32 } 33 bDrawGraph (graph, section->graph); 34 } 35 36 // apply anti-aliasing only to the graph 37 if (graphic->smooth_sigma > 0.0) { 38 // anything > 1.1 blurs the image too much 39 graphic->smooth_sigma = MIN (graphic->smooth_sigma, 1.1); 40 bDrawSmooth (graph, graphic->smooth_sigma); 41 } 42 43 // place graph on base 44 bDrawMerge (base, graph); 45 bDrawBufferFree (graph); 46 47 return (base); 32 48 } 33 49 -
trunk/Ohana/src/kapa2/src/bDrawObjects.c
r40570 r41157 9 9 # define OpenTriangle(BUF,X1,Y1,X2,Y2,X3,Y3) (bDrawTriOpen (BUF, (X1), (Y1), (X2), (Y2), (X3), (Y3))) 10 10 11 // I should not have a local static variable for this: 12 // I should just pass the graphic structure to the called functions below 11 13 static Graphic *graphic; 12 14 … … 35 37 case KAPA_PLOT_CONNECT: 36 38 bDrawConnect (buffer, graph, object); 39 break; 40 case KAPA_PLOT_POLYGON: 41 bDrawPolygons (buffer, graph, object); 42 break; 43 case KAPA_PLOT_POLYFILL: 44 bDrawFillPolygons (buffer, graph, object); 37 45 break; 38 46 case KAPA_PLOT_HISTOGRAM: … … 103 111 sx0 = sx1; sy0 = sy1; 104 112 } 113 } 114 115 void bDrawPolygons (bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object) { 116 117 float *x, *y; 118 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by; 119 double sx0, sy0, sx1, sy1; 120 double X0, X1, Y0, Y1; 121 122 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); 123 mxj = graph[0].axis[1].dfx / (object[0].y1 - object[0].y0); 124 myi = graph[0].axis[0].dfy / (object[0].x1 - object[0].x0); 125 myj = graph[0].axis[1].dfy / (object[0].y1 - object[0].y0); 126 127 bxi = graph[0].axis[0].fx - object[0].x0*graph[0].axis[0].dfx/(object[0].x1 - object[0].x0); 128 bxj = -object[0].y0*graph[0].axis[1].dfx/(object[0].y1 - object[0].y0); 129 byi = -object[0].x0*graph[0].axis[0].dfy/(object[0].x1 - object[0].x0); 130 byj = graph[0].axis[1].fy - object[0].y0*graph[0].axis[1].dfy/(object[0].y1 - object[0].y0); 131 132 bx = bxi + bxj; 133 by = byi + byj; 134 135 X0 = graph[0].axis[0].fx; 136 X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 137 Y0 = graph[0].axis[1].fy; 138 Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 139 140 x = object[0].x; y = object[0].y; 141 142 // ptype must > 2 143 // Npts % ptype must be 0 144 // who must validate that? 145 146 // each polygon is made of (N = ptype) points 147 // we connect each point and the last one back 148 for (int i = 0; i < object[0].Npts; i += object[0].ptype) { 149 // first check for any invalid values for this polygon 150 int skipObject = FALSE; 151 for (int j = 0; (j < object[0].ptype) && !skipObject; j++) { 152 int k = i + j; 153 if (!(finite(x[k]) && finite(y[k]))) skipObject = TRUE; 154 } 155 if (skipObject) continue; 156 157 for (int j = 0; (j < object[0].ptype); j++) { 158 int k = i + j; 159 sx0 = x[k]*mxi + y[k]*mxj + bx; 160 sy0 = x[k]*myi + y[k]*myj + by; 161 162 // last point connects to first 163 if (j == object[0].ptype - 1) { 164 sx1 = x[i]*mxi + y[i]*mxj + bx; 165 sy1 = x[i]*myi + y[i]*myj + by; 166 } else { 167 sx1 = x[k+1]*mxi + y[k+1]*mxj + bx; 168 sy1 = x[k+1]*myi + y[k+1]*myj + by; 169 } 170 bDrawClipLine (buffer, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 171 } 172 } 173 } 174 175 void bDrawFillPolygons (bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object) { 176 177 float *x, *y; 178 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by; 179 double sx0, sy0; 180 // double X0, X1, Y0, Y1; 181 182 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); 183 mxj = graph[0].axis[1].dfx / (object[0].y1 - object[0].y0); 184 myi = graph[0].axis[0].dfy / (object[0].x1 - object[0].x0); 185 myj = graph[0].axis[1].dfy / (object[0].y1 - object[0].y0); 186 187 bxi = graph[0].axis[0].fx - object[0].x0*graph[0].axis[0].dfx/(object[0].x1 - object[0].x0); 188 bxj = -object[0].y0*graph[0].axis[1].dfx/(object[0].y1 - object[0].y0); 189 byi = -object[0].x0*graph[0].axis[0].dfy/(object[0].x1 - object[0].x0); 190 byj = graph[0].axis[1].fy - object[0].y0*graph[0].axis[1].dfy/(object[0].y1 - object[0].y0); 191 192 bx = bxi + bxj; 193 by = byi + byj; 194 195 /* 196 window boundary so we can clip objects 197 X0 = graph[0].axis[0].fx; 198 X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 199 Y0 = graph[0].axis[1].fy; 200 Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 201 */ 202 203 x = object[0].x; y = object[0].y; 204 205 // ptype must > 2 206 // Npts % ptype must be 0 207 // who must validate that? 208 209 ALLOCATE_PTR (xpts, double, object[0].ptype); 210 ALLOCATE_PTR (ypts, double, object[0].ptype); 211 212 int scaleColor = (object[0].color < 0); 213 unsigned char *pixel1, *pixel2, *pixel3; 214 float *z = object[0].z; 215 216 if (scaleColor) { 217 // scaled colors use the colormap defined for the graphic 218 ALLOCATE (pixel1, unsigned char, graphic[0].Npixels); 219 ALLOCATE (pixel2, unsigned char, graphic[0].Npixels); 220 ALLOCATE (pixel3, unsigned char, graphic[0].Npixels); 221 222 /** cmap[i].pixel must be defined even if X is not used **/ 223 for (int i = 0; i < graphic[0].Npixels; i++) { /* set up pixel array */ 224 pixel1[i] = graphic[0].cmap[i].red >> 8; 225 pixel2[i] = graphic[0].cmap[i].green >> 8; 226 pixel3[i] = graphic[0].cmap[i].blue >> 8; 227 } 228 229 } 230 231 // each polygon is made of (N = ptype) points 232 // we connect each point and the last one back 233 for (int i = 0; i < object[0].Npts; i += object[0].ptype) { 234 // first check for any invalid values for this polygon 235 int skipObject = FALSE; 236 for (int j = 0; (j < object[0].ptype) && !skipObject; j++) { 237 int k = i + j; 238 if (!(finite(x[k]) && finite(y[k]))) skipObject = TRUE; 239 } 240 if (skipObject) continue; 241 242 for (int j = 0; (j < object[0].ptype); j++) { 243 int k = i + j; 244 sx0 = x[k]*mxi + y[k]*mxj + bx; 245 sy0 = x[k]*myi + y[k]*myj + by; 246 247 xpts[j] = sx0; 248 ypts[j] = sy0; 249 } 250 251 if (scaleColor) { 252 if (!finite(z[i])) continue; 253 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 254 buffer->bColor_R = pixel1[pixel]; 255 buffer->bColor_G = pixel2[pixel]; 256 buffer->bColor_B = pixel3[pixel]; 257 } 258 bDrawPolyFill (buffer, xpts, ypts, object[0].ptype); 259 } 260 free (xpts); 261 free (ypts); 105 262 } 106 263 … … 886 1043 // for open circles, only go to the outer radius 887 1044 D = 0; 888 if (object[0].ptype == 7) { D = scaleSize ? dz*z[i] : ds; }889 if (object[0].ptype == 1) { D = scaleSize ? dz*z[i] : ds; }890 if (object[0].ptype == 5) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; }891 if (object[0].ptype == 15) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; }1045 if (object[0].ptype == KAPA_POINT_CIRCLE_OPEN ) { D = scaleSize ? dz*z[i] : ds; } 1046 if (object[0].ptype == KAPA_POINT_BOX_OPEN ) { D = scaleSize ? dz*z[i] : ds; } 1047 if (object[0].ptype == KAPA_POINT_TRIANGLE_OPEN ) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; } 1048 if (object[0].ptype == KAPA_POINT_TRIANGLE_OPEN_DOWN) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; } 892 1049 if (!(finite(x[i]) && finite(y[i]) && finite(dxp[i]))) goto skip_dxp; 893 1050 if (D > fabs(dxp[i]*mxi)) goto skip_dxp; … … 969 1126 // for open circles, only go to the outer radius 970 1127 D = 0; 971 if (object[0].ptype == 7) { D = scaleSize ? dz*z[i] : ds; }972 if (object[0].ptype == 1) { D = scaleSize ? dz*z[i] : ds; }973 if (object[0].ptype == 5) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; }974 if (object[0].ptype == 15) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; }1128 if (object[0].ptype == KAPA_POINT_CIRCLE_OPEN ) { D = scaleSize ? dz*z[i] : ds; } 1129 if (object[0].ptype == KAPA_POINT_BOX_OPEN ) { D = scaleSize ? dz*z[i] : ds; } 1130 if (object[0].ptype == KAPA_POINT_TRIANGLE_OPEN ) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; } 1131 if (object[0].ptype == KAPA_POINT_TRIANGLE_OPEN_DOWN) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; } 975 1132 if (!(finite(x[i]) && finite(y[i]) && finite(dyp[i]))) goto skip_dyp; 976 1133 if (D > fabs(dyp[i]*myj)) goto skip_dyp; … … 993 1150 skip_dyp: 994 1151 if (!(finite(x[i]) && finite(y[i]) && finite(dym[i]))) continue; 995 if (object[0].ptype == 5) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; }996 if (object[0].ptype == 15) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; }1152 if (object[0].ptype == KAPA_POINT_TRIANGLE_OPEN ) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; } 1153 if (object[0].ptype == KAPA_POINT_TRIANGLE_OPEN_DOWN) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; } 997 1154 if (D > fabs(dym[i]*myj)) continue; 998 1155 sx0 = x[i]*mxi + y[i]*mxj + bx; -
trunk/Ohana/src/kapa2/src/bDrawOverlay.c
r40558 r41157 24 24 } 25 25 26 Xmin = 0; 27 Ymin = 0; 28 Xmax = image[0].picture.dx; 29 Ymax = image[0].picture.dy; 26 // Xmin = 0; 27 // Ymin = 0; 28 // Xmax = image[0].picture.dx; 29 // Ymax = image[0].picture.dy; 30 31 Xmin = image[0].picture.x; 32 Ymin = image[0].picture.y; 33 Xmax = image[0].picture.x + image[0].picture.dx; // maybe this should be just dx? 34 Ymax = image[0].picture.y + image[0].picture.dy; 30 35 31 36 if (N == INFRONT) { … … 35 40 36 41 for (i = 0; i < image[0].overlay[N].Nobjects; i++) { 37 Image_to_Picture (&X, &Y, image[0].overlay[N].objects[i].x, image[0].overlay[N].objects[i].y, &image[0].picture); 42 // XXX the 0.5,0.5 offset is apparently needed here. 43 // work on rationalizing these functions in the context of their different plotting types 44 Image_to_Screen (&X, &Y, image[0].overlay[N].objects[i].x - 0.5, image[0].overlay[N].objects[i].y - 0.5, &image[0].picture); 38 45 dX = image[0].overlay[N].objects[i].dx * expand; 39 46 dY = image[0].overlay[N].objects[i].dy * expand; -
trunk/Ohana/src/kapa2/src/kapa.c
r13479 r41157 11 11 12 12 CloseDisplay (); 13 exit (0); 13 14 // free things 15 FreeLayout(); 16 FreeGraphic(); 17 FREE (NAME_WINDOW); 18 19 MemoryDumpAndExit (); 14 20 }
Note:
See TracChangeset
for help on using the changeset viewer.
