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

Comparing ray/src/rt/colortab.c (file contents):
Revision 2.3 by greg, Mon Mar 8 12:37:21 1993 UTC vs.
Revision 2.8 by schorsch, Mon Jun 30 14:59:12 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 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   * colortab.c - allocate and control dynamic color table.
6   *
# Line 14 | Line 11 | static char SCCSid[] = "$SunId$ LBL";
11   *      histogram is cleared.  This algorithm
12   *      performs only as well as the next drawing's color
13   *      distribution is correlated to the last.
14 + *
15 + *  External symbols declared in drvier.h
16   */
17  
18 < #include "standard.h"
18 > #include "copyright.h"
19  
20 + #include <string.h>
21 +
22 + #include "standard.h"
23   #include "color.h"
24 +
25                                  /* histogram resolution */
26   #define NRED            24
27   #define NGRN            32
# Line 55 | Line 58 | static unsigned short  histo[NRED][NGRN][NBLU];
58                                  /* initial color cube boundary */
59   static int      CLRCUBE[3][2] = {{0,NRED},{0,NGRN},{0,NBLU}};
60  
61 < static int      split(), cut();
61 > static int      split();
62 > static void     cut();
63  
64  
65   int
# Line 68 | Line 72 | int    ncolors;
72                  return(0);
73                                  /* free old tables */
74          if (clrtab != NULL)
75 <                free((char *)clrtab);
75 >                free((void *)clrtab);
76          if (ctree != NULL)
77 <                free((char *)ctree);
77 >                free((void *)ctree);
78                                  /* get new tables */
79          for (treesize = 1; treesize < ncolors; treesize <<= 1)
80                  ;
# Line 82 | Line 86 | int    ncolors;
86                                  /* partition color space */
87          cut(ctree, 0, CLRCUBE, 0, ncolors);
88                                  /* clear histogram */
89 <        bzero((char *)histo, sizeof(histo));
89 >        memset((void *)histo, '\0', sizeof(histo));
90                                  /* return number of colors used */
91          return(ncolors);
92   }
# Line 91 | Line 95 | int    ncolors;
95   int
96   get_pixel(col, set_pixel)       /* get pixel for color */
97   COLOR   col;
98 < int     (*set_pixel)();
98 > void    (*set_pixel)();
99   {
96        extern char     errmsg[];
100          int     r, g, b;
101          int     cv[3];
102          register CNODE  *tp;
# Line 143 | Line 146 | int    (*set_pixel)();
146   }
147  
148  
149 + void
150   make_gmap(gam)                  /* make gamma correction map */
151   double  gam;
152   {
# Line 155 | Line 159 | double gam;
159   }
160  
161  
162 + void
163   set_cmap(rmap, gmap, bmap)      /* set custom color correction map */
164   BYTE    *rmap, *gmap, *bmap;
165   {
166 <        bcopy((char *)rmap, (char *)clrmap[RED], 256);
167 <        bcopy((char *)gmap, (char *)clrmap[GRN], 256);
168 <        bcopy((char *)bmap, (char *)clrmap[BLU], 256);
166 >        memcpy((void *)clrmap[RED], (void *)rmap, 256);
167 >        memcpy((void *)clrmap[GRN], (void *)gmap, 256);
168 >        memcpy((void *)clrmap[BLU], (void *)bmap, 256);
169   }
170  
171  
172 + void
173   map_color(rgb, col)             /* map a color to a byte triplet */
174   BYTE    rgb[3];
175   COLOR   col;
# Line 174 | Line 180 | COLOR  col;
180   }
181  
182  
183 < static
183 > static void
184   cut(tree, level, box, c0, c1)           /* partition color space */
185   register CNODE  *tree;
186   int     level;
# Line 189 | Line 195 | int    c0, c1;
195          }
196                                          /* split box */
197          *tree = split(box);
198 <        bcopy((char *)box, (char *)kb, sizeof(kb));
198 >        memcpy((void *)kb, (void *)box, sizeof(kb));
199                                                  /* do left (lesser) branch */
200          kb[prim(*tree)][1] = part(*tree);
201          cut(tree+(1<<level), level+1, kb, c0, (c0+c1)>>1);
# Line 207 | Line 213 | register int   box[3][2];
213   #define c0      r
214          register int    r, g, b;
215          int     pri;
216 <        int     t[HMAX], med;
216 >        long    t[HMAX], med;
217                                          /* find dominant axis */
218          pri = RED;
219          if (box[GRN][1]-box[GRN][0] > box[pri][1]-box[pri][0])

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines