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.10 by greg, Mon Oct 4 17:44:22 2004 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 211 | Line 210 | quiterr(const char *err)
210   static int
211   headline(char *s, void *p)
212   {
213 <        char    fmt[32];
213 >        char    fmt[MAXFMTLEN];
214  
215          if (formatval(fmt, s)) {        /* check if format string */
216                  if (!strcmp(fmt,COLRFMT))
# 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--; ) {
# Line 352 | Line 362 | tmap2bmp(char *fnin, char *fnout, char *expec, RGBPRIM
362          BMPWriter       *wtr;
363          FILE            *fp;
364          int             xr, yr;
365 <        BYTE            *pa;
365 >        uby8            *pa;
366          int             i;
367                                          /* check tone-mapping spec */
368          i = strlen(expec);
# Line 397 | Line 407 | tmap2bmp(char *fnin, char *fnout, char *expec, RGBPRIM
407                  quiterr("cannot allocate writer structure");
408                                          /* write to BMP file */
409          while (wtr->yscan < yr) {
410 <                BYTE    *scn = pa + xr*((tmflags & TM_F_BW) ? 1 : 3)*
410 >                uby8    *scn = pa + xr*((tmflags & TM_F_BW) ? 1 : 3)*
411                                                  (yr-1 - wtr->yscan);
412                  if (tmflags & TM_F_BW)
413                          memcpy((void *)wtr->scanline, (void *)scn, xr);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines