00001
00002
00003
00004
00005
00006 #include "win.h"
00007
00008 #define MAXDRAWSIZE 8000
00009
00010
00011 extern GC redrawgc, defaultgc;
00012 extern lux_wins *get_currentwin();
00013 extern lux_data *get_newdata();
00014 extern long XMAXREQUESTSIZE;
00015 static XSegment segs[MAXDRAWSIZE];
00016
00017
00018
00019 lux_convert_coordsshort(win,fx,fy,x,y,n)
00020 Window win;
00021 float *fx,*fy;
00022 short *x, *y;
00023 unsigned int n;
00024 {
00025 register unsigned i;
00026 register lux_wins *current;
00027 float logxmin, logxmax, logymin, logymax;
00028
00029 current = get_currentwin(win);
00030
00031 if (current->win.lnx != 0) {
00032 logxmin = log10(current->win.xmin);
00033 logxmax = log10(current->win.xmax);
00034 }
00035 if (current->win.lny != 0) {
00036 logymin = log10(current->win.ymin);
00037 logymax = log10(current->win.ymax);
00038 }
00039
00040 if (fx == fy)
00041 for(i=0;i<2*n;i+=2) {
00042 if ( current->win.lnx == 0)
00043 x[i] = (short)(((fx[i] - current->win.xmin)*current->win.xfactor +
00044 current->win.xorg)*current->win.xresizefactor + 0.5);
00045 else
00046 x[i] = (short)(((log10(fx[i]) - logxmin)*current->win.xfactor +
00047 current->win.xorg)*current->win.xresizefactor + 0.5);
00048 if ( current->win.lny == 0)
00049 y[i+1] = (short)((current->win.ysize - (fy[i+1]-current->win.ymin)*
00050 current->win.yfactor + current->win.yorg)*
00051 current->win.yresizefactor + 0.5);
00052 else
00053 y[i+1] = (short)((current->win.ysize - (log10(fy[i+1])-logymin)*
00054 current->win.yfactor + current->win.yorg)*
00055 current->win.yresizefactor + 0.5);
00056 }
00057 else if (x == y)
00058 for(i=0;i<n;i++) {
00059 if ( current->win.lnx == 0)
00060 x[i*2] = (short)(((fx[i] - current->win.xmin)*current->win.xfactor +
00061 current->win.xorg)*current->win.xresizefactor + 0.5);
00062 else
00063 x[i*2] = (short)(((log10(fx[i]) - logxmin)*current->win.xfactor +
00064 current->win.xorg)*current->win.xresizefactor + 0.5);
00065 if ( current->win.lny == 0)
00066 x[i*2+1] = (short)((current->win.ysize - (fy[i]-current->win.ymin)*
00067 current->win.yfactor + current->win.yorg)*
00068 current->win.yresizefactor + 0.5);
00069 else
00070 x[i*2+1] = (short)((current->win.ysize - (log10(fy[i])-logymin)*
00071 current->win.yfactor + current->win.yorg)*
00072 current->win.yresizefactor + 0.5);
00073
00074 }
00075 else
00076 for(i=0;i<n;i++) {
00077 if ( current->win.lnx == 0)
00078 x[i] = (short)(((fx[i]-current->win.xmin)*current->win.xfactor+
00079 current->win.xorg)*current->win.xresizefactor+0.5);
00080 else
00081 x[i] = (short)(((log10(fx[i])-logxmin)*current->win.xfactor+
00082 current->win.xorg)*current->win.xresizefactor+0.5);
00083 if ( current->win.lny == 0)
00084 y[i] = (short)((current->win.ysize-(fy[i]-current->win.ymin)*
00085 current->win.yfactor+current->win.yorg)*
00086 current->win.yresizefactor+0.5);
00087 else
00088 y[i] = (short)((current->win.ysize-(log10(fy[i])-logymin)*
00089 current->win.yfactor+current->win.yorg)*
00090 current->win.yresizefactor+0.5);
00091 }
00092
00093 }
00094
00095 lux_convert_coordshort(win,fx,fy,x,y)
00096 Window win;
00097 float fx,fy;
00098 short *x, *y;
00099 {
00100 register lux_wins *current;
00101 float logxmin, logxmax, logymin, logymax;
00102
00103 current = get_currentwin(win);
00104
00105 if (current->win.lnx != 0) {
00106 logxmin = log10(current->win.xmin);
00107 logxmax = log10(current->win.xmax);
00108 }
00109 if (current->win.lny != 0) {
00110 logymin = log10(current->win.ymin);
00111 logymax = log10(current->win.ymax);
00112 }
00113
00114 if ( current->win.lnx == 0)
00115 *x = (short)(((fx-current->win.xmin)*current->win.xfactor+
00116 current->win.xorg)*current->win.xresizefactor+0.5);
00117 else
00118 *x = (short)(((log10(fx)-logxmin)*current->win.xfactor+
00119 current->win.xorg)*current->win.xresizefactor+0.5);
00120 if ( current->win.lny == 0)
00121 *y = (short)((current->win.ysize-(fy-current->win.ymin)*
00122 current->win.yfactor+current->win.yorg)*
00123 current->win.yresizefactor+0.5);
00124 else
00125 *y = (short)((current->win.ysize-(log10(fy)-logymin)*
00126 current->win.yfactor+current->win.yorg)*
00127 current->win.yresizefactor+0.5);
00128
00129 }
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187 lux_convert_coordsshort_rects(win,fx,fy,w,h,x,y,n)
00188 Window win;
00189 float *fx,*fy;
00190 float w,h;
00191 short *x, *y;
00192 unsigned int n;
00193 {
00194 register int i;
00195 register lux_wins *current;
00196 short width, height;
00197
00198 current = get_currentwin(win);
00199
00200 width = (short)(w*current->win.xfactor*current->win.xresizefactor + 0.5);
00201 height = (short)(h*current->win.yfactor*current->win.yresizefactor + 0.5);
00202
00203 if ((fx == fy) && ((w <0.0) || (h<0.0)))
00204 for(i=0;i<4*n;i+=4) {
00205 x[i+2] = (short)(fx[i+2]*current->win.xfactor*current->win.xresizefactor + 0.5);
00206 y[i+3] = (short)(fy[i+3]*current->win.yfactor*current->win.yresizefactor + 0.5);
00207 x[i] = (short)(((fx[i] - current->win.xmin)*current->win.xfactor +
00208 current->win.xorg)*current->win.xresizefactor + 0.5);
00209 y[i+1] = (short)((current->win.ysize - (fy[i+1]-current->win.ymin)*
00210 current->win.yfactor + current->win.yorg)*
00211 current->win.yresizefactor + 0.5) - y[i+3];
00212 }
00213 else if (fx == fy)
00214 for(i=0;i<2*n;i+=2) {
00215 x[i*2] = (short)(((fx[i] - current->win.xmin)*current->win.xfactor +
00216 current->win.xorg)*current->win.xresizefactor + 0.5);
00217 x[i*2+1] = (short)((current->win.ysize - (fy[i+1]-current->win.ymin)*
00218 current->win.yfactor + current->win.yorg)*
00219 current->win.yresizefactor + 0.5) - height;
00220 x[i*2+2] = width;
00221 x[i*2+3] = height;
00222 }
00223 else if (x == y)
00224 for(i=0;i<n;i++) {
00225 x[i*4] = (short)(((fx[i] - current->win.xmin)*current->win.xfactor +
00226 current->win.xorg)*current->win.xresizefactor + 0.5);
00227 x[i*4+1] = (short)((current->win.ysize - (fy[i]-current->win.ymin)*
00228 current->win.yfactor + current->win.yorg)*
00229 current->win.yresizefactor + 0.5) - height;
00230 x[i*4+2] = width;
00231 x[i*4+3] = height;
00232 }
00233 }
00234
00235 lux_convert_coord_rect(win,fx,fy,fw,fh,ix,iy,iw,ih)
00236 Window win;
00237 float fx,fy,fw,fh;
00238 int *ix, *iy, *iw, *ih;
00239 {
00240 register lux_wins *current;
00241
00242 current = get_currentwin(win);
00243
00244 *iw = (int)(fw*current->win.xfactor*current->win.xresizefactor + 0.5);
00245 *ih = (int)(fh*current->win.yfactor*current->win.yresizefactor + 0.5);
00246
00247 *ix = (int)(((fx - current->win.xmin)*current->win.xfactor +
00248 current->win.xorg)*current->win.xresizefactor + 0.5);
00249 *iy = (int)((current->win.ysize - (fy-current->win.ymin)*
00250 current->win.yfactor + current->win.yorg)*
00251 current->win.yresizefactor + 0.5) - *ih;
00252 }
00253
00254 lux_convert_coordsshort_arcs(win,fx,fy,w,h,a1,a2,x,y,n)
00255 Window win;
00256 float *fx,*fy;
00257 float w,h;
00258 float a1,a2;
00259 short *x, *y;
00260 unsigned int n;
00261 {
00262 register int i;
00263 register lux_wins *current;
00264 short width, height;
00265
00266 current = get_currentwin(win);
00267
00268 width = (short)(w*current->win.xfactor*current->win.xresizefactor + 0.5);
00269 height = (short)(h*current->win.yfactor*current->win.yresizefactor + 0.5);
00270
00271 a1 = (short)(a1*64.0 + 0.5);
00272 a2 = (short)(a2*64.0 + 0.5);
00273
00274 if ((fx==fy) && ((w<0.0)||(h<0.0)))
00275 for(i=0;i<6*n;i+=6) {
00276 x[i+2] = (short)(fx[i+2]*current->win.xfactor*current->win.xresizefactor + 0.5);
00277 y[i+3] = (short)(fy[i+3]*current->win.yfactor*current->win.yresizefactor + 0.5);
00278 x[i] = (short)(((fx[i] - current->win.xmin)*current->win.xfactor +
00279 current->win.xorg)*current->win.xresizefactor + 0.5);
00280 y[i+1] = (short)((current->win.ysize - (fy[i+1]-current->win.ymin)*
00281 current->win.yfactor + current->win.yorg)*
00282 current->win.yresizefactor + 0.5) - y[i+3];
00283 x[i+4] = (short)(fx[i+4]*64.0 + 0.5);
00284 y[i+5] = (short)(fy[i+5]*64.0 + 0.5);
00285 }
00286 else if (fx == fy)
00287 for(i=0;i<2*n;i+=2) {
00288 x[i*3] = (short)(((fx[i] - current->win.xmin)*current->win.xfactor +
00289 current->win.xorg)*current->win.xresizefactor + 0.5);
00290 x[i*3+1] = (short)((current->win.ysize - (fy[i+1]-current->win.ymin)*
00291 current->win.yfactor + current->win.yorg)*
00292 current->win.yresizefactor + 0.5) - height;
00293 x[i*3+2] = width;
00294 x[i*3+3] = height;
00295 x[i*3+4] = a1;
00296 x[i*3+5] = a2;
00297 }
00298 else if (x == y)
00299 for(i=0;i<n;i++) {
00300 x[i*6] = (short)(((fx[i] - current->win.xmin)*current->win.xfactor +
00301 current->win.xorg)*current->win.xresizefactor + 0.5);
00302 x[i*6+1] = (short)((current->win.ysize - (fy[i]-current->win.ymin)*
00303 current->win.yfactor + current->win.yorg)*
00304 current->win.yresizefactor + 0.5) - height;
00305 x[i*6+2] = width;
00306 x[i*6+3] = height;
00307 x[i*6+4] = a1;
00308 x[i*6+5] = a2;
00309 }
00310 }
00311
00312 lux_convert_coord_arc(win,fx,fy,fw,fh,fa1,fa2,ix,iy,iw,ih,ia1,ia2)
00313 Window win;
00314 float fx,fy,fw,fh,fa1,fa2;
00315 int *ix, *iy, *iw, *ih, *ia1, *ia2;
00316 {
00317 register lux_wins *current;
00318
00319 current = get_currentwin(win);
00320
00321 *iw = (int)(fw*current->win.xfactor*current->win.xresizefactor + 0.5);
00322 *ih = (int)(fh*current->win.yfactor*current->win.yresizefactor + 0.5);
00323
00324 *ix = (int)(((fx - current->win.xmin)*current->win.xfactor +
00325 current->win.xorg)*current->win.xresizefactor + 0.5);
00326 *iy = (int)((current->win.ysize - (fy-current->win.ymin)*
00327 current->win.yfactor + current->win.yorg)*
00328 current->win.yresizefactor + 0.5) - *ih;
00329 *ia1 = (int)(fa1*64.0 + 0.5);
00330 *ia2 = (int)(fa2*64.0 + 0.5);
00331
00332 }
00333
00334 lux_draw_pointsf(win,fx,fy,n,mode)
00335 Window win;
00336 float *fx, *fy;
00337 unsigned int n;
00338 int mode;
00339 {
00340
00341 register lux_wins *current;
00342 register lux_data *newdata;
00343 register int i,j;
00344 register float *ptr;
00345 unsigned int size;
00346 int m;
00347
00348 current = get_currentwin(win);
00349
00350 size=(MAXDRAWSIZE*2>(XMAXREQUESTSIZE-3))?(XMAXREQUESTSIZE-3):MAXDRAWSIZE*2;
00351
00352 if ((mode==2)&&(n>size)) {
00353 fprintf(stderr,"ERR: Two many points in draw points with mode 2\n Maximum points you can draw at one time is %u \n", size);
00354 return(0);
00355 }
00356
00357
00358 if (mode == 2) m = CoordModePrevious;
00359 else m = CoordModeOrigin;
00360
00361 if (n > size) {
00362 j = n;
00363 for(i=0;i<n-size;i+=size) {
00364 j = j - size;
00365 if (fx == fy)
00366 lux_draw_pointsf(win,fx+i*2,fy+i*2,size,mode);
00367 else
00368 lux_draw_pointsf(win,fx+i,fy+i,size,mode);
00369 }
00370 if (fx == fy)
00371 lux_draw_pointsf(win,fx+i*2,fy+i*2,j,mode);
00372 else
00373 lux_draw_pointsf(win,fx+i,fy+i,j,mode);
00374 return(1);
00375 }
00376
00377 if ( current->win.discard_flag ) {
00378 lux_convert_coordsshort(win, fx, fy, segs, segs, n);
00379
00380 if (current->win.pixmap)
00381 XDrawPoints(current->win.display, current->win.pixmap,
00382 current->win.gc, (XPoint*)segs, n, m);
00383 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00384 XDrawPoints(current->win.display, current->win.window,
00385 current->win.gc, (XPoint*)segs, n, m);
00386 XFlush(current->win.display);
00387 }
00388 return(1);
00389 }
00390
00391 if ( (newdata = get_newdata(current)) == (lux_data *)NULL ) {
00392 lux_convert_coordsshort(win, fx, fy, segs, segs, n);
00393
00394 if (current->win.pixmap)
00395 XDrawPoints(current->win.display, current->win.pixmap,
00396 current->win.gc, (XPoint*)segs, n, m);
00397 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00398 XDrawPoints(current->win.display, current->win.window,
00399 current->win.gc, (XPoint*)segs, n, m);
00400 XFlush(current->win.display);
00401 }
00402 fprintf(stderr, "Can't draw pointsf because of not enough memory\n");
00403 return(0);
00404 }
00405
00406 newdata->data.i = (int *)malloc(2*sizeof(int)+2*n*sizeof(float));
00407
00408 if (newdata->data.i == (int *)NULL) {
00409 if ((n <= 10) || (mode == 2)) {
00410 lux_convert_coordsshort(win, fx, fy, segs, segs, n);
00411
00412 if (current->win.pixmap)
00413 XDrawPoints(current->win.display, current->win.pixmap,
00414 current->win.gc, (XPoint*)segs, n, m);
00415 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00416 XDrawPoints(current->win.display, current->win.window,
00417 current->win.gc, (XPoint*)segs, n, m);
00418 XFlush(current->win.display);
00419 }
00420 fprintf(stderr, "\n Not enough memory in draw_pointsf with mode %d\n",mode);
00421 newdata->type = NOOP;
00422 return(0);
00423 }
00424 else {
00425 j = (int)(n/2);
00426 if ( fx == fy ) {
00427 lux_draw_pointsf(win,fx,fy,j,mode);
00428 lux_draw_pointsf(win,fx+j*2,fy+j*2,n-j,mode);
00429 return(1);
00430 }
00431 else {
00432 lux_draw_pointsf(win,fx,fy,j,mode);
00433 lux_draw_pointsf(win,fx+j,fy+j,n-j,mode);
00434 return(1);
00435 }
00436 }
00437 }
00438
00439 lux_convert_coordsshort(win, fx, fy, segs, segs, n);
00440
00441 if (current->win.pixmap)
00442 XDrawPoints(current->win.display, current->win.pixmap,
00443 current->win.gc, (XPoint*)segs, n, m);
00444 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00445 XDrawPoints(current->win.display, current->win.window,
00446 current->win.gc, (XPoint*)segs, n, m);
00447 XFlush(current->win.display);
00448 }
00449
00450 newdata->type = DRAW_POINTS_F;
00451
00452 newdata->data.u[0] = n;
00453 newdata->data.i[1] = m;
00454 ptr = (float *)(&(newdata->data.i[2]));
00455
00456 if (fx == fy)
00457 for(i=0;i<2*n;i++) ptr[i] = fx[i];
00458 else
00459 for(i=0;i<2*n;i+=2) {
00460 ptr[i] = fx[i/2];
00461 ptr[i+1] = fy[i/2];
00462 }
00463 return(1);
00464 }
00465
00466 lux_redraw_pointsf(win)
00467 Window win;
00468 {
00469 register lux_wins *current;
00470 float *ptrf;
00471 int m; unsigned int n;
00472
00473 current = get_currentwin(win);
00474
00475 n = (current->win.currentdata)->data.u[0];
00476 m = (current->win.currentdata)->data.i[1];
00477 ptrf = (float *)(&((current->win.currentdata)->data.i[2]));
00478
00479 lux_convert_coordsshort(win, ptrf, ptrf, (short *)segs, (short *)segs, n);
00480
00481 if (current->win.pixmap) {
00482 XDrawPoints(current->win.display, current->win.pixmap,
00483 redrawgc, (XPoint*)segs, n, m);
00484 }
00485 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00486 XDrawPoints(current->win.display, current->win.window,
00487 redrawgc, (XPoint*)segs, n, m);
00488 }
00489 return(1);
00490 }
00491
00492 lux_draw_linesf(win,fx,fy,n,mode)
00493 Window win;
00494 float *fx, *fy;
00495 unsigned int n;
00496 int mode;
00497 {
00498
00499 register lux_wins *current;
00500 register lux_data *newdata;
00501 register int i,j;
00502 register float *ptr;
00503 int size, m;
00504
00505 current = get_currentwin(win);
00506
00507 size=(MAXDRAWSIZE*2>(XMAXREQUESTSIZE-3))?(XMAXREQUESTSIZE-3):MAXDRAWSIZE*2;
00508
00509 if ((mode==2)&&(n>size)) {
00510 fprintf(stderr,"luxwins: Two many points in draw lines with mode 2\n Maximum points you can draw at one time is %u \n", size);
00511 return(0);
00512 }
00513
00514 if (mode == 2) m = CoordModePrevious;
00515 else m = CoordModeOrigin;
00516
00517 if (n > size) {
00518 int m = 0;
00519 j = n+n/size;
00520 for(i=0;i<n+n/size-size;i+=size) {
00521 j = j - size;
00522 if (fx == fy)
00523
00524 lux_draw_linesf(win,fx+(i*2-m*2),fy+(i*2-m*2),size,mode);
00525 else
00526 lux_draw_linesf(win,fx+(i-m),fy+(i-m),size,mode);
00527 m = m + 1;
00528 }
00529 if (fx == fy)
00530 lux_draw_linesf(win,fx+i*2-m*2,fy+i*2-m*2,j,mode);
00531 else
00532 lux_draw_linesf(win,fx+i-m,fy+i-m,j,mode);
00533 return(1);
00534 }
00535
00536 if ( current->win.discard_flag ) {
00537 lux_convert_coordsshort(win, fx, fy, segs, segs, n);
00538
00539 if (current->win.pixmap)
00540 XDrawLines(current->win.display, current->win.pixmap,
00541 current->win.gc, (XPoint*)segs, n, m);
00542 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00543 XDrawLines(current->win.display, current->win.window,
00544 current->win.gc, (XPoint*)segs, n, m);
00545 XFlush(current->win.display);
00546 }
00547 return(1);
00548 }
00549
00550 if ( (newdata = get_newdata(current)) == (lux_data *)NULL ) {
00551 lux_convert_coordsshort(win, fx, fy, segs, segs, n);
00552
00553 if (current->win.pixmap)
00554 XDrawLines(current->win.display, current->win.pixmap,
00555 current->win.gc, (XPoint*)segs, n, m);
00556 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00557 XDrawLines(current->win.display, current->win.window,
00558 current->win.gc, (XPoint*)segs, n, m);
00559 XFlush(current->win.display);
00560 }
00561 fprintf(stderr, "Can't draw linesf because of not enough memory\n");
00562 return(0);
00563 }
00564
00565 newdata->data.i = (int *)malloc(2*sizeof(int)+2*n*sizeof(float));
00566
00567 if (newdata->data.i == (int *)NULL) {
00568 if (n <= 10 || mode == 2) {
00569 lux_convert_coordsshort(win, fx, fy, segs, segs, n);
00570
00571 if (current->win.pixmap)
00572 XDrawLines(current->win.display, current->win.pixmap,
00573 current->win.gc, (XPoint*)segs, n, m);
00574 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00575 XDrawLines(current->win.display, current->win.window,
00576 current->win.gc, (XPoint*)segs, n, m);
00577 XFlush(current->win.display);
00578 }
00579 fprintf(stderr, "\n Not enough memory in draw_linesf with mode %d\n", mode);
00580 newdata->type = NOOP;
00581 return(0);
00582 }
00583 else {
00584 j = (int)(n/2);
00585 if ( fx == fy ) {
00586 lux_draw_linesf(win,fx,fy,j,mode);
00587 lux_draw_linesf(win,fx+j*2-2,fy+j*2-2,n-j+1,mode);
00588 return(1);
00589 }
00590 else {
00591 lux_draw_linesf(win,fx,fy,j,mode);
00592 lux_draw_linesf(win,fx+j-1,fy+j-1,n-j+1,mode);
00593 return(1);
00594 }
00595 }
00596 }
00597
00598 lux_convert_coordsshort(win, fx, fy, segs, segs, n);
00599
00600 if (current->win.pixmap)
00601 XDrawLines(current->win.display, current->win.pixmap,
00602 current->win.gc,(XPoint*)segs, n, m);
00603 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00604 XDrawLines(current->win.display, current->win.window,
00605 current->win.gc, (XPoint*)segs, n, m);
00606 XFlush(current->win.display);
00607 }
00608
00609 newdata->type = DRAW_LINES_F;
00610
00611 newdata->data.u[0] = n;
00612 newdata->data.i[1] = m;
00613 ptr = (float *)(&(newdata->data.i[2]));
00614
00615 if (fx == fy)
00616 for(i=0;i<2*n;i++) ptr[i] = fx[i];
00617 else
00618 for(i=0;i<2*n;i+=2) {
00619 ptr[i] = fx[i/2];
00620 ptr[i+1] = fy[i/2];
00621 }
00622 return(1);
00623 }
00624
00625 lux_redraw_linesf(win)
00626 Window win;
00627 {
00628 register lux_wins *current;
00629 float *ptrf;
00630 int m; unsigned int n;
00631
00632 current = get_currentwin(win);
00633
00634 n = (current->win.currentdata)->data.u[0];
00635 m = (current->win.currentdata)->data.i[1];
00636 ptrf = (float *)(&((current->win.currentdata)->data.i[2]));
00637
00638 lux_convert_coordsshort(win, ptrf, ptrf, (short *)segs, (short *)segs, n);
00639
00640 if (current->win.pixmap) {
00641 XDrawLines(current->win.display, current->win.pixmap,
00642 redrawgc, (XPoint*)segs, n, m);
00643 }
00644 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00645 XDrawLines(current->win.display, current->win.window,
00646 redrawgc, (XPoint*)segs, n, m);
00647 }
00648 return(1);
00649 }
00650
00651 lux_draw_segmentsf(win,fx1,fy1,fx2,fy2,n)
00652 Window win;
00653 float *fx1, *fy1, *fx2, *fy2;
00654 unsigned int n;
00655 {
00656
00657 register lux_wins *current;
00658 register lux_data *newdata;
00659 register int i,j;
00660 register float *ptr;
00661 unsigned int size;
00662
00663 current = get_currentwin(win);
00664
00665 size=(MAXDRAWSIZE>(XMAXREQUESTSIZE-3)/2)?(XMAXREQUESTSIZE-3)/2:MAXDRAWSIZE;
00666
00667 if (n > size) {
00668 j = n;
00669 for(i=0;i<n-size;i+=size) {
00670 j = j - size;
00671 if (fx1 == fy1)
00672 lux_draw_segmentsf(win,fx1+i*4,fy1+i*4,fx2+i*4,fy2+i*4,size);
00673 else if (fx1 == fx2)
00674 lux_draw_segmentsf(win,fx1+i*2,fy1+i*2,fx2+i*2,fy2+i*2,size);
00675 else
00676 lux_draw_segmentsf(win,fx1+i,fy1+i,fx2+i,fy2+i,size);
00677 }
00678 if (fx1 == fy1)
00679 lux_draw_segmentsf(win,fx1+i*4,fy1+i*4,fx2+i*4,fy2+i*4,j);
00680 else if (fx1 == fx2)
00681 lux_draw_segmentsf(win,fx1+i*2,fy1+i*2,fx2+i*2,fy2+i*2,j);
00682 else
00683 lux_draw_segmentsf(win,fx1+i,fy1+i,fx2+i,fy2+i,j);
00684 return(1);
00685 }
00686
00687 if ( current->win.discard_flag ) {
00688 if (fx1 == fy1)
00689 lux_convert_coordsshort(win, fx1, fy1, segs, segs, 2*n);
00690 else if (fx1 == fx2)
00691 lux_convert_coordsshort(win, fx1, fy1, segs, segs, 2*n);
00692 else
00693 for(i=0;i<n;i++) {
00694 lux_convert_coordshort(win, fx1[i], fy1[i], &segs[i].x1, &segs[i].y1);
00695 lux_convert_coordshort(win, fx2[i], fy2[i], &segs[i].x2, &segs[i].y2);
00696 }
00697
00698 if (current->win.pixmap)
00699 XDrawSegments(current->win.display, current->win.pixmap,
00700 current->win.gc, (XSegment*)segs, n);
00701 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00702 XDrawSegments(current->win.display, current->win.window,
00703 current->win.gc, (XSegment*)segs, n);
00704 XFlush(current->win.display);
00705 }
00706 return(1);
00707 }
00708
00709 if ( (newdata = get_newdata(current)) == (lux_data *)NULL ) {
00710 if (fx1 == fy1)
00711 lux_convert_coordsshort(win, fx1, fy1, segs, segs, 2*n);
00712 else if (fx1 == fx2)
00713 lux_convert_coordsshort(win, fx1, fy1, segs, segs, 2*n);
00714 else
00715 for(i=0;i<n;i++) {
00716 lux_convert_coordshort(win, fx1[i], fy1[i], &segs[i].x1, &segs[i].y1);
00717 lux_convert_coordshort(win, fx2[i], fy2[i], &segs[i].x2, &segs[i].y2);
00718 }
00719
00720 if (current->win.pixmap)
00721 XDrawSegments(current->win.display, current->win.pixmap,
00722 current->win.gc, (XSegment*)segs, n);
00723 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00724 XDrawSegments(current->win.display, current->win.window,
00725 current->win.gc, (XSegment*)segs, n);
00726 XFlush(current->win.display);
00727 }
00728 fprintf(stderr, "Can't draw segmentsf because of not enough memory\n");
00729 return(0);
00730 }
00731
00732 newdata->data.i = (int *)malloc(sizeof(int)+4*n*sizeof(float));
00733
00734 if (newdata->data.i == (int *)NULL) {
00735 if (n <= 10) {
00736 if (fx1 == fy1)
00737 lux_convert_coordsshort(win, fx1, fy1, segs, segs, 2*n);
00738 else if (fx1 == fx2)
00739 lux_convert_coordsshort(win, fx1, fy1, segs, segs, 2*n);
00740 else
00741 for(i=0;i<n;i++) {
00742 lux_convert_coordshort(win, fx1[i],fy1[i], &segs[i].x1,&segs[i].y1);
00743 lux_convert_coordshort(win, fx2[i],fy2[i], &segs[i].x2,&segs[i].y2);
00744 }
00745
00746 if (current->win.pixmap)
00747 XDrawSegments(current->win.display, current->win.pixmap,
00748 current->win.gc, (XSegment*)segs, n);
00749 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00750 XDrawSegments(current->win.display, current->win.window,
00751 current->win.gc, (XSegment*)segs, n);
00752 XFlush(current->win.display);
00753 }
00754 fprintf(stderr, "\n Not enough memory in draw_segmentsf\n");
00755 newdata->type = NOOP;
00756 return(0);
00757 }
00758 else {
00759 j = (int)(n/2);
00760 if ( fx1 == fy1 ) {
00761 lux_draw_segmentsf(win,fx1,fy1,fx2,fy2,j);
00762 lux_draw_segmentsf(win,fx1+j*4,fy1+j*4,fx2+j*4,fy2+j*4,n-j);
00763 return(1);
00764 }
00765 else if (fx1 == fx2) {
00766 lux_draw_segmentsf(win,fx1,fy1,fx2,fy2,j);
00767 lux_draw_segmentsf(win,fx1+j*2,fy1+j*2,fx2+j*2,fy2+j*2,n-j);
00768 }
00769 else {
00770 lux_draw_segmentsf(win,fx1,fy1,fx2,fy2,j);
00771 lux_draw_segmentsf(win,fx1+j,fy1+j,fx2+j,fy2+j,n-j);
00772 return(1);
00773 }
00774 }
00775 }
00776
00777 if (fx1 == fy1)
00778 lux_convert_coordsshort(win, fx1, fy1, segs, segs, 2*n);
00779 else if (fx1 == fx2)
00780 lux_convert_coordsshort(win, fx1, fy1, segs, segs, 2*n);
00781 else
00782 for(i=0;i<n;i++) {
00783 lux_convert_coordshort(win, fx1[i],fy1[i], &segs[i].x1,&segs[i].y1);
00784 lux_convert_coordshort(win, fx2[i],fy2[i], &segs[i].x2,&segs[i].y2);
00785 }
00786
00787 if (current->win.pixmap)
00788 XDrawSegments(current->win.display, current->win.pixmap,
00789 current->win.gc, (XSegment*)segs, n);
00790 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00791 XDrawSegments(current->win.display, current->win.window,
00792 current->win.gc, (XSegment*)segs, n);
00793 XFlush(current->win.display);
00794 }
00795
00796 newdata->type = DRAW_SEGMENTS_F;
00797
00798 newdata->data.u[0] = n;
00799 ptr = (float *)(&(newdata->data.i[1]));
00800
00801 if (fx1 == fy1)
00802 for(i=0;i<4*n;i++) ptr[i] = fx1[i];
00803 else if (fx1 == fx2)
00804 for(i=0;i<4*n;i+=2) {
00805 ptr[i] = fx1[i/2];
00806 ptr[i+1] = fy1[i/2];
00807 }
00808 else
00809 for(i=0;i<4*n;i+=4) {
00810 ptr[i] = fx1[i/4];
00811 ptr[i+1] = fy1[i/4];
00812 ptr[i+2] = fx2[i/4];
00813 ptr[i+3] = fy2[i/4];
00814 }
00815 return(1);
00816 }
00817
00818 lux_redraw_segmentsf(win)
00819 Window win;
00820 {
00821 register lux_wins *current;
00822 float *ptrf;
00823 unsigned int n;
00824
00825 current = get_currentwin(win);
00826
00827 n = (current->win.currentdata)->data.u[0];
00828 ptrf = (float *)(&((current->win.currentdata)->data.i[1]));
00829
00830 lux_convert_coordsshort(win, ptrf, ptrf, (short *)segs, (short *)segs, 2*n);
00831
00832 if (current->win.pixmap) {
00833 XDrawSegments(current->win.display, current->win.pixmap,
00834 redrawgc, (XSegment*)segs, n);
00835 }
00836 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00837 XDrawSegments(current->win.display, current->win.window,
00838 redrawgc, (XSegment*)segs, n);
00839 }
00840 return(1);
00841 }
00842
00843 lux_draw_rectanglesf(win,fx1,fy1,w,h,n)
00844 Window win;
00845 float *fx1, *fy1, w, h;
00846 unsigned int n;
00847 {
00848
00849 register lux_wins *current;
00850 register lux_data *newdata;
00851 register int i,j;
00852 register float *ptr;
00853 unsigned int size, times;
00854
00855 current = get_currentwin(win);
00856
00857 size=(MAXDRAWSIZE>(XMAXREQUESTSIZE-3)/2)?(XMAXREQUESTSIZE-3)/2:MAXDRAWSIZE;
00858
00859
00860 if ((fx1 == fy1)&&(w<0.0||h<0.0)) times = 4;
00861 else if (fx1 == fy1) times = 2;
00862 else times = 1;
00863
00864 if (n > size) {
00865 j = n;
00866 for(i=0;i<n-size;i+=size) {
00867 j = j - size;
00868 lux_draw_rectanglesf(win,fx1+i*times,fy1+i*times,w,h,size);
00869 }
00870 lux_draw_rectanglesf(win,fx1+i*times,fy1+i*times,w,h,j);
00871 return(1);
00872 }
00873
00874 if ( current->win.discard_flag ) {
00875 lux_convert_coordsshort_rects(win, fx1, fy1, w, h, segs, segs, n);
00876
00877 if (current->win.pixmap)
00878 XDrawRectangles(current->win.display, current->win.pixmap,
00879 current->win.gc, (XRectangle*)segs, n);
00880 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00881 XDrawRectangles(current->win.display, current->win.window,
00882 current->win.gc, (XRectangle*)segs, n);
00883 XFlush(current->win.display);
00884 }
00885 return(1);
00886 }
00887
00888 if ( (newdata = get_newdata(current)) == (lux_data *)NULL ) {
00889 lux_convert_coordsshort_rects(win, fx1, fy1, w, h, segs, segs, n);
00890
00891 if (current->win.pixmap)
00892 XDrawRectangles(current->win.display, current->win.pixmap,
00893 current->win.gc, (XRectangle*)segs, n);
00894 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00895 XDrawRectangles(current->win.display, current->win.window,
00896 current->win.gc, (XRectangle*)segs, n);
00897 XFlush(current->win.display);
00898 }
00899 fprintf(stderr, "Can't draw rectanglesf because of not enough memory\n");
00900 return(0);
00901 }
00902
00903 newdata->data.i = (int *)malloc(sizeof(int)+
00904 (n*((times==4)?4:2)+2)*sizeof(float));
00905
00906 if (newdata->data.i == (int *)NULL) {
00907 if (n <= 10) {
00908 lux_convert_coordsshort_rects(win, fx1, fy1, w, h, segs, segs, n);
00909 if (current->win.pixmap)
00910 XDrawRectangles(current->win.display, current->win.pixmap,
00911 current->win.gc, (XRectangle*)segs, n);
00912 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00913 XDrawRectangles(current->win.display, current->win.window,
00914 current->win.gc, (XRectangle*)segs, n);
00915 XFlush(current->win.display);
00916 }
00917 fprintf(stderr, "\n Not enough memory in draw_rectanglesf\n");
00918 newdata->type = NOOP;
00919 return(0);
00920 }
00921 else {
00922 j = (int)(n/2);
00923 lux_draw_rectanglesf(win,fx1,fy1,w,h,j);
00924 lux_draw_rectanglesf(win,fx1+j*times,fy1+j*times,w,h,n-j);
00925 return(1);
00926 }
00927 }
00928
00929 lux_convert_coordsshort_rects(win, fx1, fy1, w, h, segs, segs, n);
00930
00931 if (current->win.pixmap)
00932 XDrawRectangles(current->win.display, current->win.pixmap,
00933 current->win.gc, (XRectangle*)segs, n);
00934 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00935 XDrawRectangles(current->win.display, current->win.window,
00936 current->win.gc, (XRectangle*)segs, n);
00937 XFlush(current->win.display);
00938 }
00939
00940 newdata->type = DRAW_RECTANGLES_F;
00941
00942 newdata->data.u[0] = n;
00943 ptr = (float *)(&(newdata->data.i[1]));
00944 ptr[0] = w;
00945 ptr[1] = h;
00946
00947 if (fx1 == fy1)
00948 for(i=0;i<times*n;i++) ptr[i+2] = fx1[i];
00949 else
00950 for(i=0;i<n;i++) {
00951 ptr[i*2+2] = fx1[i];
00952 ptr[i*2+1+2] = fy1[i];
00953 }
00954 return(1);
00955 }
00956
00957 lux_redraw_rectanglesf(win)
00958 Window win;
00959 {
00960 register lux_wins *current;
00961 float *ptrf;
00962 float w, h;
00963 unsigned int n;
00964
00965 current = get_currentwin(win);
00966
00967 n = (current->win.currentdata)->data.u[0];
00968 ptrf = (float *)(&((current->win.currentdata)->data.i[1]));
00969 w = ptrf[0];
00970 h = ptrf[1];
00971
00972 lux_convert_coordsshort_rects(win, &ptrf[2], &ptrf[2], w, h,
00973 (short *)segs, (short *)segs, n);
00974
00975 if (current->win.pixmap) {
00976 XDrawRectangles(current->win.display, current->win.pixmap,
00977 redrawgc, (XRectangle*)segs, n);
00978 }
00979 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
00980 XDrawRectangles(current->win.display, current->win.window,
00981 redrawgc, (XRectangle*)segs, n);
00982 }
00983 return(1);
00984 }
00985
00986 lux_draw_rectanglef(win,fx,fy,w,h)
00987 Window win;
00988 float fx, fy, w, h;
00989 {
00990
00991 register lux_wins *current;
00992 register lux_data *newdata;
00993 register float *ptr;
00994 int x, y, width, height;
00995
00996 current = get_currentwin(win);
00997
00998 if ( current->win.discard_flag ) {
00999 lux_convert_coord_rect(win,fx,fy,w,h,&x,&y,&width,&height);
01000
01001 if (current->win.pixmap)
01002 XDrawRectangle(current->win.display, current->win.pixmap,
01003 current->win.gc, x,y, width, height);
01004 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01005 XDrawRectangle(current->win.display, current->win.window,
01006 current->win.gc, x,y, width, height);
01007 XFlush(current->win.display);
01008 }
01009 return(1);
01010 }
01011
01012 if ( (newdata = get_newdata(current)) == (lux_data *)NULL ) {
01013
01014 lux_convert_coord_rect(win,fx,fy,w,h,&x,&y,&width,&height);
01015
01016 if (current->win.pixmap)
01017 XDrawRectangle(current->win.display, current->win.pixmap,
01018 current->win.gc, x,y, width, height);
01019 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01020 XDrawRectangle(current->win.display, current->win.window,
01021 current->win.gc, x,y, width, height);
01022 XFlush(current->win.display);
01023 }
01024 fprintf(stderr, "Can't draw rectanglef because of not enough memory\n");
01025 return(0);
01026 }
01027
01028 newdata->data.f = (float *)malloc(4*sizeof(float));
01029
01030 if (newdata->data.i == (int *)NULL) {
01031
01032 lux_convert_coord_rect(win,fx,fy,w,h,&x,&y,&width,&height);
01033
01034 if (current->win.pixmap)
01035 XDrawRectangle(current->win.display, current->win.pixmap,
01036 current->win.gc, x,y, width, height);
01037 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01038 XDrawRectangle(current->win.display, current->win.window,
01039 current->win.gc, x,y, width, height);
01040 XFlush(current->win.display);
01041 }
01042 fprintf(stderr, "\n Not enough memory in draw_rectanglef\n");
01043 newdata->type = NOOP;
01044 return(0);
01045 }
01046
01047 lux_convert_coord_rect(win,fx,fy,w,h,&x,&y,&width,&height);
01048
01049 if (current->win.pixmap)
01050 XDrawRectangle(current->win.display, current->win.pixmap,
01051 current->win.gc, x,y, width, height);
01052 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01053 XDrawRectangle(current->win.display, current->win.window,
01054 current->win.gc, x,y, width, height);
01055 XFlush(current->win.display);
01056 }
01057
01058 newdata->type = DRAW_RECTANGLE_F;
01059
01060 ptr = newdata->data.f;
01061 ptr[0] = fx;
01062 ptr[1] = fy;
01063 ptr[2] = w;
01064 ptr[3] = h;
01065
01066 return(1);
01067 }
01068
01069 lux_redraw_rectanglef(win)
01070 Window win;
01071 {
01072 register lux_wins *current;
01073 float *ptrf;
01074 int x, y, width, height;
01075
01076
01077 current = get_currentwin(win);
01078
01079 ptrf = (current->win.currentdata)->data.f;
01080
01081 lux_convert_coord_rect(win, ptrf[0], ptrf[1], ptrf[2], ptrf[3],
01082 &x, &y, &width, &height);
01083
01084 if (current->win.pixmap) {
01085 XDrawRectangle(current->win.display, current->win.pixmap,
01086 redrawgc, x, y, width, height);
01087 }
01088 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01089 XDrawRectangle(current->win.display, current->win.window,
01090 redrawgc, x, y, width, height);
01091 }
01092 return(1);
01093 }
01094
01095 lux_draw_arcsf(win,fx1,fy1,w,h,a1,a2,n)
01096 Window win;
01097 float *fx1, *fy1, w, h,a1,a2;
01098 unsigned int n;
01099 {
01100
01101 register lux_wins *current;
01102 register lux_data *newdata;
01103 register int i,j;
01104 register float *ptr;
01105 unsigned int size, times;
01106
01107 current = get_currentwin(win);
01108
01109 size=(MAXDRAWSIZE>(XMAXREQUESTSIZE-3)/3)?(XMAXREQUESTSIZE-3)/3:MAXDRAWSIZE;
01110
01111
01112 if ((fx1 == fy1)&&(w<0.0||h<0.0)) times = 6;
01113 else if (fx1 == fy1) times = 2;
01114 else times = 1;
01115
01116 if (n > size) {
01117 j = n;
01118 for(i=0;i<n-size;i+=size) {
01119 j = j - size;
01120 lux_draw_arcsf(win,fx1+i*times,fy1+i*times,w,h,a1,a2,size);
01121 }
01122 lux_draw_arcsf(win,fx1+i*times,fy1+i*times,w,h,a1,a2,j);
01123 return(1);
01124 }
01125
01126 if ( current->win.discard_flag ) {
01127 lux_convert_coordsshort_arcs(win, fx1, fy1, w, h, a1, a2, segs, segs, n);
01128
01129 if (current->win.pixmap)
01130 XDrawArcs(current->win.display, current->win.pixmap,
01131 current->win.gc, (XArc*)segs, n);
01132 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01133 XDrawArcs(current->win.display, current->win.window,
01134 current->win.gc, (XArc*)segs, n);
01135 XFlush(current->win.display);
01136 }
01137 return(1);
01138 }
01139
01140 if ( (newdata = get_newdata(current)) == (lux_data *)NULL ) {
01141 lux_convert_coordsshort_arcs(win, fx1, fy1, w, h, a1, a2, segs, segs, n);
01142
01143 if (current->win.pixmap)
01144 XDrawArcs(current->win.display, current->win.pixmap,
01145 current->win.gc, (XArc*)segs, n);
01146 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01147 XDrawArcs(current->win.display, current->win.window,
01148 current->win.gc, (XArc*)segs, n);
01149 XFlush(current->win.display);
01150 }
01151 fprintf(stderr, "Can't draw arcsf because of not enough memory\n");
01152 return(0);
01153 }
01154
01155 newdata->data.i = (int *)malloc(sizeof(int)+
01156 (n*((times==6)?6:2)+4)*sizeof(float));
01157
01158 if (newdata->data.i == (int *)NULL) {
01159 if (n <= 10) {
01160 lux_convert_coordsshort_arcs(win, fx1, fy1, w, h,a1, a2, segs, segs, n);
01161 if (current->win.pixmap)
01162 XDrawArcs(current->win.display, current->win.pixmap,
01163 current->win.gc, (XArc*)segs, n);
01164 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01165 XDrawArcs(current->win.display, current->win.window,
01166 current->win.gc, (XArc*)segs, n);
01167 XFlush(current->win.display);
01168 }
01169 fprintf(stderr, "\n Not enough memory in draw_arcsf\n");
01170 newdata->type = NOOP;
01171 return(0);
01172 }
01173 else {
01174 j = (int)(n/2);
01175 lux_draw_arcsf(win,fx1,fy1,w,h,a1,a2,j);
01176 lux_draw_arcsf(win,fx1+j*times,fy1+j*times,w,h,a1,a2,n-j);
01177 return(1);
01178 }
01179 }
01180
01181 lux_convert_coordsshort_arcs(win, fx1, fy1, w, h, a1, a2, segs, segs, n);
01182
01183 if (current->win.pixmap)
01184 XDrawArcs(current->win.display, current->win.pixmap,
01185 current->win.gc, (XArc*)segs, n);
01186 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01187 XDrawArcs(current->win.display, current->win.window,
01188 current->win.gc, (XArc*)segs, n);
01189 XFlush(current->win.display);
01190 }
01191
01192 newdata->type = DRAW_ARCS_F;
01193
01194 newdata->data.u[0] = n;
01195 ptr = (float *)(&(newdata->data.i[1]));
01196 ptr[0] = w;
01197 ptr[1] = h;
01198 ptr[2] = a1;
01199 ptr[3] = a2;
01200
01201 if (fx1 == fy1)
01202 for(i=0;i<times*n;i++) ptr[i+4] = fx1[i];
01203 else
01204 for(i=0;i<n;i++) {
01205 ptr[i*2+4] = fx1[i];
01206 ptr[i*2+1+4] = fy1[i];
01207 }
01208 return(1);
01209 }
01210
01211 lux_redraw_arcsf(win)
01212 Window win;
01213 {
01214 register lux_wins *current;
01215 float *ptrf;
01216 unsigned int n;
01217
01218 current = get_currentwin(win);
01219
01220 n = (current->win.currentdata)->data.u[0];
01221 ptrf = (float *)(&((current->win.currentdata)->data.i[1]));
01222
01223 lux_convert_coordsshort_arcs(win, &ptrf[2], &ptrf[2], ptrf[0], ptrf[1],
01224 ptrf[2],ptrf[3],(short *)segs,(short *)segs, n);
01225
01226 if (current->win.pixmap) {
01227 XDrawArcs(current->win.display, current->win.pixmap,
01228 redrawgc, (XArc*)segs, n);
01229 }
01230 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01231 XDrawArcs(current->win.display, current->win.window,
01232 redrawgc, (XArc*)segs, n);
01233 }
01234 return(1);
01235 }
01236
01237 lux_draw_arcf(win,fx,fy,w,h,a1,a2)
01238 Window win;
01239 float fx, fy, w, h, a1,a2;
01240 {
01241
01242 register lux_wins *current;
01243 register lux_data *newdata;
01244 register float *ptr;
01245 int x, y, width, height, ia1, ia2;
01246
01247 current = get_currentwin(win);
01248
01249 if ( current->win.discard_flag ) {
01250 lux_convert_coord_arc(win,fx,fy,w,h,a1,a2,&x,&y,&width,&height,&ia1,&ia2);
01251
01252 if (current->win.pixmap)
01253 XDrawArc(current->win.display, current->win.pixmap,
01254 current->win.gc, x,y, width, height,ia1,ia2);
01255 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01256 XDrawArc(current->win.display, current->win.window,
01257 current->win.gc, x,y, width, height,ia1,ia2);
01258 XFlush(current->win.display);
01259 }
01260 return(1);
01261 }
01262
01263 if ( (newdata = get_newdata(current)) == (lux_data *)NULL ) {
01264
01265 lux_convert_coord_arc(win,fx,fy,w,h,a1,a2,&x,&y,&width,&height,&ia1,&ia2);
01266
01267 if (current->win.pixmap)
01268 XDrawArc(current->win.display, current->win.pixmap,
01269 current->win.gc, x,y, width, height,ia1,ia2);
01270 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01271 XDrawArc(current->win.display, current->win.window,
01272 current->win.gc, x,y, width, height,ia1,ia2);
01273 XFlush(current->win.display);
01274 }
01275 fprintf(stderr, "Can't draw arcf because of not enough memory\n");
01276 return(0);
01277 }
01278
01279 newdata->data.f = (float *)malloc(6*sizeof(float));
01280
01281 if (newdata->data.i == (int *)NULL) {
01282
01283 lux_convert_coord_arc(win,fx,fy,w,h,a1,a2,&x,&y,&width,&height,&ia1,&ia2);
01284
01285 if (current->win.pixmap)
01286 XDrawArc(current->win.display, current->win.pixmap,
01287 current->win.gc, x,y, width, height,ia1,ia2);
01288 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01289 XDrawArc(current->win.display, current->win.window,
01290 current->win.gc, x,y, width, height,ia1,ia2);
01291 XFlush(current->win.display);
01292 }
01293 fprintf(stderr, "\n Not enough memory in draw_arcf\n");
01294 newdata->type = NOOP;
01295 return(0);
01296 }
01297
01298
01299 lux_convert_coord_arc(win,fx,fy,w,h,a1,a2,&x,&y,&width,&height,&ia1,&ia2);
01300
01301 if (current->win.pixmap)
01302 XDrawArc(current->win.display, current->win.pixmap,
01303 current->win.gc, x,y, width, height,ia1,ia2);
01304 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01305 XDrawArc(current->win.display, current->win.window,
01306 current->win.gc, x,y, width, height,ia1,ia2);
01307 XFlush(current->win.display);
01308 }
01309
01310 newdata->type = DRAW_ARC_F;
01311
01312 ptr = newdata->data.f;
01313 ptr[0] = fx;
01314 ptr[1] = fy;
01315 ptr[2] = w;
01316 ptr[3] = h;
01317 ptr[4] = a1;
01318 ptr[5] = a2;
01319
01320 return(1);
01321 }
01322
01323 lux_redraw_arcf(win)
01324 Window win;
01325 {
01326 register lux_wins *current;
01327 float *ptrf;
01328 int x, y, width, height, a1, a2;
01329
01330
01331 current = get_currentwin(win);
01332
01333 ptrf = (current->win.currentdata)->data.f;
01334
01335 lux_convert_coord_arc(win, ptrf[0], ptrf[1], ptrf[2], ptrf[3], ptrf[4],
01336 ptrf[5], &x, &y, &width, &height, &a1, &a2);
01337
01338 if (current->win.pixmap) {
01339 XDrawArc(current->win.display, current->win.pixmap,
01340 redrawgc, x, y, width, height, a1, a2);
01341 }
01342 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01343 XDrawArc(current->win.display, current->win.window,
01344 redrawgc, x, y, width, height, a1, a2);
01345 }
01346 return(1);
01347 }
01348
01349
01350 lux_fill_rectanglesf(win,fx1,fy1,w,h,n)
01351 Window win;
01352 float *fx1, *fy1, w, h;
01353 unsigned int n;
01354 {
01355
01356 register lux_wins *current;
01357 register lux_data *newdata;
01358 register int i,j;
01359 register float *ptr;
01360 unsigned int size, times;
01361
01362 current = get_currentwin(win);
01363
01364 size=(MAXDRAWSIZE>(XMAXREQUESTSIZE-3)/2)?(XMAXREQUESTSIZE-3)/2:MAXDRAWSIZE;
01365
01366
01367 if ((fx1 == fy1)&&(w<0.0||h<0.0)) times = 4;
01368 else if (fx1 == fy1) times = 2;
01369 else times = 1;
01370
01371 if (n > size) {
01372 j = n;
01373 for(i=0;i<n-size;i+=size) {
01374 j = j - size;
01375 lux_fill_rectanglesf(win,fx1+i*times,fy1+i*times,w,h,size);
01376 }
01377 lux_fill_rectanglesf(win,fx1+i*times,fy1+i*times,w,h,j);
01378 return(1);
01379 }
01380
01381 if ( current->win.discard_flag ) {
01382 lux_convert_coordsshort_rects(win, fx1, fy1, w, h, segs, segs, n);
01383
01384 if (current->win.pixmap)
01385 XFillRectangles(current->win.display, current->win.pixmap,
01386 current->win.gc, (XRectangle*)segs, n);
01387 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01388 XFillRectangles(current->win.display, current->win.window,
01389 current->win.gc, (XRectangle*)segs, n);
01390 XFlush(current->win.display);
01391 }
01392 return(1);
01393 }
01394
01395 if ( (newdata = get_newdata(current)) == (lux_data *)NULL ) {
01396 lux_convert_coordsshort_rects(win, fx1, fy1, w, h, segs, segs, n);
01397
01398 if (current->win.pixmap)
01399 XFillRectangles(current->win.display, current->win.pixmap,
01400 current->win.gc, (XRectangle*)segs, n);
01401 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01402 XFillRectangles(current->win.display, current->win.window,
01403 current->win.gc, (XRectangle*)segs, n);
01404 XFlush(current->win.display);
01405 }
01406 fprintf(stderr, "Can't fill rectanglesf because of not enough memory\n");
01407 return(0);
01408 }
01409
01410 newdata->data.i = (int *)malloc(sizeof(int)+
01411 (n*((times==4)?4:2)+2)*sizeof(float));
01412
01413 if (newdata->data.i == (int *)NULL) {
01414 if (n <= 10) {
01415 lux_convert_coordsshort_rects(win, fx1, fy1, w, h, segs, segs, n);
01416 if (current->win.pixmap)
01417 XFillRectangles(current->win.display, current->win.pixmap,
01418 current->win.gc, (XRectangle*)segs, n);
01419 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01420 XFillRectangles(current->win.display, current->win.window,
01421 current->win.gc, (XRectangle*)segs, n);
01422 XFlush(current->win.display);
01423 }
01424 fprintf(stderr, "\n Not enough memory in fill_rectanglesf\n");
01425 newdata->type = NOOP;
01426 return(0);
01427 }
01428 else {
01429 j = (int)(n/2);
01430 lux_fill_rectanglesf(win,fx1,fy1,w,h,j);
01431 lux_fill_rectanglesf(win,fx1+j*times,fy1+j*times,w,h,n-j);
01432 return(1);
01433 }
01434 }
01435
01436 lux_convert_coordsshort_rects(win, fx1, fy1, w, h, segs, segs, n);
01437
01438 if (current->win.pixmap)
01439 XFillRectangles(current->win.display, current->win.pixmap,
01440 current->win.gc, (XRectangle*)segs, n);
01441 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01442 XFillRectangles(current->win.display, current->win.window,
01443 current->win.gc, (XRectangle*)segs, n);
01444 XFlush(current->win.display);
01445 }
01446
01447 newdata->type = FILL_RECTANGLES_F;
01448
01449 newdata->data.u[0] = n;
01450 ptr = (float *)(&(newdata->data.i[1]));
01451 ptr[0] = w;
01452 ptr[1] = h;
01453
01454 if (fx1 == fy1)
01455 for(i=0;i<times*n;i++) ptr[i+2] = fx1[i];
01456 else
01457 for(i=0;i<n;i++) {
01458 ptr[i*2+2] = fx1[i];
01459 ptr[i*2+1+2] = fy1[i];
01460 }
01461 return(1);
01462 }
01463
01464 lux_refill_rectanglesf(win)
01465 Window win;
01466 {
01467 register lux_wins *current;
01468 float *ptrf;
01469 float w, h;
01470 unsigned int n;
01471
01472 current = get_currentwin(win);
01473
01474 n = (current->win.currentdata)->data.u[0];
01475 ptrf = (float *)(&((current->win.currentdata)->data.i[1]));
01476 w = ptrf[0];
01477 h = ptrf[1];
01478
01479 lux_convert_coordsshort_rects(win, &ptrf[2], &ptrf[2], w, h,
01480 (short *)segs, (short *)segs, n);
01481
01482 if (current->win.pixmap) {
01483 XFillRectangles(current->win.display, current->win.pixmap,
01484 redrawgc, (XRectangle*)segs, n);
01485 }
01486 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01487 XFillRectangles(current->win.display, current->win.window,
01488 redrawgc, (XRectangle*)segs, n);
01489 }
01490 return(1);
01491 }
01492
01493 lux_fill_rectanglef(win,fx,fy,w,h)
01494 Window win;
01495 float fx, fy, w, h;
01496 {
01497
01498 register lux_wins *current;
01499 register lux_data *newdata;
01500 register float *ptr;
01501 int x, y, width, height;
01502
01503 current = get_currentwin(win);
01504
01505 if ( current->win.discard_flag ) {
01506 lux_convert_coord_rect(win,fx,fy,w,h,&x,&y,&width,&height);
01507
01508 if (current->win.pixmap)
01509 XFillRectangle(current->win.display, current->win.pixmap,
01510 current->win.gc, x,y, width, height);
01511 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01512 XFillRectangle(current->win.display, current->win.window,
01513 current->win.gc, x,y, width, height);
01514 XFlush(current->win.display);
01515 }
01516 return(1);
01517 }
01518
01519 if ( (newdata = get_newdata(current)) == (lux_data *)NULL ) {
01520
01521 lux_convert_coord_rect(win,fx,fy,w,h,&x,&y,&width,&height);
01522
01523 if (current->win.pixmap)
01524 XFillRectangle(current->win.display, current->win.pixmap,
01525 current->win.gc, x,y, width, height);
01526 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01527 XFillRectangle(current->win.display, current->win.window,
01528 current->win.gc, x,y, width, height);
01529 XFlush(current->win.display);
01530 }
01531 fprintf(stderr, "Can't fill rectanglef because of not enough memory\n");
01532 return(0);
01533 }
01534
01535 newdata->data.f = (float *)malloc(4*sizeof(float));
01536
01537 if (newdata->data.i == (int *)NULL) {
01538
01539 lux_convert_coord_rect(win,fx,fy,w,h,&x,&y,&width,&height);
01540
01541 if (current->win.pixmap)
01542 XFillRectangle(current->win.display, current->win.pixmap,
01543 current->win.gc, x,y, width, height);
01544 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01545 XFillRectangle(current->win.display, current->win.window,
01546 current->win.gc, x,y, width, height);
01547 XFlush(current->win.display);
01548 }
01549 fprintf(stderr, "\n Not enough memory in fill_rectanglef\n");
01550 newdata->type = NOOP;
01551 return(0);
01552 }
01553
01554 lux_convert_coord_rect(win,fx,fy,w,h,&x,&y,&width,&height);
01555
01556 if (current->win.pixmap)
01557 XFillRectangle(current->win.display, current->win.pixmap,
01558 current->win.gc, x,y, width, height);
01559 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01560 XFillRectangle(current->win.display, current->win.window,
01561 current->win.gc, x,y, width, height);
01562 XFlush(current->win.display);
01563 }
01564
01565 newdata->type = FILL_RECTANGLE_F;
01566
01567 ptr = newdata->data.f;
01568 ptr[0] = fx;
01569 ptr[1] = fy;
01570 ptr[2] = w;
01571 ptr[3] = h;
01572
01573 return(1);
01574 }
01575
01576 lux_refill_rectanglef(win)
01577 Window win;
01578 {
01579 register lux_wins *current;
01580 float *ptrf;
01581 int x, y, width, height;
01582
01583
01584 current = get_currentwin(win);
01585
01586 ptrf = (current->win.currentdata)->data.f;
01587
01588 lux_convert_coord_rect(win, ptrf[0], ptrf[1], ptrf[2], ptrf[3],
01589 &x, &y, &width, &height);
01590
01591 if (current->win.pixmap) {
01592 XFillRectangle(current->win.display, current->win.pixmap,
01593 redrawgc, x, y, width, height);
01594 }
01595 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01596 XFillRectangle(current->win.display, current->win.window,
01597 redrawgc, x, y, width, height);
01598 }
01599 return(1);
01600 }
01601
01602 lux_fill_arcsf(win,fx1,fy1,w,h,a1,a2,n)
01603 Window win;
01604 float *fx1, *fy1, w, h,a1,a2;
01605 unsigned int n;
01606 {
01607
01608 register lux_wins *current;
01609 register lux_data *newdata;
01610 register int i,j;
01611 register float *ptr;
01612 unsigned int size, times;
01613
01614 current = get_currentwin(win);
01615
01616 size=(MAXDRAWSIZE>(XMAXREQUESTSIZE-3)/3)?(XMAXREQUESTSIZE-3)/3:MAXDRAWSIZE;
01617
01618
01619 if ((fx1 == fy1)&&(w<0.0||h<0.0)) times = 6;
01620 else if (fx1 == fy1) times = 2;
01621 else times = 1;
01622
01623 if (n > size) {
01624 j = n;
01625 for(i=0;i<n-size;i+=size) {
01626 j = j - size;
01627 lux_fill_arcsf(win,fx1+i*times,fy1+i*times,w,h,a1,a2,size);
01628 }
01629 lux_fill_arcsf(win,fx1+i*times,fy1+i*times,w,h,a1,a2,j);
01630 return(1);
01631 }
01632
01633 if ( current->win.discard_flag ) {
01634 lux_convert_coordsshort_arcs(win, fx1, fy1, w, h, a1, a2, segs, segs, n);
01635
01636 if (current->win.pixmap)
01637 XFillArcs(current->win.display, current->win.pixmap,
01638 current->win.gc, (XArc*)segs, n);
01639 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01640 XFillArcs(current->win.display, current->win.window,
01641 current->win.gc, (XArc*)segs, n);
01642 XFlush(current->win.display);
01643 }
01644 return(1);
01645 }
01646
01647 if ( (newdata = get_newdata(current)) == (lux_data *)NULL ) {
01648 lux_convert_coordsshort_arcs(win, fx1, fy1, w, h, a1, a2, segs, segs, n);
01649
01650 if (current->win.pixmap)
01651 XFillArcs(current->win.display, current->win.pixmap,
01652 current->win.gc, (XArc*)segs, n);
01653 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01654 XFillArcs(current->win.display, current->win.window,
01655 current->win.gc, (XArc*)segs, n);
01656 XFlush(current->win.display);
01657 }
01658 fprintf(stderr, "Can't fill arcsf because of not enough memory\n");
01659 return(0);
01660 }
01661
01662 newdata->data.i = (int *)malloc(sizeof(int)+
01663 (n*((times==6)?6:2)+4)*sizeof(float));
01664
01665 if (newdata->data.i == (int *)NULL) {
01666 if (n <= 10) {
01667 lux_convert_coordsshort_arcs(win, fx1, fy1, w, h,a1, a2, segs, segs, n);
01668 if (current->win.pixmap)
01669 XFillArcs(current->win.display, current->win.pixmap,
01670 current->win.gc, (XArc*)segs, n);
01671 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01672 XFillArcs(current->win.display, current->win.window,
01673 current->win.gc, (XArc*)segs, n);
01674 XFlush(current->win.display);
01675 }
01676 fprintf(stderr, "\n Not enough memory in fill_arcsf\n");
01677 newdata->type = NOOP;
01678 return(0);
01679 }
01680 else {
01681 j = (int)(n/2);
01682 lux_fill_arcsf(win,fx1,fy1,w,h,a1,a2,j);
01683 lux_fill_arcsf(win,fx1+j*times,fy1+j*times,w,h,a1,a2,n-j);
01684 return(1);
01685 }
01686 }
01687
01688 lux_convert_coordsshort_arcs(win, fx1, fy1, w, h, a1, a2, segs, segs, n);
01689
01690 if (current->win.pixmap)
01691 XFillArcs(current->win.display, current->win.pixmap,
01692 current->win.gc, (XArc*)segs, n);
01693 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01694 XFillArcs(current->win.display, current->win.window,
01695 current->win.gc, (XArc*)segs, n);
01696 XFlush(current->win.display);
01697 }
01698
01699 newdata->type = FILL_ARCS_F;
01700
01701 newdata->data.u[0] = n;
01702 ptr = (float *)(&(newdata->data.i[1]));
01703 ptr[0] = w;
01704 ptr[1] = h;
01705 ptr[2] = a1;
01706 ptr[3] = a2;
01707
01708 if (fx1 == fy1)
01709 for(i=0;i<times*n;i++) ptr[i+4] = fx1[i];
01710 else
01711 for(i=0;i<n;i++) {
01712 ptr[i*2+4] = fx1[i];
01713 ptr[i*2+1+4] = fy1[i];
01714 }
01715 return(1);
01716 }
01717
01718 lux_refill_arcsf(win)
01719 Window win;
01720 {
01721 register lux_wins *current;
01722 float *ptrf;
01723 unsigned int n;
01724
01725 current = get_currentwin(win);
01726
01727 n = (current->win.currentdata)->data.u[0];
01728 ptrf = (float *)(&((current->win.currentdata)->data.i[1]));
01729
01730 lux_convert_coordsshort_arcs(win, &ptrf[2], &ptrf[2], ptrf[0], ptrf[1],
01731 ptrf[2],ptrf[3],(short *)segs,(short *)segs, n);
01732
01733 if (current->win.pixmap) {
01734 XFillArcs(current->win.display, current->win.pixmap,
01735 redrawgc, (XArc*)segs, n);
01736 }
01737 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01738 XFillArcs(current->win.display, current->win.window,
01739 redrawgc, (XArc*)segs, n);
01740 }
01741 return(1);
01742 }
01743
01744 lux_fill_arcf(win,fx,fy,w,h,a1,a2)
01745 Window win;
01746 float fx, fy, w, h, a1,a2;
01747 {
01748
01749 register lux_wins *current;
01750 register lux_data *newdata;
01751 register float *ptr;
01752 int x, y, width, height, ia1, ia2;
01753
01754 current = get_currentwin(win);
01755
01756 if ( current->win.discard_flag ) {
01757 lux_convert_coord_arc(win,fx,fy,w,h,a1,a2,&x,&y,&width,&height,&ia1,&ia2);
01758
01759 if (current->win.pixmap)
01760 XFillArc(current->win.display, current->win.pixmap,
01761 current->win.gc, x,y, width, height,ia1,ia2);
01762 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01763 XFillArc(current->win.display, current->win.window,
01764 current->win.gc, x,y, width, height,ia1,ia2);
01765 XFlush(current->win.display);
01766 }
01767 return(1);
01768 }
01769
01770 if ( (newdata = get_newdata(current)) == (lux_data *)NULL ) {
01771
01772 lux_convert_coord_arc(win,fx,fy,w,h,a1,a2,&x,&y,&width,&height,&ia1,&ia2);
01773
01774 if (current->win.pixmap)
01775 XFillArc(current->win.display, current->win.pixmap,
01776 current->win.gc, x,y, width, height,ia1,ia2);
01777 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01778 XFillArc(current->win.display, current->win.window,
01779 current->win.gc, x,y, width, height,ia1,ia2);
01780 XFlush(current->win.display);
01781 }
01782 fprintf(stderr, "Can't fill arcf because of not enough memory\n");
01783 return(0);
01784 }
01785
01786 newdata->data.f = (float *)malloc(6*sizeof(float));
01787
01788 if (newdata->data.i == (int *)NULL) {
01789
01790 lux_convert_coord_arc(win,fx,fy,w,h,a1,a2,&x,&y,&width,&height,&ia1,&ia2);
01791
01792 if (current->win.pixmap)
01793 XFillArc(current->win.display, current->win.pixmap,
01794 current->win.gc, x,y, width, height,ia1,ia2);
01795 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01796 XFillArc(current->win.display, current->win.window,
01797 current->win.gc, x,y, width, height,ia1,ia2);
01798 XFlush(current->win.display);
01799 }
01800 fprintf(stderr, "\n Not enough memory in fill_arcf\n");
01801 newdata->type = NOOP;
01802 return(0);
01803 }
01804
01805
01806 lux_convert_coord_arc(win,fx,fy,w,h,a1,a2,&x,&y,&width,&height,&ia1,&ia2);
01807
01808 if (current->win.pixmap)
01809 XFillArc(current->win.display, current->win.pixmap,
01810 current->win.gc, x,y, width, height,ia1,ia2);
01811 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01812 XFillArc(current->win.display, current->win.window,
01813 current->win.gc, x,y, width, height,ia1,ia2);
01814 XFlush(current->win.display);
01815 }
01816
01817 newdata->type = FILL_ARC_F;
01818
01819 ptr = newdata->data.f;
01820 ptr[0] = fx;
01821 ptr[1] = fy;
01822 ptr[2] = w;
01823 ptr[3] = h;
01824 ptr[4] = a1;
01825 ptr[5] = a2;
01826
01827 return(1);
01828 }
01829
01830 lux_refill_arcf(win)
01831 Window win;
01832 {
01833 register lux_wins *current;
01834 float *ptrf;
01835 int x, y, width, height, a1, a2;
01836
01837
01838 current = get_currentwin(win);
01839
01840 ptrf = (current->win.currentdata)->data.f;
01841
01842 lux_convert_coord_arc(win, ptrf[0], ptrf[1], ptrf[2], ptrf[3], ptrf[4],
01843 ptrf[5], &x, &y, &width, &height, &a1, &a2);
01844
01845 if (current->win.pixmap) {
01846 XFillArc(current->win.display, current->win.pixmap,
01847 redrawgc, x, y, width, height, a1, a2);
01848 }
01849 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01850 XFillArc(current->win.display, current->win.window,
01851 redrawgc, x, y, width, height, a1, a2);
01852 }
01853 return(1);
01854 }
01855
01856 lux_fill_polygonf(win,fx,fy,n,mode)
01857 Window win;
01858 float *fx, *fy;
01859 unsigned int n;
01860 int mode;
01861 {
01862
01863 register lux_wins *current;
01864 register lux_data *newdata;
01865 register int i,j;
01866 register float *ptr;
01867 unsigned int size;
01868 int m;
01869
01870 current = get_currentwin(win);
01871
01872 size=(MAXDRAWSIZE>(XMAXREQUESTSIZE-3))?(XMAXREQUESTSIZE-3):MAXDRAWSIZE;
01873
01874 if (n>size) {
01875 fprintf(stderr,"ERR: Two many points in fill polygon\n Maximum points you can draw at one time is %u \n", size);
01876 return(0);
01877 }
01878
01879 if (mode == 2) m = CoordModePrevious;
01880 else m = CoordModeOrigin;
01881
01882 if ( current->win.discard_flag ) {
01883 lux_convert_coordsshort(win, fx, fy, segs, segs, n);
01884
01885 if (current->win.pixmap)
01886 XFillPolygon(current->win.display, current->win.pixmap,
01887 current->win.gc, (XPoint*)segs, n, Complex, m);
01888 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01889 XFillPolygon(current->win.display, current->win.window,
01890 current->win.gc, (XPoint*)segs, n, Complex, m);
01891 XFlush(current->win.display);
01892 }
01893 return(1);
01894 }
01895
01896 if ( (newdata = get_newdata(current)) == (lux_data *)NULL ) {
01897 lux_convert_coordsshort(win, fx, fy, segs, segs, n);
01898
01899 if (current->win.pixmap)
01900 XFillPolygon(current->win.display, current->win.pixmap,
01901 current->win.gc, (XPoint*)segs, n, Complex, m);
01902 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01903 XFillPolygon(current->win.display, current->win.window,
01904 current->win.gc, (XPoint*)segs, n, Complex, m);
01905 XFlush(current->win.display);
01906 }
01907 fprintf(stderr, "Can't fill polygon because of not enough memory\n");
01908 return(0);
01909 }
01910
01911 newdata->data.i = (int *)malloc(2*sizeof(int)+2*n*sizeof(float));
01912
01913 if (newdata->data.i == (int *)NULL) {
01914 lux_convert_coordsshort(win, fx, fy, segs, segs, n);
01915
01916 if (current->win.pixmap)
01917 XFillPolygon(current->win.display, current->win.pixmap,
01918 current->win.gc, (XPoint*)segs, n, Complex, m);
01919 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01920 XFillPolygon(current->win.display, current->win.window,
01921 current->win.gc, (XPoint*)segs, n, Complex, m);
01922 XFlush(current->win.display);
01923 }
01924 fprintf(stderr, "\n Not enough memory in fill polygon\n");
01925 newdata->type = NOOP;
01926 return(0);
01927 }
01928
01929 lux_convert_coordsshort(win, fx, fy, segs, segs, n);
01930
01931 if (current->win.pixmap)
01932 XFillPolygon(current->win.display, current->win.pixmap,
01933 current->win.gc, (XPoint*)segs, n, Complex, m);
01934 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01935 XFillPolygon(current->win.display, current->win.window,
01936 current->win.gc, (XPoint*)segs, n, Complex, m);
01937 XFlush(current->win.display);
01938 }
01939
01940 newdata->type = FILL_POLYGON_F;
01941
01942 newdata->data.u[0] = n;
01943 newdata->data.i[1] = m;
01944 ptr = (float *)(&(newdata->data.i[2]));
01945
01946 if (fx == fy)
01947 for(i=0;i<2*n;i++) ptr[i] = fx[i];
01948 else
01949 for(i=0;i<2*n;i+=2) {
01950 ptr[i] = fx[i/2];
01951 ptr[i+1] = fy[i/2];
01952 }
01953 return(1);
01954 }
01955
01956 lux_refill_polygonf(win)
01957 Window win;
01958 {
01959 register lux_wins *current;
01960 float *ptrf;
01961 int m; unsigned int n;
01962
01963 current = get_currentwin(win);
01964
01965 n = (current->win.currentdata)->data.u[0];
01966 m = (current->win.currentdata)->data.i[1];
01967 ptrf = (float *)(&((current->win.currentdata)->data.i[2]));
01968
01969 lux_convert_coordsshort(win, ptrf, ptrf, (short *)segs, (short *)segs, n);
01970
01971 if (current->win.pixmap) {
01972 XFillPolygon(current->win.display, current->win.pixmap,
01973 redrawgc, (XPoint*)segs, n, Complex, m);
01974 }
01975 if (current->win.update_flag || (current->win.pixmap == (Pixmap)NULL)) {
01976 XFillPolygon(current->win.display, current->win.window,
01977 redrawgc, (XPoint*)segs, n, Complex, m);
01978 }
01979 return(1);
01980 }
01981
01982 lux_set_window_bgcolor(win,i)
01983 Window win;
01984 unsigned long i;
01985 {
01986 register lux_wins *current;
01987 register lux_data *newdata;
01988
01989 current = get_currentwin(win);
01990
01991 XSetWindowBackground(current->win.display,current->win.window,i);
01992
01993 if ( current->win.discard_flag ) return(1);
01994
01995 if ( (newdata = get_newdata(current)) == (lux_data *)NULL )
01996 { fprintf(stderr, "Can't set backgroud because of not enough memory\n");
01997 return(0);}
01998
01999 newdata->data.l = (long *)malloc(sizeof(long));
02000
02001 if (newdata->data.l == (long *)NULL) {
02002 fprintf(stderr, "\n Not enough memory in set bgcolor\n");
02003 newdata->type = NOOP;
02004 return(0);
02005 }
02006
02007 newdata->type = SET_WINDOW_BG_COLOR;
02008 newdata->data.l[0] = i;
02009 return(1);
02010 }
02011
02012 lux_reset_window_bgcolor(win)
02013 Window win;
02014 {
02015 register lux_wins *current;
02016
02017 current = get_currentwin(win);
02018
02019 XSetWindowBackground(current->win.display, win,
02020 (current->win.currentdata)->data.l[0]);
02021 }
02022
02023 lux_set_bgcolor(win,i)
02024 Window win;
02025 unsigned long i;
02026 {
02027 register lux_wins *current;
02028 register lux_data *newdata;
02029
02030 current = get_currentwin(win);
02031
02032 XSetBackground(current->win.display,current->win.gc,i);
02033
02034 if ( current->win.discard_flag ) return(1);
02035
02036 if ( (newdata = get_newdata(current)) == (lux_data *)NULL )
02037 { fprintf(stderr, "Can't set backgroud because of not enough memory\n");
02038 return(0);}
02039
02040 newdata->data.l = (long *)malloc(sizeof(long));
02041
02042 if (newdata->data.l == (long *)NULL) {
02043 fprintf(stderr, "\n Not enough memory in set bgcolor\n");
02044 newdata->type = NOOP;
02045 return(0);
02046 }
02047
02048 newdata->type = SET_BG_COLOR;
02049 newdata->data.l[0] = i;
02050 return(1);
02051 }
02052
02053 lux_reset_bgcolor(win)
02054 Window win;
02055 {
02056 register lux_wins *current;
02057
02058 current = get_currentwin(win);
02059
02060 XSetBackground(current->win.display, redrawgc,
02061 (current->win.currentdata)->data.l[0]);
02062 }
02063
02064 lux_set_color(win,i)
02065 Window win;
02066 unsigned long i;
02067 {
02068 register lux_wins *current;
02069 register lux_data *newdata;
02070
02071 current = get_currentwin(win);
02072
02073 XSetForeground(current->win.display, current->win.gc, i);
02074
02075 if ( current->win.discard_flag ) return(1);
02076
02077 if ( (newdata = get_newdata(current)) == (lux_data *)NULL )
02078 { fprintf(stderr, "Can't set color width because of not enough memory\n");
02079 return(0);}
02080
02081 newdata->data.ul = (unsigned long *)malloc(sizeof(long));
02082
02083 if (newdata->data.ul == (unsigned long *)NULL) {
02084 fprintf(stderr, "\n Not enough memory in set color\n");
02085 newdata->type = NOOP;
02086 return(0);
02087 }
02088
02089 newdata->type = SET_COLOR;
02090 newdata->data.ul[0] = i;
02091 return(1);
02092 }
02093
02094 lux_reset_color(win)
02095 Window win;
02096 {
02097 register lux_wins *current;
02098
02099 current = get_currentwin(win);
02100
02101 XSetForeground(current->win.display, redrawgc,
02102 (current->win.currentdata)->data.ul[0]);
02103 }
02104
02105 unsigned long lux_get_fgcolor(win)
02106 Window win;
02107 {
02108 register lux_wins *current;
02109 XGCValues values;
02110
02111 current = get_currentwin(win);
02112
02113 XGetGCValues(current->win.display, current->win.gc,
02114 GCForeground, &values);
02115 return(values.foreground);
02116 }
02117
02118 unsigned long lux_get_bgcolor(win)
02119 Window win;
02120 {
02121 register lux_wins *current;
02122 XGCValues values;
02123
02124 current = get_currentwin(win);
02125
02126 XGetGCValues(current->win.display, current->win.gc,
02127 GCBackground, &values);
02128 return(values.background);
02129 }
02130
02131 lux_set_update(win)
02132 Window win;
02133 {
02134 register lux_wins *current;
02135 register lux_data *newdata;
02136
02137 current = get_currentwin(win);
02138
02139 current->win.update_flag = 1;
02140
02141 if ( current->win.discard_flag ) return(1);
02142
02143 if ( (newdata = get_newdata(current)) == (lux_data *)NULL )
02144 { fprintf(stderr, "Can't set backgroud because of not enough memory\n");
02145 return(0);}
02146
02147 newdata->type = SET_UPDATE;
02148 return(1);
02149 }
02150
02151 lux_reset_update(win)
02152 Window win;
02153 {
02154 register lux_wins *current;
02155
02156 current = get_currentwin(win);
02157
02158 current->win.update_flag = 1;
02159 }
02160
02161 lux_set_discard(win)
02162 Window win;
02163 {
02164 register lux_wins *current;
02165
02166 current = get_currentwin(win);
02167
02168 current->win.discard_flag = 1;
02169 }
02170
02171 lux_set_save(win)
02172 Window win;
02173 {
02174 register lux_wins *current;
02175
02176 current = get_currentwin(win);
02177
02178 current->win.discard_flag = 0;
02179 }
02180
02181 lux_set_noupdate(win)
02182 Window win;
02183 {
02184 register lux_wins *current;
02185 register lux_data *newdata;
02186
02187 current = get_currentwin(win);
02188
02189 current->win.update_flag = 0;
02190
02191 if ( current->win.discard_flag ) return(1);
02192
02193 if ( (newdata = get_newdata(current)) == (lux_data *)NULL )
02194 { fprintf(stderr, "Can't set backgroud because of not enough memory\n");
02195 return(0);}
02196
02197 newdata->type = SET_NO_UPDATE;
02198 return(1);
02199 }
02200
02201 lux_reset_noupdate(win)
02202 Window win;
02203 {
02204 register lux_wins *current;
02205
02206 current = get_currentwin(win);
02207
02208 current->win.update_flag = 0;
02209 }