--- ray/src/common/color.h 1990/12/14 12:48:30 1.7 +++ ray/src/common/color.h 1991/03/18 09:32:49 1.9 @@ -48,6 +48,8 @@ typedef float COLOR[3]; /* red, green, blue */ #define normbright(c) (int)((67L*(c)[RED]+168L*(c)[GRN]+21L*(c)[BLU])/256) #endif +#define luminance(col) (683.0 * bright(col)) + #define intens(col) ( (col)[0] > (col)[1] \ ? (col)[0] > (col)[2] ? (col)[0] : (col)[2] \ : (col)[1] > (col)[2] ? (col)[1] : (col)[2] ) @@ -79,5 +81,14 @@ typedef float COLOR[3]; /* red, green, blue */ #define isaspect(hl) (!strncmp(hl,ASPECTSTR,ASPECTSTRL)) #define aspectval(hl) atof((hl)+ASPECTSTRL) #define fputaspect(pa,fp) fprintf(fp,"%s%f\n",ASPECTSTR,pa) + + /* macros for color correction */ +#define COLCORSTR "COLORCORR=" +#define COLCORSTRL 10 +#define iscolcor(hl) (!strncmp(hl,COLCORSTR,COLCORSTRL)) +#define colcorval(cc,hl) sscanf(hl+COLCORSTRL,"%f %f %f", \ + &(cc)[RED],&(cc)[GRN],&(cc)[BLU]) +#define fputcolcor(cc,fp) fprintf(fp,"%s %f %f %f\n",COLCORSTR, \ + (cc)[RED],(cc)[GRN],(cc)[BLU]) extern double ldexp(), atof();