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

Comparing ray/src/rt/aed.c (file contents):
Revision 1.2 by greg, Mon Oct 2 17:12:34 1989 UTC vs.
Revision 2.4 by greg, Tue Feb 25 02:47:22 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1987 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  aed.c - driver for AED 512 terminal.
9 *
10 *     2/2/87
6   */
7  
8 + #include "copyright.h"
9 +
10   #include  <stdio.h>
11  
12   #include  "driver.h"
# Line 46 | Line 43 | static char SCCSid[] = "$SunId$ LBL";
43   #define string(s)       fputs(s, stdout)
44   #define flush()         fflush(stdout)
45  
46 < #define  GAMMA          2.2             /* exponent for color correction */
46 > #define  GAMMA          2.5             /* exponent for color correction */
47  
48 < #define  NCOLORS        244             /* our color table size */
48 > #define  NCOLORS        248             /* our color table size */
49   #define  MINPIX         8               /* minimum hardware color */
50  
51   #define  NCOLS          512             /* maximum # columns for output */
52 < #define  NROWS          512-COMHT       /* maximum # rows for output */
52 > #define  NROWS          483-COMHT       /* maximum # rows for output */
53   #define  COMHT          16              /* height of command line */
54   #define  COMCW          63              /* maximum chars on command line */
55  
59 static COLR  colrmap[256];              /* our color map */
60
61 static COLR  colrtbl[NCOLORS];          /* our color table */
62
63 static int  colres = 64;                /* color resolution */
64
56   int  aed_close(), aed_clear(), aed_paintr(),
57                  aed_getcur(), aed_comout(), aed_errout();
58  
59   static struct driver  aed_driver = {
60          aed_close, aed_clear, aed_paintr, aed_getcur,
61 <        aed_comout, NULL,
62 <        NCOLS, NROWS
61 >        aed_comout, NULL, NULL,
62 >        1.0, NCOLS, NROWS
63   };
64  
65  
66   struct driver *
67 < aed_init(name)                          /* open AED */
68 < char  *name;
67 > aed_init(name, id)                      /* open AED */
68 > char  *name, *id;
69   {
70          if (ttyset(&aed_driver, fileno(stdin)) < 0) {   /* set tty driver */
71 <                stderr_v("cannot access terminal\n");
71 >                eputs("cannot access terminal\n");
72                  return(NULL);
73          }
74          command(RST);                                   /* reset AED */
# Line 92 | Line 83 | char  *name;
83          byte(BLK); byte(WHT); byte(15);
84          command(SCP);
85          byte('+'); byte(0); byte(1);
86 <        make_cmap(GAMMA);                               /* make color map */
87 <        errvec = aed_errout;                            /* set error vector */
88 <        cmdvec = aed_errout;
89 <        if (wrnvec != NULL)
90 <                wrnvec = aed_errout;
86 >        make_gmap(GAMMA);                               /* make color map */
87 >        erract[USER].pf =                               /* set error vector */
88 >        erract[SYSTEM].pf =
89 >        erract[INTERNAL].pf =
90 >        erract[CONSISTENCY].pf = aed_errout;
91 >        erract[COMMAND].pf = aed_errout;
92 >        if (erract[WARNING].pf != NULL)
93 >                erract[WARNING].pf = aed_errout;
94          return(&aed_driver);
95   }
96  
# Line 104 | Line 98 | char  *name;
98   static
99   aed_close()                                     /* close AED */
100   {
101 <        errvec = stderr_v;                      /* reset error vector */
102 <        cmdvec = NULL;
103 <        if (wrnvec != NULL)
104 <                wrnvec = stderr_v;
101 >        erract[USER].pf =                       /* reset error vector */
102 >        erract[SYSTEM].pf =
103 >        erract[INTERNAL].pf =
104 >        erract[CONSISTENCY].pf = eputs;
105 >        erract[COMMAND].pf = NULL;
106 >        if (erract[WARNING].pf != NULL)
107 >                erract[WARNING].pf = wputs;
108          aedsetcap(0, 0);                        /* go to bottom */
109          command(SEC);
110          byte(WHT);                              /* white text */
# Line 123 | Line 120 | aed_clear(x, y)                                        /* clear AED */
120   int  x, y;
121   {
122          command(FFD);
123 <        maketab();                              /* init color table */
124 <        longwait(1);
123 >        new_ctab(NCOLORS);                      /* init color table */
124 >        flush();
125   }
126  
127  
# Line 133 | Line 130 | aed_paintr(col, xmin, ymin, xmax, ymax)                /* paint a re
130   COLOR  col;
131   int  xmin, ymin, xmax, ymax;
132   {
133 <        command(SEC);                                   /* draw rectangle */
134 <        byte(get_pixel(col)+MINPIX);
133 >        extern int  anewcolr();
134 >        int  ndx;
135 >
136 >        ndx = get_pixel(col, anewcolr);         /* calls anewcolr() */
137 >        command(SEC);                           /* draw rectangle */
138 >        byte(ndx+MINPIX);
139          aedsetcap(xmin, ymin+COMHT);
140          command(DFR);
141          aedcoord(xmax-1, ymax+(-1+COMHT));
# Line 253 | Line 254 | int  *xp, *yp;
254  
255  
256   static
257 < maketab()                               /* reinitialize the color table */
257 > anewcolr(index, r, g, b)                /* enter a color into our table */
258 > int  index;
259 > int  r, g, b;
260   {
261 <        extern COLR  *get_ctab();
262 <        register COLR  *ctab;
263 <        register int  i;
264 <
265 <        ctab = get_ctab(NCOLORS);       /* get colors */
266 <        command(SCT);                   /* set color table */
267 <        byte(MINPIX);                   /* starting index */
265 <        byte(NCOLORS&255);              /* number of colors (0==256) */
266 <        for (i = 0; i < NCOLORS; i++) {
267 <                byte(ctab[i][RED]);
268 <                byte(ctab[i][GRN]);
269 <                byte(ctab[i][BLU]);
270 <        }
261 >        command(SCT);
262 >        byte((index+MINPIX)&255);
263 >        byte(1);
264 >        byte(r);
265 >        byte(g);
266 >        byte(b);
267 >        flush();
268   }
269  
270  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines