| 15 | 
  | 
 | 
| 16 | 
  | 
#include  "color.h" | 
| 17 | 
  | 
 | 
| 18 | 
+ | 
#include  "resolu.h" | 
| 19 | 
+ | 
 | 
| 20 | 
  | 
#include  "random.h" | 
| 21 | 
  | 
 | 
| 22 | 
  | 
#include  "targa.h" | 
| 36 | 
  | 
 | 
| 37 | 
  | 
extern double  atof(), pow(); | 
| 38 | 
  | 
 | 
| 39 | 
< | 
double  gamma = 2.0;                    /* gamma correction */ | 
| 39 | 
> | 
double  gamma = 2.2;                    /* gamma correction */ | 
| 40 | 
  | 
 | 
| 41 | 
+ | 
int  bradj = 0;                         /* brightness adjustment */ | 
| 42 | 
+ | 
 | 
| 43 | 
  | 
char  *progname; | 
| 44 | 
  | 
 | 
| 45 | 
  | 
char  msg[128]; | 
| 71 | 
  | 
                        case '3': | 
| 72 | 
  | 
                                head.dataBits = 24; | 
| 73 | 
  | 
                                break; | 
| 74 | 
+ | 
                        case 'e': | 
| 75 | 
+ | 
                                if (argv[i+1][0] != '+' && argv[i+1][0] != '-') | 
| 76 | 
+ | 
                                        goto userr; | 
| 77 | 
+ | 
                                bradj = atoi(argv[++i]); | 
| 78 | 
+ | 
                                break; | 
| 79 | 
  | 
                        default: | 
| 80 | 
  | 
                                goto userr; | 
| 81 | 
  | 
                        } | 
| 107 | 
  | 
                printargs(i, argv, stdout); | 
| 108 | 
  | 
                fputformat(COLRFMT, stdout); | 
| 109 | 
  | 
                putchar('\n'); | 
| 110 | 
< | 
                fputresolu(YMAJOR|YDECR, head.x, head.y, stdout); | 
| 110 | 
> | 
                fprtresolu(head.x, head.y, stdout); | 
| 111 | 
  | 
                                        /* convert file */ | 
| 112 | 
  | 
                tg2ra(&head); | 
| 113 | 
  | 
        } else { | 
| 114 | 
  | 
                if (checkheader(stdin, COLRFMT, NULL) < 0 || | 
| 115 | 
< | 
                        fgetresolu(&head.x, &head.y, stdin) != (YMAJOR|YDECR)) | 
| 115 | 
> | 
                                fgetresolu(&head.x, &head.y, stdin) < 0) | 
| 116 | 
  | 
                        quiterr("bad picture file"); | 
| 117 | 
  | 
                                        /* assign header */ | 
| 118 | 
  | 
                head.textSize = 0; | 
| 128 | 
  | 
        } | 
| 129 | 
  | 
        exit(0); | 
| 130 | 
  | 
userr: | 
| 131 | 
< | 
        fprintf(stderr, "Usage: %s [-2|-3|-r][-g gamma] [input [output]]\n", | 
| 131 | 
> | 
        fprintf(stderr, "Usage: %s [-2|-3|-r][-g gamma][-e +/-stops] [input [output]]\n", | 
| 132 | 
  | 
                        progname); | 
| 133 | 
  | 
        exit(1); | 
| 134 | 
  | 
} | 
| 276 | 
  | 
                        } | 
| 277 | 
  | 
                } | 
| 278 | 
  | 
                gambs_colrs(scanline, hp->x); | 
| 279 | 
+ | 
                if (bradj) | 
| 280 | 
+ | 
                        shiftcolrs(scanline, hp->x, bradj); | 
| 281 | 
  | 
                if (fwritecolrs(scanline, hp->x, stdout) < 0) | 
| 282 | 
  | 
                        quiterr("error writing RADIANCE file"); | 
| 283 | 
  | 
        } | 
| 299 | 
  | 
        for (j = hp->y-1; j >= 0; j--) { | 
| 300 | 
  | 
                if (freadcolrs(inl, hp->x, stdin) < 0) | 
| 301 | 
  | 
                        quiterr("error reading RADIANCE file"); | 
| 302 | 
+ | 
                if (bradj) | 
| 303 | 
+ | 
                        shiftcolrs(inl, hp->x, bradj); | 
| 304 | 
  | 
                colrs_gambs(inl, hp->x); | 
| 305 | 
  | 
                if (hp->dataBits == 16) { | 
| 306 | 
  | 
                        register unsigned short  *dp; |