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

Comparing ray/src/px/ra_ps.c (file contents):
Revision 2.30 by greg, Thu Aug 2 18:33:47 2018 UTC vs.
Revision 2.35 by greg, Sat Jun 7 05:09:46 2025 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   *  Radiance picture to PostScript file translator -- one way!
6   */
7  
8 #include  <stdio.h>
9 #include  <string.h>
8   #include  <math.h>
9   #include  <ctype.h>
10  
# Line 52 | Line 50 | int  docolor = 1;                      /* produce color image? */
50   int  bradj = 0;                         /* brightness adjustment */
51   int  ncopies = 1;                       /* number of copies */
52  
55 char  *progname;
53   int  xmax, ymax;                        /* input image dimensions */
54  
55   typedef void putprimf_t(COLR *scn, int pri);
# Line 60 | Line 57 | typedef void putprimf_t(COLR *scn, int pri);
57   static gethfunc headline;
58   static putprimf_t Aputprim, Bputprim, Cputprim;
59  
60 < static double unit2inch(register char *s);
60 > static double unit2inch(char *s);
61   static int matchid(char *name, char *id);
62   static void parsepaper(char *ps);
63   static void quiterr(char *err);
# Line 82 | Line 79 | headline(              /* check header line */
79   {
80          char  fmt[MAXFMTLEN];
81  
82 <        if (isformat(s)) {
83 <                formatval(fmt, s);
84 <                wrongformat = strcmp(fmt, COLRFMT);
88 <        } else if (isaspect(s))
82 >        if (formatval(fmt, s))
83 >                wrongformat = strcmp(fmt, COLRFMT) && strcmp(fmt, SPECFMT);
84 >        else if (isaspect(s))
85                  pixaspect *= aspectval(s);
86 +        else if (isncomp(s))
87 +                NCSAMP = ncompval(s);
88 +        else if (iswlsplit(s))
89 +                wlsplitval(WLPART, s);
90          return(0);
91   }
92  
# Line 96 | Line 96 | main(int  argc, char  *argv[])
96          int  i;
97          double  d;
98          
99 <        progname = argv[0];
99 >        fixargv0(argv[0]);              /* assigns progname */
100  
101          for (i = 1; i < argc; i++)
102                  if (argv[i][0] == '-')
# Line 198 | Line 198 | userr:
198  
199   static double
200   unit2inch(              /* determine unit */
201 <        register char   *s
201 >        char    *s
202   )
203   {
204          static struct unit {char n; float f;} u[] = {
# Line 206 | Line 206 | unit2inch(             /* determine unit */
206                  {'m', 1./25.4},
207                  {'c', 1./2.54},
208                  {'\0',0} };
209 <        register struct unit    *up;
209 >        struct unit     *up;
210  
211          while (*s && !isalpha(*s))
212                  s++;
# Line 220 | Line 220 | unit2inch(             /* determine unit */
220   static int
221   matchid(        /* see if name matches id (case insensitive) */
222          char    *name,
223 <        register char   *id
223 >        char    *id
224   )
225   {
226 <        register char   *s = name;
226 >        char    *s = name;
227  
228          while (*s) {
229                  if (isalpha(*s)) {
# Line 263 | Line 263 | parsepaper(            /* determine paper size from name */
263                  {"DL", 4.33, 8.66},
264                  {"hagaki", 3.94, 5.83},
265                  {"",0.0,0.0} };
266 <        register struct psize   *pp;
267 <        register char   *s = ps;
266 >        struct psize    *pp;
267 >        char    *s = ps;
268          double  d;
269  
270          if (isdigit(*s)) {              /* check for WWxHH specification */
# Line 427 | Line 427 | PSprocdef(                     /* define PS procedure to read image */
427   )
428   {
429          short  itab[128];
430 <        register int  i;
430 >        int  i;
431                                  /* assign code values */
432          for (i = 0; i < 128; i++)       /* clear */
433                  itab[i] = -1;
# Line 466 | Line 466 | PSprocdef(                     /* define PS procedure to read image */
466   static void
467   ra2ps(void)                             /* convert Radiance scanlines to 6-bit */
468   {
469 <        register COLR   *scanin;
469 >        COLR    *scanin;
470          int     y;
471                                                  /* allocate scanline */
472          scanin = (COLR *)malloc(xmax*sizeof(COLR));
# Line 474 | Line 474 | ra2ps(void)                            /* convert Radiance scanlines to 6-bit
474                  quiterr("out of memory in ra2ps");
475                                                  /* convert image */
476          for (y = ymax-1; y >= 0; y--) {
477 <                if (freadcolrs(scanin, xmax, stdin) < 0)
477 >                if (fread2colrs(scanin, xmax, stdin, NCSAMP, WLPART) < 0)
478                          quiterr("error reading Radiance picture");
479 <                if (putprim == Cputprim || devgam != 1.) {
479 >                if ((putprim == Cputprim) | (devgam != 1.)) {
480                          if (bradj)                      /* adjust exposure */
481                                  shiftcolrs(scanin, xmax, bradj);
482                          colrs_gambs(scanin, xmax);      /* gamma compression */
# Line 505 | Line 505 | Aputprim(              /* put out hex ASCII primary from scanline
505   {
506          static char     hexdigit[] = "0123456789ABCDEF";
507          static int      col = 0;
508 <        register int    x, c;
508 >        int     x, c;
509  
510          for (x = 0; x < xmax; x++) {
511                  if (pri == GRY)
# Line 529 | Line 529 | Bputprim(              /* put out binary primary from scanline */
529          int     pri
530   )
531   {
532 <        register int    x, c;
532 >        int     x, c;
533  
534          for (x = 0; x < xmax; x++) {
535                  if (pri == GRY)
# Line 548 | Line 548 | Cputprim(              /* put out compressed primary from scanline
548          int     pri
549   )
550   {
551 <        register int    c;
552 <        register int    x;
551 >        int     c;
552 >        int     x;
553          int     lastc, cnt;
554  
555          lastc = -1; cnt = 0;
# Line 574 | Line 574 | Cputprim(              /* put out compressed primary from scanline
574  
575   static void
576   putrle(         /* put out cnt of cod */
577 <        register int    cnt,
578 <        register int    cod
577 >        int     cnt,
578 >        int     cod
579   )
580   {
581          static int      col = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines