--- ray/src/common/ccolor.h 2012/05/17 05:47:59 3.2 +++ ray/src/common/ccolor.h 2012/05/18 20:43:13 3.5 @@ -1,4 +1,4 @@ -/* RCSid $Id: ccolor.h,v 3.2 2012/05/17 05:47:59 greg Exp $ */ +/* RCSid $Id: ccolor.h,v 3.5 2012/05/18 20:43:13 greg Exp $ */ /* * Header file for spectral colors. * @@ -43,20 +43,33 @@ typedef struct { C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV},\ (long)C_CNSS*C_CMAXV, 1./3., 1./3., 178.006 } -#define c_cval(c,l) ((double)(c)->ssamp[((l)-C_MINWL)/C_CWLI] / (c)->ssum) +#define c_cval(c,l) ((c)->ssamp[((l)+(C_CWLI/2.-C_MINWL))/C_CWLI] \ + / (double)(c)->ssum) extern C_COLOR c_dfcolor; /* default color */ -extern void c_ccvt(C_COLOR *, int); /* fix color representation */ -extern int c_isgrey(C_COLOR *); /* check if color is grey */ + /* set CIE (x,y) chromaticity */ +#define c_cset(c,x,y) ((c)->cx=(x),(c)->cy=(y),(c)->flags=C_CDXY|C_CSXY) + + /* set black body spectrum */ +extern int c_bbtemp(C_COLOR *clr, double tk); + /* assign arbitrary spectrum */ +extern double c_sset(C_COLOR *clr, double wlmin, double wlmax, + const float spec[], int nwl); +extern void c_ccvt(C_COLOR *clr, int fl); /* fix color representation */ +extern int c_isgrey(C_COLOR *clr); /* check if color is grey */ /* mix two colors */ extern void c_cmix(C_COLOR *cres, double w1, C_COLOR *c1, double w2, C_COLOR *c2); /* multiply two colors */ extern double c_cmult(C_COLOR *cres, C_COLOR *c1, double y1, C_COLOR *c2, double y2); - /* set black body spectrum */ -extern int c_bbtemp(C_COLOR *clr, double tk); + /* convert to sharpened RGB */ +extern void c_toSharpRGB(C_COLOR *cin, double cieY, float cout[3]); + /* convert from sharpened RGB */ +extern double c_fromSharpRGB(float cin[3], C_COLOR *cout); + +/* The following two routines are not defined in ccolor.c */ /* convert to RGB color */ extern void ccy2rgb(C_COLOR *cin, double cieY, float cout[3]); /* convert from RGB color */