home *** CD-ROM | disk | FTP | other *** search
/ OneVision 3.03 / OneVision3.03.iso / Apps / OneVision.app / PSElement.1Vmod / computeBBoxPSCode.ps < prev    next >
Encoding:
Text File  |  1996-11-12  |  6.3 KB  |  263 lines

  1.  
  2.     /_epsbbox 4 array def
  3.     /_identmat matrix def
  4.     /defaultobjectformat currentobjectformat def
  5.     /sendpathbbox
  6.     {    systemdict begin
  7.         gsave mark {{} settransfer} stopped
  8.         {cleartomark true} {cleartomark false} ifelse grestore
  9.         not
  10.         {    mark {currentpoint} stopped {cleartomark true} {cleartomark false} ifelse not
  11.             {    defaultobjectformat setobjectformat
  12.                 1 0 printobject 0 1 printobject flush
  13.                 gsave
  14.                 _identmat setmatrix
  15.                 pathbbox _epsbbox astore {0 printobject} forall 0 1 printobject flush
  16.                 grestore
  17.             } if
  18.         } if
  19.         end
  20.     } hardbind def
  21.     
  22.     /fill {sendpathbbox newpath} hardbind def
  23.     /eofill {sendpathbbox newpath} hardbind def
  24.     /stroke {strokepath sendpathbbox newpath} hardbind def
  25.     /ufill {gsave newpath uappend fill grestore} hardbind def
  26.     /ueofill {gsave newpath uappend eofill grestore} hardbind def
  27.     /ustroke
  28.     {    gsave newpath dup length 6 eq {exch uappend concat} {uappend} ifelse stroke grestore
  29.     } hardbind def
  30.     /__RectPath
  31.     {4 2 roll moveto 1 index 0 rlineto 0 exch rlineto neg 0 rlineto closepath} hardbind def
  32.     /__ProcessRectArgs
  33.     {    1 index type /arraytype eq
  34.         {    exch 0 4 2 index length 1 sub
  35.             {dup 3 add 1 exch{1 index exch get exch}for
  36.              5 1 roll 5 index exec
  37.             }for pop pop
  38.         }
  39.         {exec}
  40.         ifelse
  41.     } hardbind def
  42.     /rectfill
  43.     {    gsave newpath {__RectPath fill} __ProcessRectArgs grestore
  44.     } hardbind def
  45.     /rectstroke
  46.     {    gsave
  47.         newpath dup type /arraytype eq
  48.         {dup length 6 eq} {false} ifelse
  49.         {{gsave __RectPath null concat stroke grestore}
  50.          dup length array cvx copy dup 2 4 -1 roll put __ProcessRectArgs
  51.         }
  52.         {{__RectPath stroke} __ProcessRectArgs}
  53.         ifelse
  54.         grestore
  55.     } hardbind def
  56.     
  57.     /_myFontDir 1 dict def
  58.     /infindfont false def
  59.     /findfont
  60.     {    /infindfont load
  61.         {findfont}
  62.         {    /infindfont true store
  63.             dup type /stringtype eq {dup length string copy cvn} if
  64.             _myFontDir 1 index known
  65.             {_myFontDir exch get}
  66.             {    dup findfont
  67.                 dup /tmsOrigFontName known not
  68.                 {    fontdictcopy begin /tmsOrigFontName 1 index def
  69.                     /_myTemporaryFontName currentdict end definefont
  70.                 } if
  71.                 _myFontDir 3 -1 roll 2 index put
  72.             } ifelse
  73.             /infindfont false store
  74.         } ifelse
  75.     } hardbind def
  76.     /definefont
  77.     {    1 index type /stringtype eq {exch dup length string copy cvn exch} if
  78.         dup /tmsOrigFontName known not
  79.         {    dup wcheck not {dup length 2 add dict copy} if
  80.             begin /tmsOrigFontName 1 index def /markedbydefinefont true def currentdict end
  81.         } if
  82.         1 index exch definefont _myFontDir 3 -1 roll 2 index put
  83.     } hardbind def
  84.     /selectfont
  85.     {    exch /findfont load exec exch
  86.         dup type /arraytype eq {makefont} {scalefont} ifelse
  87.         setfont
  88.     } hardbind def
  89.     /getCurrentFontName
  90.     {    currentfont dup /tmsOrigFontName known
  91.         {/tmsOrigFontName get}
  92.         {dup /FontName known {/FontName get} {pop /UnknownFont} ifelse}
  93.         ifelse
  94.     } bind def
  95.     
  96.     /tmpstring ( ) def
  97.     /show
  98.     {    getCurrentFontName /sf ne
  99.         {    gsave
  100.             true charpath
  101.             sendpathbbox
  102.             currentpoint
  103.             grestore
  104.             moveto
  105.         }
  106.         {show}
  107.         ifelse
  108.     } hardbind def
  109.     /ashow
  110.     {    gsave
  111.         /thestring exch def
  112.         {    2 {pop} repeat tmpstring exch 0 exch put tmpstring true charpath
  113.             2 {1 index} repeat rmoveto
  114.         } thestring cshow
  115.         2 {pop} repeat
  116.         sendpathbbox
  117.         currentpoint
  118.         grestore
  119.         moveto
  120.     } hardbind def
  121.     /widthshow
  122.     {    gsave
  123.         /thestring exch def
  124.         /_thechar exch def
  125.         {    2 {pop} repeat dup tmpstring exch 0 exch put tmpstring true charpath
  126.             _thechar eq {2 {1 index} repeat rmoveto} if
  127.         } thestring cshow
  128.         2 {pop} repeat
  129.         sendpathbbox
  130.         currentpoint
  131.         grestore
  132.         moveto
  133.     } hardbind def
  134.     /awidthshow
  135.     {    gsave
  136.         /thestring exch def
  137.         3 -1 roll
  138.         /_thechar exch def
  139.         {    2 {pop} repeat dup tmpstring exch 0 exch put tmpstring true charpath
  140.             _thechar eq {2 {3 index} repeat rmoveto} if
  141.             2 {1 index} repeat rmoveto
  142.         } thestring cshow
  143.         4 {pop} repeat
  144.         sendpathbbox
  145.         currentpoint
  146.         grestore
  147.         moveto
  148.     } hardbind def
  149.     /glyphshow {pop} hardbind def
  150.     /kshowdict 6 dict def
  151.     /kshow
  152.     {    gsave
  153.         kshowdict begin
  154.         /str exch def
  155.         /proc exch def
  156.         str length /strlen exch def
  157.         /pos 0 def
  158.         {    2 {pop} repeat dup tmpstring exch 0 exch put tmpstring true charpath
  159.             /pos pos 1 add def pos strlen lt
  160.             {str pos get /proc load end exec kshowdict begin} {pop} ifelse
  161.         } str cshow
  162.         pop
  163.         sendpathbbox
  164.         currentpoint
  165.         grestore
  166.         moveto
  167.     } hardbind def
  168.     /xshow
  169.     {    gsave
  170.         0 1 3 index length 1 sub
  171.         {    currentpoint 4 index 3 index 1 getinterval true charpath
  172.             exch 3 index 3 index get add exch moveto pop
  173.         } for
  174.         pop pop
  175.         sendpathbbox
  176.         currentpoint
  177.         grestore
  178.         moveto
  179.     } hardbind def
  180.     /yshow
  181.     {    gsave
  182.         0 1 3 index length 1 sub
  183.         {    currentpoint 4 index 3 index 1 getinterval true charpath
  184.             3 index 3 index get add moveto pop
  185.         } for
  186.         pop pop
  187.         sendpathbbox
  188.         currentpoint
  189.         grestore
  190.         moveto
  191.     } hardbind def
  192.     /xyshow
  193.     {    gsave
  194.         0 1 3 index length 1 sub
  195.         {    currentpoint 4 index 3 index 1 getinterval true charpath
  196.             3 index 3 index 2 mul 1 add get add exch
  197.             3 index    3 index 2 mul get add exch moveto pop
  198.         } for
  199.         pop pop
  200.         sendpathbbox
  201.         currentpoint
  202.         grestore
  203.         moveto
  204.     } hardbind def
  205.     
  206.     /sharedtmpimagedict 11 dict def
  207.     /processImage
  208.     {    //sharedtmpimagedict begin
  209.         dup type /dicttype eq
  210.         {    dup /MultipleDataSources known not {/MultipleDataSources false def} if
  211.             {def} forall
  212.             Decode length 2 idiv
  213.             /ncomp exch def
  214.             MultipleDataSources
  215.             {ncomp}
  216.             {/DataSource dup load [exch] def 1}
  217.             ifelse
  218.             /chans exch def
  219.         }
  220.         {    /ImageType 1 def
  221.             /ncomp exch def
  222.             /MultipleDataSources exch def
  223.             /Decode [0 1] def
  224.             MultipleDataSources {ncomp} {1} ifelse /chans exch def
  225.             /DataSource chans array def
  226.             DataSource astore pop
  227.             /ImageMatrix exch def
  228.             /BitsPerComponent exch def /Height exch def /Width exch def
  229.         } ifelse
  230.         gsave
  231.         ImageMatrix matrix invertmatrix concat 0 0 Width Height //rectfill exec
  232.         grestore
  233.         
  234.         Width BitsPerComponent mul
  235.         MultipleDataSources
  236.         {1 sub 8 idiv 1 add ncomp mul}
  237.         {ncomp mul 1 sub 8 idiv 1 add}
  238.         ifelse
  239.         Height mul
  240.         /totbytes exch def
  241.         {    DataSource
  242.             {    exec dup length
  243.                 dup 0 eq {/totbytes 0 def pop pop exit} if
  244.                 /totbytes totbytes 2 index sub def
  245.                 pop pop
  246.             }
  247.             forall
  248.             totbytes 0 le {exit} if
  249.         }
  250.         loop
  251.         end
  252.     } bind def
  253.     /image {dup type /dicttype ne {true 1} if processImage} hardbind def
  254.     /colorimage {processImage} hardbind def
  255.     /alphaimage {1 add processImage} hardbind def
  256.     /imagemask
  257.     {dup type /dicttype ne {3 -1 roll pop 1 3 1 roll true 1} if processImage} hardbind def
  258.     /showpage {} def
  259.     /erasepage {} def
  260.     
  261.     %% nulldevice causes windowserver death
  262.     0 0 0 0 Nonretained window windowdeviceround
  263.