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

Comparing ray/src/common/color.c (file contents):
Revision 2.29 by greg, Fri Nov 17 21:51:58 2023 UTC vs.
Revision 2.30 by greg, Tue Nov 21 01:30:20 2023 UTC

# Line 109 | Line 109 | scolor2color(                  /* assign RGB color from spectrum */
109          COLOR col,
110          SCOLOR scol,            /* uses average over bands */
111          int ncs,
112 <        float wlpt[4]
112 >        const float wlpt[4]
113   )
114   {
115          const double    step = (wlpt[3] - wlpt[0])/(double)ncs;
# Line 136 | Line 136 | scolor2colr(                   /* assign RGBE from spectral color */
136          COLR clr,
137          SCOLOR scol,            /* uses average over bands */
138          int ncs,
139 <        float wlpt[4]
139 >        const float wlpt[4]
140   )
141   {
142          COLOR   col;
# Line 488 | Line 488 | freadcolrs(                    /* read in an encoded colr scanline */
488   }
489  
490  
491 + /* read an nc-component common-exponent color scanline */
492   int
493 + freadscolrs(uby8 *scanline, int nc, int len, FILE *fp)
494 + {
495 +        if (fread(scanline, nc+1, len, fp) != len)
496 +                return(-1);
497 +        return(0);
498 + }
499 +
500 +
501 + /* write an common-exponent spectral color scanline (NCSAMP) */
502 + int
503 + fwritescolrs(uby8 *sscanline, int len, FILE *fp)
504 + {
505 +        if (fwrite(sscanline, LSCOLR, len, fp) != len)
506 +                return(-1);
507 +        return(0);
508 + }
509 +
510 +
511 + int
512   fwritescan(                     /* write out a scanline */
513          COLOR  *scanline,
514          int  len,
# Line 541 | Line 561 | freadscan(                     /* read in a scanline */
561                          colr_color(scanline[0], clrscan[0]);
562          }
563          return(0);
564 + }
565 +
566 +
567 + /* read an nc-component color scanline */
568 + int
569 + freadsscan(COLORV *sscanline, int nc, int len, FILE *fp)
570 + {
571 +        uby8    *tscn = (uby8 *)tempbuffer((nc+1)*len);
572 +        int     i;
573 +
574 +        if (tscn == NULL || freadscolrs(tscn, nc, len, fp) < 0)
575 +                return(-1);
576 +        for (i = len; i-- > 0; ) {
577 +                scolr2scolor(sscanline, tscn, nc);
578 +                sscanline += nc;
579 +                tscn += nc+1;
580 +        }
581 +        return(0);
582 + }
583 +
584 +
585 + /* write an spectral color scanline (NCSAMP) */
586 + int
587 + fwritesscan(COLORV *sscanline, int len, FILE *fp)
588 + {
589 +        uby8    *tscn = (uby8 *)tempbuffer(LSCOLR*len);
590 +        int     i;
591 +
592 +        if (tscn == NULL)
593 +                return(-1);
594 +        for (i = 0; i < len; i++) {
595 +                scolor2scolr(tscn+i*LSCOLR, sscanline, NCSAMP);
596 +                sscanline += NCSAMP;
597 +        }
598 +        return(fwritescolrs(tscn, len, fp));
599   }
600  
601  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines