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

  1. %!
  2.     false setglobal
  3.     
  4.     /defaultobjectformat currentobjectformat def
  5.     /sendstacktop
  6.     {defaultobjectformat setobjectformat 0 printobject 0 1 printobject flush} hardbind def
  7.     /sendstring {dup length sendstacktop sendstacktop} hardbind def
  8.     /sendboolean {{1} {0} ifelse sendstacktop} hardbind def
  9.     /currentcolorspaceNoPattern
  10.     {    currentcolorspace dup 0 get /Pattern eq {1 get} if
  11.     } hardbind def
  12.     /currentcolorDict 1 dict def
  13.     /_sendcurrentcolor
  14.     {    currentcolor
  15.         currentcolorDict currentcolorspace 0 get get exec
  16.     } hardbind def
  17.     currentcolorDict begin
  18.     /DeviceGray {0 sendstacktop sendstacktop} hardbind def
  19.     /DeviceRGB {1 sendstacktop 3 {sendstacktop} repeat} hardbind def
  20.     /DeviceCMYK {2 sendstacktop 4 {sendstacktop} repeat} hardbind def
  21.     /CIEBasedABC
  22.     {    currentcolorspaceNoPattern /NXCalibratedRGBColorSpace load eq {1} {3} ifelse
  23.         sendstacktop 3 {sendstacktop} repeat
  24.     } hardbind def
  25.     /CIEBasedA {4 sendstacktop sendstacktop} hardbind def
  26.     /Pattern
  27.     {    5 sendstacktop
  28.         gsave
  29.         dup dup type /dicttype eq {/PaintType get 2 eq} {false} ifelse
  30.         {pop currentcolorspace 1 get setcolorspace setcolor _sendcurrentcolor}
  31.         {dup /PaintProc get exec}
  32.         ifelse
  33.         -1 sendstacktop
  34.         grestore
  35.     } hardbind def
  36.     /Indexed
  37.     {    6 sendstacktop sendstacktop
  38.         gsave
  39.         currentcolor currentcolorspace 3 get dup xcheck
  40.         {exec}
  41.         {exch numcolorspaceComponents currentcolorspace 1 get
  42.          dup type /arraytype eq {0 get} if get exch 1 index mul exch getinterval {255 div} forall
  43.         } ifelse
  44.         currentcolorspace 1 get setcolorspace setcolor
  45.         _sendcurrentcolor
  46.         grestore
  47.     } hardbind def
  48.     /Separation
  49.     {    7 sendstacktop sendstacktop
  50.         gsave
  51.         currentoverprint sendboolean
  52.         currentcolorspace 1 get dup length string cvs
  53.         dup length sendstacktop sendstacktop
  54.         1 currentcolorspace 3 get exec
  55.         currentcolorspace 2 get setcolorspace setcolor
  56.         _sendcurrentcolor
  57.         grestore
  58.     } hardbind def
  59.     end
  60.     /sendcurrentcolor
  61.     {    gsave mark {{} systemdict /settransfer get exec} stopped
  62.         {cleartomark true} {cleartomark false} ifelse grestore
  63.         not {_sendcurrentcolor} if
  64.     } hardbind def
  65.     
  66.     /fill {sendcurrentcolor fill} hardbind def
  67.     /eofill {sendcurrentcolor eofill} hardbind def
  68.     /stroke {sendcurrentcolor stroke} hardbind def
  69.     /ufill {sendcurrentcolor ufill} hardbind def
  70.     /ueofill {sendcurrentcolor ueofill} hardbind def
  71.     /ustroke {sendcurrentcolor ustroke} hardbind def
  72.     /rectfill {sendcurrentcolor rectfill} hardbind def
  73.     /rectstroke {sendcurrentcolor rectstroke} hardbind def
  74.     
  75.     /oldfindfont /findfont load def
  76.     /_myFontDir 1 dict def
  77.     /infindfont false def
  78.     /findfont
  79.     {    /infindfont load
  80.         {findfont}
  81.         {    /infindfont true store
  82.             dup type /stringtype eq {dup length string copy cvn} if
  83.             _myFontDir 1 index known
  84.             {_myFontDir exch get}
  85.             {    dup findfont
  86.                 dup /tmsOrigFontName known not
  87.                 {    fontdictcopy begin /tmsOrigFontName 1 index def
  88.                     mark {1 index /Font findresource pop} stopped {cleartomark true} {pop false} ifelse
  89.                     /originalyundefined exch def
  90.                     /_myTemporaryFontName currentdict end definefont
  91.                 } if
  92.                 _myFontDir 3 -1 roll 2 index put
  93.             } ifelse
  94.             /infindfont false store
  95.         } ifelse
  96.     } hardbind def
  97.     /definefont
  98.     {    1 index type /stringtype eq {exch dup length string copy cvn exch} if
  99.         dup /tmsOrigFontName known not
  100.         {    dup wcheck not {dup length 2 add dict copy} if
  101.             begin /tmsOrigFontName 1 index def /markedbydefinefont true def currentdict end
  102.         } if
  103.         1 index exch definefont _myFontDir 3 -1 roll 2 index put
  104.     } hardbind def
  105.     /selectfont
  106.     {    exch /findfont load exec exch
  107.         dup type /arraytype eq {makefont} {scalefont} ifelse
  108.         setfont
  109.     } hardbind def
  110.     /getCurrentFontName
  111.     {    currentfont dup /tmsOrigFontName known
  112.         {/tmsOrigFontName get}
  113.         {dup /FontName known {/FontName get} {pop /UnknownFont} ifelse}
  114.         ifelse
  115.     } bind def
  116.     /isCurrentFontMarkedbydefinefont
  117.     {currentfont /markedbydefinefont 2 copy known {get} {pop pop false} ifelse} hardbind def
  118.     /isCurrentFontOriginalyundefined
  119.     {currentfont /originalyundefined 2 copy known {get} {pop pop false} ifelse} hardbind def
  120.     /isCurrentFontCreatedByPSFile
  121.     {    isCurrentFontMarkedbydefinefont {true}
  122.         {isCurrentFontOriginalyundefined {false} {getCurrentFontName oldfindfont gcheck not} ifelse
  123.         } ifelse
  124.         %dup
  125.         %{    (Font ) print getCurrentFontName dup length string cvs print
  126.         %    ( is considered to be created by the document itself\n) print flush
  127.         %} if
  128.     } hardbind def
  129.     
  130.     /sendfontandcolor
  131.     {    sendcurrentcolor
  132.         isCurrentFontCreatedByPSFile not
  133.         {    8 sendstacktop
  134.             getCurrentFontName dup length string cvs sendstring
  135.         } if
  136.     } hardbind def
  137.     /show {sendfontandcolor show} hardbind def
  138.     /ashow {sendfontandcolor ashow} hardbind def
  139.     /widthshow {sendfontandcolor widthshow} hardbind def
  140.     /awidthshow {sendfontandcolor awidthshow} hardbind def
  141.     /glyphshow {sendfontandcolor glyphshow} hardbind def
  142.     /kshow {sendfontandcolor kshow} hardbind def
  143.     /xshow {sendfontandcolor xshow} hardbind def
  144.     /yshow {sendfontandcolor yshow} hardbind def
  145.     /xyshow {sendfontandcolor xyshow} hardbind def
  146.     
  147.     /imagecolors 8 dict def
  148.     imagecolors begin
  149.     /DeviceGray {0} def
  150.     /DeviceRGB {1 0 0} def
  151.     /DeviceCMYK {1 1 1 1} def
  152.     /CIEBasedABC {1 0 0} def
  153.     /CIEBasedA {0} def
  154.     /Pattern {currentcolor} def
  155.     /Indexed
  156.     {    imagecolors currentcolorspace 1 get setcolorspace currentcolorspace 0 get get exec
  157.     } hardbind def
  158.     /Separation {1} def
  159.     end
  160.     /sendimagecolor
  161.     {    imagecolors currentcolorspace 0 get get exec setcolor sendcurrentcolor
  162.     } hardbind def
  163.     /image
  164.     {    gsave
  165.         dup type /dicttype ne {/DeviceGray setcolorspace} if sendimagecolor
  166.         grestore
  167.         image
  168.     } hardbind def
  169.     /colorimage
  170.     {    gsave
  171.         {/DeviceGray null /DeviceRGB /DeviceCMYK} 1 index 1 sub get setcolorspace sendimagecolor
  172.         grestore
  173.         colorimage
  174.     } hardbind def
  175.     /alphaimage
  176.     {    gsave
  177.         {/DeviceGray null /DeviceRGB /DeviceCMYK} 1 index 1 sub get setcolorspace sendimagecolor
  178.         grestore
  179.         alphaimage
  180.     } hardbind def
  181.     /imagemask {sendcurrentcolor imagemask} hardbind def
  182.     
  183.     /showpage {} def
  184.     /erasepage {} def
  185.     
  186.     %% nulldevice causes windowserver death
  187.     0 0 0 0 Nonretained window windowdeviceround
  188.