[comp.lang.postscript] readhexstring problem

rdargahi@meyerhof.iaims.bcm.tmc.edu (Ross Dargahi) (12/28/90)

/picstr 1 string def

12 12 1 [12 0 0 12 0 12] {currentfile picstr readhexstring pop} image
<image data here>

when i use the above code the image is rendered  correctly, but if I change the
length of picstr to anything other than one (I tried several values) the code ceases to work, what am I doing wrong? what values could I use for the length of picstr?

Please note that the height and width of the image can vary greatly from a few points
to hundreds of points. I used 12 just for illustrative purposes.

Thanx

Ross
--
********************************************************************************
ALL OPINIONS EXPRESSED ARE THOSE OF THE AUTHOR AND IN NO WAY DO THEY EXPRESS
THE OPINIONS OF THE BAYLOR COLLEGE OF MEDICINE - WRITTEN OR OTHERWISE.
********************************************************************************

gopstein@helix.squibb.com (Rich Gopstein) (12/29/90)

In article <3390@gazette.bcm.tmc.edu> rdargahi@meyerhof.iaims.bcm.tmc.edu (Ross Dargahi) writes:
>
>/picstr 1 string def
>
>12 12 1 [12 0 0 12 0 12] {currentfile picstr readhexstring pop} image
><image data here>
>
>when i use the above code the image is rendered  correctly, but if I change the
>length of picstr to anything other than one (I tried several values)
>the code ceases to work, what am I doing wrong? what values could
>I use for the length of picstr?
>


Image calls readhexstring repeatedly until it has enough data for the
image.  Readhexstring reads data into picstr skipping over bogus
characters until picstr is full.  The problem occurs when the number
of bytes required to describe the image (keeping in mind that each
row must start on a byte boundary), is not an even multiple of
the length of picstr.

If the image size is not a multiple of picstr's length, the last call
to readhexstring will grab some or all of the command after the image
data (usually showpage).

It turns out that the line length of the image data in the file is
not important since readhexstring skips over line breaks.  It also
doesn't matter what the width in pixels of the image is, since
image doesn't care if a new scan line starts in the middle of
a picstr.




--
Rich Gopstein

gopstein@squibb.com
rutgers!squibb.com!gopstein