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

Comparing ray/src/px/ra_bmp.c (file contents):
Revision 2.12 by greg, Thu Aug 2 18:33:46 2018 UTC vs.
Revision 2.15 by greg, Tue Sep 10 20:24:42 2024 UTC

# Line 5 | Line 5 | static const char RCSid[] = "$Id$";
5   *  program to convert between RADIANCE and Windows BMP file
6   */
7  
8 #include  <stdio.h>
8   #include  <math.h>
10 #include  <string.h>
9  
10 + #include  "rtio.h"
11   #include  "platform.h"
12   #include  "color.h"
13   #include  "tonemap.h"
# Line 220 | Line 219 | headline(char *s, void *p)
219                          rgbinp = TM_XYZPRIM;
220                          return(0);
221                  }
222 +                if (!strcmp(fmt,SPECFMT))
223 +                        return(0);
224                  return(-1);
225          }
226          if (isprims(s)) {               /* get input primaries */
# Line 227 | Line 228 | headline(char *s, void *p)
228                  rgbinp = myinprims;
229                  return(0);
230          }
231 +        if (isncomp(s)) {
232 +                NCSAMP = ncompval(s);
233 +                return(0);
234 +        }
235 +        if (iswlsplit(s)) {
236 +                wlsplitval(WLPART, s);
237 +                return(0);
238 +        }
239                                          /* should I grok colcorr also? */
240          return(0);
241   }
# Line 250 | Line 259 | rad2bmp(FILE *rfp, BMPWriter *bwr, int inv, RGBPRIMP m
259          usexfm = (monpri != NULL ? rgbinp != monpri :
260                          rgbinp != TM_XYZPRIM && rgbinp != stdprims);
261          if (usexfm) {
262 <                double  expcomp = pow(2.0, (double)bradj);
262 >                RGBPRIMP        destpri = monpri != NULL ? monpri : stdprims;
263 >                double          expcomp = pow(2.0, (double)bradj);
264                  if (rgbinp == TM_XYZPRIM)
265 <                        compxyz2rgbWBmat(xfm, monpri);
265 >                        compxyz2rgbWBmat(xfm, destpri);
266                  else
267 <                        comprgb2rgbWBmat(xfm, rgbinp, monpri);
267 >                        comprgb2rgbWBmat(xfm, rgbinp, destpri);
268                  for (y = 0; y < 3; y++)
269                          for (x = 0; x < 3; x++)
270                                  xfm[y][x] *= expcomp;
# Line 269 | Line 279 | rad2bmp(FILE *rfp, BMPWriter *bwr, int inv, RGBPRIMP m
279          }
280                                                  /* convert each scanline */
281          for ( ; y != yend; y += ystp) {
282 <                if (freadcolrs(scanin, bwr->hdr->width, rfp) < 0)
282 >                if (fread2colrs(scanin, bwr->hdr->width, rfp, NCSAMP, WLPART) < 0)
283                          quiterr("error reading Radiance picture");
284                  if (usexfm)
285                          for (x = bwr->hdr->width; x--; ) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines