tpostp9bit.ps - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       tpostp9bit.ps (1765B)
       ---
            1 %
            2 % Version 3.3 prologue for plan9 bitmap 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 /screenres 100 def
           14 /xoffset 0 def
           15 /yoffset 0 def
           16 
           17 /useclippath true def
           18 /pagebbox [0 0 612 792] def
           19 
           20 /inch {72 mul} bind def
           21 /min {2 copy gt {exch} if pop} bind def
           22 
           23 /setup {
           24         counttomark 2 idiv {def} repeat pop
           25 
           26         landscape {/orientation 90 orientation add def} if
           27 
           28         pagedimensions
           29         xcenter ycenter translate
           30         orientation rotation mul rotate
           31         xoffset inch yoffset inch translate
           32         magnification dup aspectratio mul scale
           33 
           34         /height height margin sub def
           35         /width width margin sub def
           36 } def
           37 
           38 /pagedimensions {
           39         useclippath {
           40                 /pagebbox [clippath pathbbox newpath] def
           41         } if
           42         pagebbox aload pop
           43         4 -1 roll exch 4 1 roll 4 copy
           44         landscape {4 2 roll} if
           45         sub /width exch def
           46         sub /height exch def
           47         add 2 div /xcenter exch def
           48         add 2 div /ycenter exch def
           49         userdict /gotpagebbox true put
           50 } def
           51 
           52 /pagesetup {/page exch def} bind def
           53 
           54 /bitmap {
           55         /scanlines exch def
           56         /scanlength exch def
           57         /bitspersample exch def
           58 %%        /v8format exch def
           59 
           60         /bytelength scanlength bitspersample mult 7 add 8 idiv def
           61         /picstr bytelength string def
           62         /lpicstr bytelength string def
           63 %%        /bytelength bytelength 1 sub def
           64 
           65         gsave
           66 
           67 % First the overall scaling.
           68 
           69         height scanlines div width scanlength div min
           70         72 screenres div min
           71         dup scale
           72 
           73 % Followed by the one for the unit square.
           74 
           75         scanlength neg 2 div scanlines neg 2 div translate
           76         scanlength scanlines scale
           77         getp9bitmap
           78         grestore
           79 } bind def
           80 
           81 /getp9bitmap {
           82         scanlength scanlines bitspersample [scanlength 0 0 scanlines neg 0 scanlines] {
           83                         currentfile picstr readhexstring pop} image
           84 } bind def
           85 
           86 /done {/lastpage where {pop lastpage} if} def