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

Comparing ray/src/px/x11image.c (file contents):
Revision 2.13 by greg, Mon Oct 12 12:59:22 1992 UTC vs.
Revision 2.16 by greg, Thu Oct 22 17:51:05 1992 UTC

# Line 109 | Line 109 | extern long  ftell();
109  
110   extern char  *malloc(), *calloc();
111  
112 extern double  pow(), log();
113
112   Display  *thedisplay;
113  
114 +
115   main(argc, argv)
116   int  argc;
117   char  *argv[];
# Line 308 | Line 307 | char  *err;
307   }
308  
309  
311 eputs(s)
312 char    *s;
313 {
314        fputs(s, stderr);
315 }
316
317
318 quit(code)
319 int  code;
320 {
321        exit(code);
322 }
323
324
310   static int
311   viscmp(v1,v2)           /* compare visual to see which is better, descending */
312   register XVisualInfo    *v1, *v2;
# Line 740 | Line 725 | COLOR  clr;
725                  return(-1);
726          if (left == ll && right == lr && top == lt && bottom == lb) {
727                  copycolor(clr, lc);
728 <                return;
728 >                return(0);
729          }
730          for (y = top; y < bottom; y++) {
731                  if (getscan(y) == -1)
# Line 769 | Line 754 | getmono()                      /* get monochrome data */
754                  quiterr("out of memory in getmono");
755          dp = ourdata - 1;
756          for (y = 0; y < ymax; y++) {
757 <                if (getscan(y) < 0)
773 <                        quiterr("seek error in getmono");
774 <                normcolrs(scanline, xmax, scale);
757 >                getscan(y);
758                  add2icon(y, scanline);
759 +                normcolrs(scanline, xmax, scale);
760                  err = 0;
761                  for (x = 0; x < xmax; x++) {
762                          if (!(x&7))
# Line 798 | Line 782 | COLR  *scan;
782          static short  cerr[ICONSIZ];
783          static int  ynext;
784          static char  *dp;
785 +        double  sf;
786 +        COLOR  col;
787          register int  err;
788          register int    x, ti;
789          int  errp;
# Line 822 | Line 808 | COLR  *scan;
808          }
809          if (y < ynext*ymax/iconheight)  /* skip this one */
810                  return;
811 +        sf = pow(2.0, (double)(scale+8));
812          err = 0;
813          for (x = 0; x < iconwidth; x++) {
814                  if (!(x&7))
815                          *++dp = 0;
816                  errp = err;
817                  ti = x*xmax/iconwidth;
818 <                err += normbright(scan[ti]) + cerr[x];
818 >                colr_color(col, scan[ti]);
819 >                ti = sf*bright(col);
820 >                if (ti > 255) ti = 255;
821 >                err += ti + cerr[x];
822                  if (err > 127)
823                          err -= 255;
824                  else
# Line 850 | Line 840 | getfull()                      /* get full (24-bit) data */
840                                          /* read and convert file */
841          dp = (unsigned long *)ourdata;
842          for (y = 0; y < ymax; y++) {
843 <                if (getscan(y) < 0)
844 <                        quiterr("seek error in getfull");
843 >                getscan(y);
844 >                add2icon(y, scanline);
845                  if (scale)
846                          shiftcolrs(scanline, xmax, scale);
847                  colrs_gambs(scanline, xmax);
858                add2icon(y, scanline);
848                  if (ourras->image->blue_mask & 1)
849                          for (x = 0; x < xmax; x++)
850                                  *dp++ = scanline[x][RED] << 16 |
# Line 880 | Line 869 | getgrey()                      /* get greyscale data */
869                                          /* read and convert file */
870          dp = ourdata;
871          for (y = 0; y < ymax; y++) {
872 <                if (getscan(y) < 0)
873 <                        quiterr("seek error in getgrey");
872 >                getscan(y);
873 >                add2icon(y, scanline);
874                  if (scale)
875                          shiftcolrs(scanline, xmax, scale);
876                  colrs_gambs(scanline, xmax);
888                add2icon(y, scanline);
877                  if (maxcolors < 256)
878                          for (x = 0; x < xmax; x++)
879                                  *dp++ = ((long)normbright(scanline[x]) *
# Line 896 | Line 884 | getgrey()                      /* get greyscale data */
884          }
885          for (x = 0; x < maxcolors; x++)
886                  clrtab[x][RED] = clrtab[x][GRN] =
887 <                        clrtab[x][BLU] = (x*256+maxcolors/2)/maxcolors;
887 >                        clrtab[x][BLU] = ((long)x*256+maxcolors/2)/maxcolors;
888   }
889  
890  
# Line 910 | Line 898 | getmapped()                    /* get color-mapped data */
898          for (y = 0; y < ymax; y++) {
899                  if (getscan(y) < 0)
900                          quiterr("seek error in getmapped");
901 +                add2icon(y, scanline);
902                  if (scale)
903                          shiftcolrs(scanline, xmax, scale);
904                  colrs_gambs(scanline, xmax);
916                add2icon(y, scanline);
905                  cnt_colrs(scanline, xmax);
906          }
907                                          /* map pixels */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines