ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/color.h
(Generate patch)

Comparing ray/src/common/color.h (file contents):
Revision 2.14 by greg, Tue Apr 15 14:12:31 1997 UTC vs.
Revision 2.22 by greg, Fri Jun 27 06:53:21 2003 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1997 Regents of the University of California */
2 <
3 < /* SCCSid "$SunId$ LBL" */
4 <
1 > /* RCSid $Id$ */
2   /*
3   *  color.h - header for routines using pixel color values.
4   *
5 < *     12/31/85
5 > *  Must be included after X11 headers, since they declare a BYTE type.
6   *
7   *  Two color representations are used, one for calculation and
8   *  another for storage.  Calculation is done with three floats
9   *  for speed.  Stored color values use 4 bytes which contain
10   *  three single byte mantissas and a common exponent.
11   */
12 + #ifndef _RAD_COLOR_H_
13 + #define _RAD_COLOR_H_
14 + #ifdef __cplusplus
15 + extern "C" {
16 + #endif
17  
18 + #include <stdio.h>
19 + #include <stdlib.h>
20 +
21   #define  RED            0
22   #define  GRN            1
23   #define  BLU            2
# Line 23 | Line 28
28   #define  COLXS          128     /* excess used for exponent */
29   #define  WHT            3       /* used for RGBPRIMS type */
30  
31 < typedef unsigned char  BYTE;    /* 8-bit unsigned integer */
31 > #undef  BYTE
32 > #define  BYTE   unsigned char   /* 8-bit unsigned integer */
33  
34   typedef BYTE  COLR[4];          /* red, green, blue (or X,Y,Z), exponent */
35  
# Line 174 | Line 180 | typedef float  COLORMAT[3][3]; /* color coordinate con
180   #define  fputcolcor(cc,fp)      fprintf(fp,"%s %f %f %f\n",COLCORSTR, \
181                                          (cc)[RED],(cc)[GRN],(cc)[BLU])
182  
177 #ifdef  DCL_ATOF
178 extern double  atof(), ldexp(), frexp();
179 #endif
180
183   /*
184   * Conversions to and from XYZ space generally don't apply WHTEFFICACY.
185   * If you need Y to be luminance (cd/m^2), this must be applied when
186   * converting from radiance (watts/sr/m^2).
187   */
188  
189 < extern RGBPRIMS  stdprims;              /* standard primary chromaticities */
190 < extern COLORMAT  rgb2xyzmat;            /* RGB to XYZ conversion matrix */
191 < extern COLORMAT  xyz2rgbmat;            /* XYZ to RGB conversion matrix */
192 < extern COLOR  cblack, cwhite;           /* black (0,0,0) and white (1,1,1) */
189 > extern RGBPRIMS  stdprims;      /* standard primary chromaticities */
190 > extern COLORMAT  rgb2xyzmat;    /* RGB to XYZ conversion matrix */
191 > extern COLORMAT  xyz2rgbmat;    /* XYZ to RGB conversion matrix */
192 > extern COLOR  cblack, cwhite;   /* black (0,0,0) and white (1,1,1) */
193  
194   #define  CGAMUT_LOWER           01
195   #define  CGAMUT_UPPER           02
# Line 196 | Line 198 | extern COLOR  cblack, cwhite;          /* black (0,0,0) and wh
198   #define  rgb_cie(xyz,rgb)       colortrans(xyz,rgb2xyzmat,rgb)
199  
200   #ifdef BSD
201 < #define  cpcolormat(md,ms)      bcopy((char *)ms,(char *)md,sizeof(COLORMAT))
201 > #define  cpcolormat(md,ms)      bcopy((void *)ms,(void *)md,sizeof(COLORMAT))
202   #else
203 < extern char  *memcpy();
202 < #define  cpcolormat(md,ms)      (void)memcpy((char *)md,(char *)ms,sizeof(COLORMAT))
203 > #define  cpcolormat(md,ms)      memcpy((void *)md,(void *)ms,sizeof(COLORMAT))
204   #endif
205 +
206 +                                        /* defined in color.c */
207 + extern char     *tempbuffer(unsigned int len);
208 + extern int      fwritecolrs(COLR *scanline, int len, FILE *fp);
209 + extern int      freadcolrs(COLR *scanline, int len, FILE *fp);
210 + extern int      fwritescan(COLOR *scanline, int len, FILE *fp);
211 + extern int      freadscan(COLOR *scanline, int len, FILE *fp);
212 + extern void     setcolr(COLR clr, double r, double g, double b);
213 + extern void     colr_color(COLOR col, COLR clr);
214 + extern int      bigdiff(COLOR c1, COLOR c2, double md);
215 +                                        /* defined in spec_rgb.c */
216 + extern void     spec_rgb(COLOR col, int s, int e);
217 + extern void     spec_cie(COLOR col, int s, int e);
218 + extern void     cie_rgb(COLOR rgb, COLOR xyz);
219 + extern int      clipgamut(COLOR col, double brt, int gamut,
220 +                                COLOR lower, COLOR upper);
221 + extern void     colortrans(COLOR c2, COLORMAT mat, COLOR c1);
222 + extern void     multcolormat(COLORMAT m3, COLORMAT m2,
223 +                                        COLORMAT m1);
224 + extern void     compxyz2rgbmat(COLORMAT mat, RGBPRIMS pr);
225 + extern void     comprgb2xyzmat(COLORMAT mat, RGBPRIMS pr);
226 + extern void     comprgb2rgbmat(COLORMAT mat, RGBPRIMS pr1, RGBPRIMS pr2);
227 + extern void     compxyzWBmat(COLORMAT mat, float wht1[2],
228 +                                float wht2[2]);
229 + extern void     compxyz2rgbWBmat(COLORMAT mat, RGBPRIMS pr);
230 + extern void     comprgb2xyzWBmat(COLORMAT mat, RGBPRIMS pr);
231 + extern void     comprgb2rgbWBmat(COLORMAT mat, RGBPRIMS pr1, RGBPRIMS pr2);
232 +                                        /* defined in colrops.c */
233 + extern int      setcolrcor(double (*f)(), double a2);
234 + extern int      setcolrinv(double (*f)(), double a2);
235 + extern int      setcolrgam(double g);
236 + extern int      colrs_gambs(COLR *scan, int len);
237 + extern int      gambs_colrs(COLR *scan, int len);
238 + extern void     shiftcolrs(COLR *scan, int len, int adjust);
239 + extern void     normcolrs(COLR *scan, int len, int adjust);
240 +
241 +
242 + #ifdef __cplusplus
243 + }
244 + #endif
245 + #endif /* _RAD_COLOR_H_ */
246 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines