[mod.computers.laser-printers] Please help, Re: PostScript

BEC.HEFFRON@USC-ECL.ARPA.UUCP (01/14/87)

This is a request for help.
 I am trying to write a PostScript driver for the Xerox 11xx Interlisp-D
workstations, and I am having trouble with filling a region with a bitmap
texture.  When I specify a bitmap pattern to fill a region with, it does so
at what appears to be 1 bit per PHYSICAL pixel, instead of 1 bit per POINT,
which is what I want.  I am using the setpattern code from the PostScript 
Language Cookbook (at least I think I copied it accurately).  I suspect it
is somehow related to the "0.01 0.01 scale" of the whole job, but if so, I 
cannot see how to account for non-default-scale.  (If I must re-scale back to
the default, I don't know if it should be around the "setpattern" or the 
"eofill".)
 The PostScript below is edited from one of the tests I've been running. (I
think this is the minimal case which will reproduce the output.  I'm not sure
because I didn't try it, since the Apple LaserWriter is at another company
facility 5 miles away.)

Thanks in advance for any help,
Matt Heffron		BEC.HEFFRON@USC-ECL.ARPA

/saveobj1 save def
/concatprocs
 {/proc2 exch cvlit def
  /proc1 exch cvlit def
  /newproc proc1 length proc2 length add array def
  newproc 0 proc1 putinterval
  newproc proc1 length proc2 putinterval
  newproc cvx
 } def
/setuserscreendict 22 dict def
setuserscreendict begin
 /tempctm matrix def
 /temprot matrix def
 /tempscale matrix def
 /resmatrix matrix def
 /findresolution
  {72 0 resmatrix defaultmatrix dtransform
   /yres exch def /xres exch def
   xres dup mul yres dup mul add sqrt
  } def
end
/setuserscreen
 {setuserscreendict begin
   /spotfunction exch def
   /screenangle exch def
   /cellsize exch def
   /m tempctm currentmatrix def
   /rm screenangle temprot rotate def
   /sm cellsize dup tempscale scale def
   sm rm m m concatmatrix m concatmatrix pop
   1 0 m dtransform /y1 exch def /x1 exch def
   /veclength x1 dup mul y1 dup mul add sqrt def
   /frequency findresolution veclength div def
   /newscreenangle y1 x1 atan def
   m 2 get m 1 get mul m 0 get m 3 get mul sub
   0 gt { { neg } /spotfunction load concatprocs
          /spotfunction exch def } if
   frequency newscreenangle /spotfunction load setscreen
  end
 } def
/setpatterndict 18 dict def
setpatterndict begin
 /bitison
  {/ybit exch def /xbit exch def
   /bytevalue bstring ybit bwidth mul xbit 8 idiv add get def
   /mask 1 7 xbit 8 mod sub bitshift def
   bytevalue mask and 0 ne
  } def
end
/bitpatternspotfunction
 {setpatterndict begin
   /y exch def /x exch def
   /xindex x 1 add 2 div bpside mul cvi def
   /yindex y 1 add 2 div bpside mul cvi def
   xindex yindex bitison
    {/onbits onbits 1 add def 1}
    {/offbits offbits 1 add def 0} ifelse
  end
 } def
/setpattern
 {setpatterndict begin
   /cellsz exch def
   /angle exch def
   /bwidth exch def
   /bpside exch def
   /bstring exch def
   /onbits 0 def /offbits 0 def
   cellsz angle /bitpatternspotfunction load setuserscreen
   {} settransfer
   offbits offbits onbits add div setgray
  end
 } def
0.01 0.01 scale
clippath pathbbox
/ymax exch def /xmax exch def /ymin exch def /xmin exch def
xmin ymin translate
0 77940 moveto /saveobj2 save def
gsave newpath
 16500 69800 moveto
 11200 71500 lineto
 7600 68300 lineto
 12400 65400 lineto
 11400 68600 lineto
 18700 66600 lineto 
 closepath
 <1151 2A20 4404 808A 1151 2A20 4404 808A
  1151 2A20 4404 808A 1151 2A20 4404 808A>
 16 2 0 7200. 300 16 div div setpattern eofill
grestore showpage saveobj2 restore saveobj1 restore

-------