new patch for psraster

Mike Khaw mkhaw at teknowledge-vaxc.arpa
Wed Nov 23 18:23:22 AEST 1988


I found that on printing multiple pages in a single run, the Postscript
put out by the psraster filter would make all pages after the first black.
In response to a question I posted to the net, Ned Batchelder
(betcheldern at hannah.dec.com) said that psraster should invert black/white
by inverting the data rather than using "{ 1 exch sub} settransfer", and
also said that the order of "showpage" and "grestore" should be reversed.

I've implemented his suggestions and cleaned up the spelling in the
comments for psraster.c.  I've also substituted a color to greyscale
mapping function
	0.299R + 0.587G + 0.11B
for the original
	sqrt( (R^2 + G^2 + B^2) / 3) )
in the form of a #if ... #else ... #endif clause. The following patch
should apply to the unpatched version 2.3 psraster.c.

<--- cut here --->
*** /tmp/geta25986      Wed Aug 24 19:30:53 1988
--- /tmp/getb25986      Wed Aug 24 19:31:03 1988
***************
*** 117,123 ****
        Canvas.off_y = -1;


!       for (; optind < argc; optind++) {

                /*
                 * Process argc/argv.
--- 117,123 ----
        Canvas.off_y = -1;


!       for (; optind < argc || optind == 1; optind++) {

                /*
                 * Process argc/argv.
***************
*** 374,380 ****
        (void) fprintf(stderr, "Image size %d %d, offset %d %d\n",
                  Bounds.size_x, Bounds.size_y, Bounds.off_x, Bounds.off_y);
  #endif
!       (void) fprintf(outfile, "%%%%BoundingBox [ %d %d %d %d ]\n",
                       Bounds.off_x, Bounds.off_y,
                       Bounds.off_x + Bounds.size_x,
                       Bounds.off_y + Bounds.size_y);
--- 374,380 ----
        (void) fprintf(stderr, "Image size %d %d, offset %d %d\n",
                  Bounds.size_x, Bounds.size_y, Bounds.off_x, Bounds.off_y);
  #endif
!       (void) fprintf(outfile, "%%%%BoundingBox: %d %d %d %d\n",
                       Bounds.off_x, Bounds.off_y,
                       Bounds.off_x + Bounds.size_x,
                       Bounds.off_y + Bounds.size_y);
<--- cut here --->

Mike Khaw
-- 
internet: mkhaw at teknowledge.arpa
uucp:	  {uunet|sun|ucbvax|decwrl|ames|hplabs}!mkhaw%teknowledge.arpa
hardcopy: Teknowledge Inc, 1850 Embarcadero Rd, POB 10119, Palo Alto, CA 94303



More information about the Comp.sys.sun mailing list