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.41 by greg, Mon Nov 27 21:00:14 2023 UTC vs.
Revision 2.45 by greg, Wed Jan 17 17:36:20 2024 UTC

# Line 21 | Line 21
21   *  to tristimulus should use scolor_rgb() or scolor_cie().
22   *
23   *  A new Radiance format is provided for spectral pictures,
24 < *  and spectral colors must be converted by caller using
25 < *  convertscolor() if the sampling doesn't match.
24 > *  and spectral colors must be converted by caller if the
25 > *  sampling doesn't match.
26   */
27   #ifndef _RAD_COLOR_H_
28   #define _RAD_COLOR_H_
# Line 107 | Line 107 | typedef float  COLORMAT[3][3]; /* color coordinate con
107  
108   #define  scolrblack(c)          memset(c,0,LSCOLR)
109  
110 < #define  scolorblack(c)         memset(c,0,sizeof(COLORV)*MAXCSAMP)
110 > #define  scolorblack(c)         memset(c,0,sizeof(COLORV)*NCSAMP)
111  
112   #define scolor_color(col,scol)  scolor2color(col,scol,NCSAMP,WLPART)
113   #define scolor_colr(clr,scol)   scolor2colr(clr,scol,NCSAMP,WLPART)
# Line 116 | Line 116 | typedef float  COLORMAT[3][3]; /* color coordinate con
116   #define scolr_color(col,sclr)   scolr2color(col,sclr,NCSAMP,WLPART)
117  
118   #define  sopcolor(sc1,op,c2)    {SCOLOR _sct;\
119 <                                        setscolor(_sct,c2[RED],c2[GRN],c2[BLU]);\
119 >                                  setscolor(_sct,(c2)[RED],(c2)[GRN],(c2)[BLU]);\
120                                          sopscolor(sc1,op,_sct);}
121  
122   #define  saddcolor(sc1,c2)      sopcolor(sc1,+=,c2)
# Line 244 | Line 244 | typedef float  COLORMAT[3][3]; /* color coordinate con
244                                  /* Number of spectral components */
245   #define  NCOMPSTR               "NCOMP="
246   #define  LNCOMPSTR              6
247 < #define  isncomp(hl)            (!strncmp(hl,NCOMPSTR,LNCOMPSTR))
247 > #define  isncomp(hl)            !strncmp(hl,NCOMPSTR,LNCOMPSTR)
248   #define  ncompval(hl)           atoi((hl)+LNCOMPSTR)
249   #define  fputncomp(nc,fp)       fprintf(fp,"%s%d\n",NCOMPSTR,nc)
250  
251                                  /* 4 wavelength partitions for (IR+)R,G,B(+UV) */
252   #define  WLSPLTSTR              "WAVELENGTH_SPLITS="
253   #define  LWLSPLTSTR             18
254 < #define  iswlsplit(hl)          (!strncmp(hl,WLSPLTSTR,LWLSPLTSTR))
254 > #define  iswlsplit(hl)          !strncmp(hl,WLSPLTSTR,LWLSPLTSTR)
255   #define  wlsplitval(w,hl)       (sscanf((hl)+LWLSPLTSTR,"%f %f %f %f",\
256                                          &(w)[0],&(w)[1],&(w)[2],&(w)[3]) == 4)
257   #define  fputwlsplit(w,fp)      fprintf(fp,"%s %g %g %g %g\n",WLSPLTSTR,\
# Line 260 | Line 260 | typedef float  COLORMAT[3][3]; /* color coordinate con
260                                  /* macros for exposures */
261   #define  EXPOSSTR               "EXPOSURE="
262   #define  LEXPOSSTR              9
263 < #define  isexpos(hl)            (!strncmp(hl,EXPOSSTR,LEXPOSSTR))
263 > #define  isexpos(hl)            !strncmp(hl,EXPOSSTR,LEXPOSSTR)
264   #define  exposval(hl)           atof((hl)+LEXPOSSTR)
265   #define  fputexpos(ex,fp)       fprintf(fp,"%s%.4e\n",EXPOSSTR,ex)
266  
267                                  /* macros for pixel aspect ratios */
268   #define  ASPECTSTR              "PIXASPECT="
269   #define  LASPECTSTR             10
270 < #define  isaspect(hl)           (!strncmp(hl,ASPECTSTR,LASPECTSTR))
270 > #define  isaspect(hl)           !strncmp(hl,ASPECTSTR,LASPECTSTR)
271   #define  aspectval(hl)          atof((hl)+LASPECTSTR)
272   #define  fputaspect(pa,fp)      fprintf(fp,"%s%f\n",ASPECTSTR,pa)
273  
274                                  /* macros for primary specifications */
275   #define  PRIMARYSTR             "PRIMARIES="
276   #define  LPRIMARYSTR            10
277 < #define  isprims(hl)            (!strncmp(hl,PRIMARYSTR,LPRIMARYSTR))
277 > #define  isprims(hl)            !strncmp(hl,PRIMARYSTR,LPRIMARYSTR)
278   #define  primsval(p,hl)         (sscanf((hl)+LPRIMARYSTR, \
279                                          "%f %f %f %f %f %f %f %f", \
280                                          &(p)[RED][CIEX],&(p)[RED][CIEY], \
# Line 292 | Line 292 | typedef float  COLORMAT[3][3]; /* color coordinate con
292                                  /* macros for color correction */
293   #define  COLCORSTR              "COLORCORR="
294   #define  LCOLCORSTR             10
295 < #define  iscolcor(hl)           (!strncmp(hl,COLCORSTR,LCOLCORSTR))
295 > #define  iscolcor(hl)           !strncmp(hl,COLCORSTR,LCOLCORSTR)
296   #define  colcorval(cc,hl)       sscanf((hl)+LCOLCORSTR,"%f %f %f", \
297                                          &(cc)[RED],&(cc)[GRN],&(cc)[BLU])
298   #define  fputcolcor(cc,fp)      fprintf(fp,"%s %f %f %f\n",COLCORSTR, \
# Line 370 | Line 370 | extern int     compxyzWBmat(COLORMAT mat, float wht1[2],
370   extern int      compxyz2rgbWBmat(COLORMAT mat, RGBPRIMS pr);
371   extern int      comprgb2xyzWBmat(COLORMAT mat, RGBPRIMS pr);
372   extern int      comprgb2rgbWBmat(COLORMAT mat, RGBPRIMS pr1, RGBPRIMS pr2);
373 +                                        /* any uniform spectrum to working */
374 + extern void     convertscolorcol(SCOLOR rcol, const COLORV src[], int snc,
375 +                                        double swl0, double swl1);
376                                          /* most accurate spectral->tristim */
377   extern void     scolor2cie(COLOR col, SCOLOR scol, int ncs, const float wlpt[4]);
378   extern void     scolor2rgb(COLOR col, SCOLOR scol, int ncs, const float wlpt[4]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines