ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/nwsdev.c
(Generate patch)

Comparing ray/src/rt/nwsdev.c (file contents):
Revision 1.2 by greg, Wed Jul 18 21:54:07 1990 UTC vs.
Revision 1.3 by greg, Tue Aug 21 16:29:35 1990 UTC

# Line 12 | Line 12 | static char SCCSid[] = "$SunId$ LBL";
12   #include "newsconstants.h"
13   #include "driver.h"
14   #include "nwsdev.h"
15 + #include "color.h"
16   char inputbuffer[256];
17   int pos;
18 < float gamma[257];
18 > int gamma[257];
19  
20   static int nws_close(),nws_clear(),nws_painter(),nws_getclick(),
21 <           nws_printer(),nws_getinput(),nws_flush(),nws_errout();
21 >           nws_printer(),nws_getinput(),nws_flush(),nws_errout(),
22 >           nws_gpainter();
23   static struct driver nws_driver =
24   {
25 <  nws_close,nws_clear,nws_painter,nws_getclick,
25 >  nws_close,nws_clear,nws_gpainter,nws_getclick,
26    nws_printer,nws_getinput,nws_flush,1.0
27   };
28  
# Line 47 | Line 49 | char *name,*id;
49    int wX,wY,wW,wH,i;
50    gamma[256]=1;
51    for(i=0;i<256;i++)
52 <   gamma[i]=minfrac+(1-minfrac)*pow(i/256.,1./gammacorrection);
52 >   gamma[i]=500*pow(i/256.,1./gammacorrection);
53    ps_open_PostScript();
54 +  sgicheck(&i);
55 +  if(i)nws_driver.paintr=nws_painter;
56    getthebox(&wX,&wY,&wW,&wH);
57    if(wW<100)wW=100;
58    if(wH<100+textareaheight)wH=100+textareaheight;
# Line 89 | Line 93 | char *msg;         /* my comments are so bogus */
93  
94   static int
95   nws_painter(col,xmin,ymin,xmax,ymax)
96 < float col[3];
96 > COLOR col;
97   int xmin,ymin,xmax,ymax;
98   {
99 +  box(xmin,ymin+textareaheight,xmax,ymax+textareaheight
100 +      ,(int)(500*col[RED]),(int)(500*col[GRN]),(int)(500*col[BLU]));
101 + }
102 + static int
103 + nws_gpainter(col,xmin,ymin,xmax,ymax)
104 + COLOR col;
105 + int xmin,ymin,xmax,ymax;
106 + {
107    int i;
108 <  float col2[3];
97 <  /* NeWS trashes the window if a float value less than 1/256 is sent
98 <     to it.  Therefore, weed out all such values first */
108 >  int col2[3];
109    for(i=0;i<3;i++)
110     {
111 <    col2[i]=col[i];
112 <    if(col2[i]>1)col2[i]=1;
113 <    col2[i]=gamma[(int)(col2[i]*256)];
111 >    col2[i]=256.*col[i];
112 >    if(col2[i]>255)col2[i]=255;
113 >    col2[i]=gamma[col2[i]];
114     }
115    box(xmin,ymin+textareaheight,xmax,ymax+textareaheight
116        ,col2[0],col2[1],col2[2]);
117   }
108
118   static int
119   nws_printer(orig) /* printer recognises \n as a linefeed */
120   char *orig;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines