--- ray/src/common/color.h 1990/12/14 12:48:30 1.7 +++ ray/src/common/color.h 1991/04/18 12:54:22 1.11 @@ -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) (470. * 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] ) @@ -66,6 +68,9 @@ typedef float COLOR[3]; /* red, green, blue */ #define YDECR 2 #define YMAJOR 4 + /* picture format identifier */ +#define COLRFMT "32-bit_rle_rgbe" + /* macros for exposures */ #define EXPOSSTR "EXPOSURE=" #define EXPOSSTRL 9 @@ -79,5 +84,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();