ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/ra_pr24.c
(Generate patch)

Comparing ray/src/px/ra_pr24.c (file contents):
Revision 1.5 by greg, Thu Apr 18 14:35:40 1991 UTC vs.
Revision 1.6 by greg, Mon Apr 29 11:14:10 1991 UTC

# Line 69 | Line 69 | char  *argv[];
69                          quiterr("bad raster format");
70                  xmax = head.ras_width;
71                  ymax = head.ras_height;
72 <                if (head.ras_type != RT_STANDARD ||
73 <                                head.ras_maptype != RMT_NONE ||
74 <                                head.ras_depth != 24)
72 >                if ((head.ras_type != RT_STANDARD
73 >                                        && head.ras_type != RT_FORMAT_RGB)
74 >                                || head.ras_maptype != RMT_NONE
75 >                                || head.ras_depth != 24)
76                          quiterr("incompatible format");
77                                          /* put header */
78                  printargs(i, argv, stdout);
# Line 79 | Line 80 | char  *argv[];
80                  putchar('\n');
81                  fputresolu(YMAJOR|YDECR, xmax, ymax, stdout);
82                                          /* convert file */
83 <                pr2ra();
83 >                pr2ra(head.ras_type);
84          } else {
85                                          /* get header info. */
86                  if (checkheader(stdin, COLRFMT, NULL) < 0 ||
# Line 117 | Line 118 | char  *err;
118   }
119  
120  
121 < pr2ra()                 /* convert 24-bit scanlines to Radiance picture */
121 > pr2ra(rf)               /* convert 24-bit scanlines to Radiance picture */
122 > int     rf;
123   {
124          COLR    *scanout;
125          register int    x;
# Line 128 | Line 130 | pr2ra()                        /* convert 24-bit scanlines to Radiance pict
130                  quiterr("out of memory in pr2ra");
131                                                  /* convert image */
132          for (y = ymax-1; y >= 0; y--) {
133 <                for (x = 0; x < xmax; x++) {
134 <                        scanout[x][BLU] = getc(stdin);
135 <                        scanout[x][GRN] = getc(stdin);
136 <                        scanout[x][RED] = getc(stdin);
137 <                }
133 >                for (x = 0; x < xmax; x++)
134 >                        if (rf == RT_FORMAT_RGB) {
135 >                                scanout[x][RED] = getc(stdin);
136 >                                scanout[x][GRN] = getc(stdin);
137 >                                scanout[x][BLU] = getc(stdin);
138 >                        } else {
139 >                                scanout[x][BLU] = getc(stdin);
140 >                                scanout[x][GRN] = getc(stdin);
141 >                                scanout[x][RED] = getc(stdin);
142 >                        }
143                  if (feof(stdin) || ferror(stdin))
144                          quiterr("error reading rasterfile");
145                  gambs_colrs(scanout, xmax);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines