plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

postgif.ps (2279B)


      1 %
      2 % Version 3.3.2 prologue for GIF pixmap files.
      3 %
      4 
      5 /#copies 1 store
      6 /aspectratio 1 def
      7 /formsperpage 1 def
      8 /landscape false def
      9 /magnification 1 def
     10 /margin 0 def
     11 /orientation 0 def
     12 /rotation 1 def
     13 /xoffset 0 def
     14 /yoffset 0 def
     15 
     16 /useclippath true def
     17 /pagebbox [0 0 612 792] def
     18 
     19 /inch {72 mul} bind def
     20 /min {2 copy gt {exch} if pop} bind def
     21 
     22 /setup {
     23 	counttomark 2 idiv {def} repeat pop
     24 
     25 	landscape {/orientation 90 orientation add def} if
     26 
     27 	pagedimensions
     28 	xcenter ycenter translate
     29 	orientation rotation mul rotate
     30 	xoffset inch yoffset inch translate
     31 	magnification dup aspectratio mul scale
     32 
     33 	/height height margin sub def
     34 	/width width margin sub def
     35 } def
     36 
     37 /pagedimensions {
     38 	useclippath {
     39 		/pagebbox [clippath pathbbox newpath] def
     40 	} if
     41 	pagebbox aload pop
     42 	4 -1 roll exch 4 1 roll 4 copy
     43 	landscape {4 2 roll} if
     44 	sub /width exch def
     45 	sub /height exch def
     46 	add 2 div /xcenter exch def
     47 	add 2 div /ycenter exch def
     48 	userdict /gotpagebbox true put
     49 } def
     50 
     51 /pagesetup {/page exch def} bind def
     52 
     53 /done {/lastpage where {pop lastpage} if} def
     54 
     55 /alignment false def
     56 
     57 /gifscreen { % scrwidth scrheight $
     58     2 copy
     59 
     60     alignment {
     61     	100 dup dtransform exch 100 exch div abs exch 100 exch div abs
     62 	2 copy scale
     63 	/height exch height exch div def
     64 	/width exch width exch div def
     65     } if
     66 
     67     height exch div exch width exch div
     68     2 copy lt { pop } { exch pop } ifelse
     69 
     70     alignment { cvi } if
     71 
     72     dup scale
     73 
     74     neg 2 div exch neg 2 div exch translate
     75 } def
     76 
     77 /gifimage { % gray imagewidth imageheight xorigin yorigin $
     78     translate
     79     2 copy scale
     80     /imageheight exch def
     81     /imagewidth exch def
     82     /gray exch def
     83     imagewidth imageheight 8 [imagewidth 0 0 imageheight neg 0 imageheight]
     84     gray {
     85 	{ currentfile codestr readhexstring pop } image
     86     } {
     87 	/colorimage where {
     88 	    pop
     89 	    /picstr imagewidth 3 mul string def
     90 	    { currentfile codestr readhexstring pop pop
     91 	    	0 1 imagewidth 1 sub {
     92 		    picstr exch dup 3 mul exch colortbl exch codestr exch get
     93 		    3 mul 3 getinterval putinterval
     94 	    	} for picstr
     95 	    } false 3 colorimage
     96 	} {
     97 	    { currentfile codestr readhexstring pop pop
     98 	    	0 1 imagewidth 1 sub {
     99 		    codestr exch dup graytbl exch codestr exch get get put
    100 	    	} for codestr
    101 	    } image
    102 	} ifelse
    103     } ifelse
    104 } def