ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/Development/ray/src/px/ximage.c
(Generate patch)

Comparing ray/src/px/ximage.c (file contents):
Revision 1.12 by greg, Fri Oct 20 20:36:10 1989 UTC vs.
Revision 1.15 by greg, Wed Nov 29 16:50:39 1989 UTC

# Line 29 | Line 29 | static char SCCSid[] = "$SunId$ LBL";
29  
30   #include  "pic.h"
31  
32 + #include  "random.h"
33 +
34   #define  controlshift(e)        (((XButtonEvent *)(e))->detail & (ShiftMask|ControlMask))
35  
36   #define  FONTNAME       "9x15"          /* text font we'll use */
# Line 144 | Line 146 | char  *argv[];
146          if (fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR))
147                  quiterr("bad picture size");
148                                  /* set view parameters */
149 <        if (gotview)
149 >        if (gotview) {
150 >                ourview.hresolu = xmax;
151 >                ourview.vresolu = ymax;
152                  if (setview(&ourview) != NULL)
153                          gotview = 0;
154 <
154 >        }
155          if ((scanline = (COLR *)malloc(xmax*sizeof(COLR))) == NULL)
156                  quiterr("out of memory");
157  
# Line 358 | Line 362 | XKeyEvent  *ekey;
362   {
363          char  buf[80];
364          COLOR  cval;
365 +        Color  cvx;
366          char  *cp;
367          int  n;
368          double  comp;
# Line 368 | Line 373 | XKeyEvent  *ekey;
373                  return(0);
374          switch (*cp) {                  /* interpret command */
375          case 'q':
376 <        case CTRL(D):                           /* quiterr */
376 >        case CTRL(D):                           /* quit */
377                  quit(0);
378          case '\n':
379          case '\r':
# Line 395 | Line 400 | XKeyEvent  *ekey;
400                  XText(wind, box.xmin, box.ymin, buf, strlen(buf),
401                                  fontid, BlackPixel, WhitePixel);
402                  return(0);
403 +        case 'i':                               /* identify (contour) */
404 +                if (ourras->ncolors == 0)
405 +                        return(-1);
406 +                n = ourras->data.bz[ekey->x-xoff+BZPixmapSize(xmax,ekey->y-yoff)];
407 +                n = ourras->pmap[n];
408 +                cvx.pixel = ourras->cdefs[n].pixel;
409 +                cvx.red = random() & 65535;
410 +                cvx.green = random() & 65535;
411 +                cvx.blue = random() & 65535;
412 +                XStoreColor(&cvx);
413 +                return(0);
414          case 'p':                               /* position */
415                  sprintf(buf, "(%d,%d)", ekey->x-xoff, ymax-1-ekey->y+yoff);
416                  XText(wind, ekey->x, ekey->y, buf, strlen(buf),
# Line 429 | Line 445 | XKeyEvent  *ekey;
445          case CTRL(R):                           /* redraw */
446          case CTRL(L):
447                  XClear(wind);
448 +                XStoreColors(ourras->ncolors, ourras->cdefs);
449                  return(redraw(0, 0, width, height));
450          case ' ':                               /* clear */
451                  return(redraw(box.xmin, box.ymin, box.xsiz, box.ysiz));
# Line 651 | Line 668 | register rgbpixel  *l3;
668          if (getscan(y) < 0)
669                  quiterr("cannot seek for picreadline");
670                                                          /* convert scanline */
671 +        if (scale != 0)
672 +                for (i = 0; i < xmax; i++)
673 +                        if (scanline[i][EXP]+scale >= 0)
674 +                                scanline[i][EXP] += scale;
675          normcolrs(scanline, xmax);
676          for (i = 0; i < xmax; i++) {
677                  l3[i].r = scanline[i][RED];

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)