summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/tex-ps/cmyk-hax.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-12 23:46:03 +0000
committerKarl Berry <karl@freefriends.org>2006-01-12 23:46:03 +0000
commit873660d1a83ece926fe7206288dda9c36b349c1b (patch)
treea48f77125c309a355b5d0eb58d6b24446abe9d62 /Master/texmf-dist/tex/generic/tex-ps/cmyk-hax.tex
parent2939242967231097459df0fc3150fabc2f639111 (diff)
generic 1
git-svn-id: svn://tug.org/texlive/trunk@613 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/tex-ps/cmyk-hax.tex')
-rw-r--r--Master/texmf-dist/tex/generic/tex-ps/cmyk-hax.tex673
1 files changed, 673 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/tex-ps/cmyk-hax.tex b/Master/texmf-dist/tex/generic/tex-ps/cmyk-hax.tex
new file mode 100644
index 00000000000..4d397c2f45f
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/tex-ps/cmyk-hax.tex
@@ -0,0 +1,673 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% CMYK-HAX.TEX:
+% E This is a set of TeX macros supporting color separation and
+% substitution using TeX/PostScript environment. Needs DVIPS and
+% COLORDVI from standard DVIPS distribution.
+%
+% P Zestaw makr TeX-owo-PostScript-owych do tworzenia wyci/ag/ow barwnych
+% i podmiany kolor/ow. Wsp/o/lpracuje ze sterownikiem DVIPS
+% i zestawem makr COLORDVI (ze standardowej dystrybucji DVIPS-a);
+%
+% AUTHORS' COORDINATES:
+% BOP s.c.
+% ul. Piastowska 70, 80-363 Gda\'nsk, Poland
+% tel./fax +48 58 553-46-59
+% email: bop@bop.com.pl
+%
+% VERSION 0.75, 15.06.2000
+% Public domain
+%
+% HISTORY:
+% E version released during the GUST annual meeting Bacho\TeX'95.
+% P wersja udost/epniona podczas Bacho\TeX'95.
+% VERSION 0.51, 5 V 1995:
+% E macro \CMYKinit added (it places necessary def's in a PS prolog).
+% P dodane zosta/lo makro inicjalizacyjne `\CMYKinit',
+% kt/ore umieszcza w prologu PS u/zywane definicje.
+% VERSION 0.52, 27 VI 1995:
+% E the `currentpoint' fault in case of empty current path; now `currentpoint'
+% is called by the `stopped' command, which makes an error action
+% availlable.
+% P `currentpoint' generowa/l b/l/ad gdy bie/z/aca /scie/zki by/la pusta;
+% obecnie `currentpoint' jest wykonywane przez `stopped',
+% co daje mo/zliwo/s/c zareagowania na b/l/ad.
+% VERSION 0.53, 23 VII 1996:
+% E 1. the constant `epsilon=0.005' entered to do approximed
+% color comparations.
+% 2. \PSscreen became a \special.
+% P 1. wprowadzono sta/l/a `epsilon=0.005', kt/ora jest dok/ladno/sci/a
+% por/ownania kolor/ow.
+% 2. \PSscreen by/l dot/ad makrem TeX-owym o tre/sci PS-owej
+% sensowne jest, aby sta/l si/e \specialem
+% VERSION 0.54, 8 XI 1996 r.
+% E `show' redefinition allows the text outlining.
+% P redefinicja `show' umo/zliwia ju/z dok/ladanie obw/odki do tekst/ow.
+% VERSION 0.60, 11 IV 1997:
+% E processing of CMYK bitmaps enabled
+% P umo/zliwienie przetwarzania bitmap CMYK
+% VERSION 0.61, 11.VIII.1997
+% E `adddownstroke' added (stroke under fill)
+% P dodano `adddownstroke' (rysowan/a pod fillem)
+% VERSION 0.62, 24.IX.1997
+% E `setscreen' gets all parameters
+% P `setscreen' zyskuje wszystkie parametry podawane explicite
+% nie korzysta si/e z warto/sci `currentscreen'
+% VERSION 0.64, 9.VII.1999
+% E bitmap color separation added, delblack (also for imagemask),
+% additional 5-th all-white bitmap separation (\BITinit and /to_sep_bitmap true def /hax_sep 4 def)
+% additional 6-th all-black bitmap separation (\BITinit and /to_sep_bitmap true def /hax_sep 5 def)
+% P do/l/aczono rozbarwianie bitmap, delblack (tak/ze dla imagemask),
+% 5. bia/ly wyci/ag z bitmap (\BITinit oraz /to_sep_bitmap true def /hax_sep 4 def)
+% 6. czarny wyci/ag z bitmap (\BITinit oraz /to_sep_bitmap true def /hax_sep 5 def)
+% VERSION 0.65, 6.VIII.1999
+% E 5-th and 6-th bitmap separation were improved (`pop' added
+% in the case of not-dictionary images)
+% P poprawka w 5. i 6. wyci/agu bitmap (dodano `pop' w bitmapach
+% nies/lownikowych)
+% VERSION 0.66, 13.IX.1999
+% E indexed color bitmaps support (for `colormap')
+% P obs/luga bitmap paletowych (do `colormap')
+% VERSION 0.67, 21.01.2000
+% E support for multisource `colorimage' -- only CMYK separations
+% P obs/luga wersji wielo/xr/od/lowej polecenia `colorimage'
+% -- na razie tylko CMYK i tylko separacja
+% VERSION 0.68, 16.03.2000
+% E \projectCMYK calls setcmykcolor explicite
+% P \projectCMYK wywo/luje explicite setcmykcolor
+% VERSION 0.70, 27.03.2000
+% E image, colorimage and imagemask operators are transferred to
+% their dictionary form and we support them almost completly;
+% limitations: we support only bitmaps with
+% ImageType = 1, in one of Device Color Spaces,
+% when BitsPerComponent = 1 (other values of BitsPerComponent
+% we allow for imagemask, of corse, and for DeviceGray model --
+% without color substitution, unfortunately)
+% P oparatory image, colorimage oraz imagemask przeniesione do wersji
+% s/lownikowej i prawie kompletnie obs/lu/zone;
+% ograniczenia: obs/lugujemy tylko bitmapy, dla kt/orych
+% ImageType = 1, model barw nale/zy do klasy Device Color Spaces,
+% BitsPerComponent = 8 (inne warto/sci BitsPerComponent dopuszczamy
+% oczywi/scie dla imagemask oraz w przypadku modelu DeviceGray --
+% wtedy jednak nie potrafimy podmienia/c kolor/ow)
+% VERSION 0.71, 10.04.2000
+% E 3 bugs fixed:
+% 1) we already support MultipleDataSources in ImageDict
+% 2) it was a superfluous pop in merge_multi3
+% 3) 1 level of redefinition setcmykcolor (hax_setcmykcolor) added
+% P usuni/eto 3 pluskwy w obs/ludze image:
+% 1) ju/z obs/luguje si/e MultipleDataSources w ImageDict
+% 2) by/l zb/edny pop w merge_multi3
+% 3) dodano 1 poziom redefinicji setcmykcolor (hax_setcmykcolor)
+% VERSION 0.73, 28.04.2000
+% E 1) \sepbitmapfalse turns bitmap separation off,
+% \sepbitmaptrue turns bitmap separation on
+% 2) missing ImageDict parameter added before ori_image
+% P 1) \sepbitmapfalse wy/l/acza rozbarwianie bitmap,
+% \sepbitmaptrue przywraca rozbarwianie bitmap
+% 2) dodano brakuj/acy parametr ImageDict przed ori_image
+% VERSION 0.74, 11.05.2000
+% E Bug in \delblacktrue handling has been fixed;
+% the colors created from black with changecolor can be separated now.
+% P Poprawiona pluskwa w obs/ludze \delblacktrue;
+% mo/zliwe staje si/e rozbarwianie kolor/ow powsta/lych z podmiany
+% koloru czarnego.
+% VERSION 0.75, 15.06.2000
+% E \convertbitmaptrue turns on conversion of RGB bitmaps to CMYK,
+% to allow them to be separated
+% \convertbitmapfalse truns conversion off, by default, RGB bitmaps
+% are neither converted nor separated
+% P \convertbitmaptrue w/l/acza konwersj/e bitmap RGB do modelu CMYK,
+% co umo/zliwia ich rozbarwianie
+% \convertbitmapfalse wy/l/acza konwersj/e bitmap RGB do modelu CMYK,
+% co uniemo/zliwia ich rozbarwianie; domy/slnie bitmapy RGB nie s/a
+% ani konwertowane, ani rozbarwiane
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+\edef\slashcatcode {\the\catcode`\/}
+\catcode`\/12
+%
+\def\CMYKinit {\special {! userdict begin
+%
+/ori_setcmykcolor where {pop} {/ori_setcmykcolor /setcmykcolor load def} ifelse
+/ori_setrgbcolor where {pop} {/ori_setrgbcolor /setrgbcolor load def} ifelse
+/ori_setgray where {pop} {/ori_setgray /setgray load def} ifelse
+/ori_colorimage where {pop} {/ori_colorimage /colorimage load def} ifelse
+/ori_image where {pop} {/ori_image /image load def} ifelse
+/ori_imagemask where {pop} {/ori_imagemask /imagemask load def} ifelse
+/ori_fill where {pop} {/ori_fill /fill load def} ifelse
+/ori_eofill where {pop} {/ori_eofill /eofill load def} ifelse
+/ori_stroke where {pop} {/ori_stroke /stroke load def} ifelse
+/ori_show where {pop} {/ori_show /show load def} ifelse
+/hax_setcmykcolor /ori_setcmykcolor load def
+%
+/maybe_black {
+ 4 copy
+ 1 sub abs epsilon le exch
+ 0 sub abs epsilon le and exch
+ 0 sub abs epsilon le and exch
+ 0 sub abs epsilon le and
+ /if_delblack exch def
+} def
+%
+/my_fill {userdict begin if_delblack {newpath} {ori_fill} ifelse end} def
+/my_eofill {userdict begin if_delblack {newpath} {ori_eofill} ifelse end} def
+/my_stroke {userdict begin if_delblack {newpath} {ori_stroke} ifelse end} def
+/my_show {userdict begin if_delblack {false charpath currentpoint newpath moveto} {ori_show} ifelse end} def
+%
+/eofill {userdict begin my_eofill end} def
+/fill {userdict begin my_fill end} def
+/stroke {userdict begin my_stroke end} def
+/show {userdict begin my_show end} def
+%
+/setcmykcolor {userdict begin
+ /k_ exch def /y_ exch def /m_ exch def /c_ exch def
+ c_ m_ y_ k_ hax_setcmykcolor end} def
+/setgray {ori_setgray currentcmykcolor setcmykcolor} def
+/setrgbcolor {ori_setrgbcolor currentcmykcolor setcmykcolor} def
+%
+/hax_image {
+ dup type cvlit /dicttype eq {
+ /ImageDict exch def
+ currentcolorspace dup length 1 eq % only Device color spaces
+ ImageDict /ImageType get 1 eq and {% and ImageType 1 are supported
+ 0 get
+ dup /DeviceRGB eq {/ncomp 3 def} if
+ dup /DeviceGray eq {/ncomp 1 def} if
+ /DeviceCMYK eq {/ncomp 4 def} if
+ ImageDict /BitsPerComponent get 8 ne % only gray image separations
+ /ncomp 1 ne and {/ncomp 0 def} if % allowed if sample is not a byte
+ } {pop /ncomp 0 def} ifelse
+ } {
+ false 1 makeimagedict
+ } ifelse
+ ncomp 0 eq {ImageDict ori_image} {hax_image_} ifelse
+} def
+%
+/hax_colorimage {
+ makeimagedict
+ hax_image_
+} def
+%
+/makeimagedict {
+ dup /ncomp exch def
+ dup 4 eq {/DeviceCMYK setcolorspace} if
+ dup 3 eq {/DeviceRGB setcolorspace} if
+ 1 eq {/DeviceGray setcolorspace} if
+ /ImageDict 7 dict def ImageDict begin
+ {/MultipleDataSources true def
+ ncomp array astore} if % store multi source in array
+ /DataSource exch def
+ /ImageMatrix exch def
+ /BitsPerComponent exch def
+ /Height exch def
+ /Width exch def
+ /Decode [ncomp {0 1} repeat] def
+ /ImageType 1 def
+ end
+} def
+%
+/data_str 65532 string def % very long
+/data_str_ 8192 string def
+/merge_multi4 {
+ ImageDict /DataSource get aload pop
+ dup type cvlit /filetype eq {
+ /fdatsrck exch def
+ /fdatsrcy exch def
+ /fdatsrcm exch def
+ /fdatsrcc exch def
+ /datasrck {fdatsrck data_str_ readstring pop} def
+ /datasrcy {fdatsrcy data_str_ readstring pop} def
+ /datasrcm {fdatsrcm data_str_ readstring pop} def
+ /datasrcc {fdatsrcc data_str_ readstring pop} def
+ } {
+ /datasrck exch def
+ /datasrcy exch def
+ /datasrcm exch def
+ /datasrcc exch def
+ } ifelse
+ ImageDict /DataSource {
+ data_str
+ 0 datasrcc {3 copy put pop 4 add} forall pop
+ 1 datasrcm {3 copy put pop 4 add} forall pop
+ 2 datasrcy {3 copy put pop 4 add} forall pop
+ 3 datasrck {3 copy put pop 4 add} forall
+ 3 sub 0 exch getinterval
+ } put
+} def
+%
+/merge_multi3 {
+ ImageDict /DataSource get aload pop
+ dup type cvlit /filetype eq {
+ /fdatsrcb exch def
+ /fdatsrcg exch def
+ /fdatsrcr exch def
+ /datasrcb {fdatsrcb data_str_ readstring pop} def
+ /datasrcg {fdatsrcg data_str_ readstring pop} def
+ /datasrcr {fdatsrcr data_str_ readstring pop} def
+ } {
+ /datasrcb exch def
+ /datasrcg exch def
+ /datasrcr exch def
+ } ifelse
+ ImageDict /DataSource {
+ data_str
+ 0 datasrcr {3 copy put pop 3 add} forall pop
+ 1 datasrcg {3 copy put pop 3 add} forall pop
+ 2 datasrcb {3 copy put pop 3 add} forall
+ 2 sub 0 exch getinterval
+ } put
+} def
+%
+/i_Str 3 string def
+/O_Str 4 string def
+/UCR {0.5 mul} def
+/BG {0.7 mul} def
+/min {1 index 1 index le {pop} {exch pop} ifelse} def
+/max {1 index 1 index ge {pop} {exch pop} ifelse} def
+%
+/RGBtoCMYK {% RGB pixel is on the stack
+ % RGB --> CMYK conversion (Red Book p. 306)
+ dup 0 get R_scale mul R_shift add /c_i exch def
+ dup 1 get G_scale mul G_shift add /m_i exch def
+ 2 get B_scale mul B_shift add /y_i exch def
+ /k_i c_i m_i y_i min min def
+ O_Str
+ dup 0 255 0 c_i k_i UCR sub cvi max min put
+ dup 1 255 0 m_i k_i UCR sub cvi max min put
+ dup 2 255 0 y_i k_i UCR sub cvi max min put
+ dup 3 255 0 k_i BG cvi max min put
+} def
+%
+/RGBtoCMYKfilter {
+ ImageDict /Decode get aload pop % use Decode for RGB -> CMYK conversion
+ 2 copy sub /B_scale exch def pop 255 mul 255 exch sub /B_shift exch def
+ 2 copy sub /G_scale exch def pop 255 mul 255 exch sub /G_shift exch def
+ 2 copy sub /R_scale exch def pop 255 mul 255 exch sub /R_shift exch def
+ /rtc_file ImageDict /DataSource get def
+ ImageDict /DataSource {rtc_file i_Str readstring {RGBtoCMYK} if}
+ 0 () /SubFileDecode filter put
+ /DeviceCMYK setcolorspace /ncomp 4 def
+ ImageDict /Decode [0 1 0 1 0 1 0 1] put
+} def
+%
+/sep_str 8192 string def
+/SEP_CMYK {
+ 0
+ hax_sep 4 3 index length 1 sub {
+ 2 index exch get
+ 3 copy put pop
+ 1 add
+ } for
+ dup 0 ne {0 exch getinterval}{pop pop ()} ifelse
+} def
+%
+/SEPfilters {
+ ncomp 4 eq {
+ hax_sep 3 le {
+ /sepproc /SEP_CMYK load def
+ ImageDict begin /Decode [
+ Decode hax_sep 2 mul 1 add get
+ Decode hax_sep 2 mul get
+ ] def end
+ } {
+ /sepproc {dup length 4 idiv 0 exch getinterval} def
+ } ifelse
+ /sep_file ImageDict /DataSource get def
+ ImageDict /DataSource {sep_file sep_str readstring pop sepproc} 0 ()
+ /SubFileDecode filter put
+ /DeviceGray setcolorspace
+ } {% ncomp 1 eq
+ hax_sep 3 ne {ImageDict /Decode [ 1 1 ] put} if
+ } ifelse
+ hax_sep 4 eq {ImageDict /Decode [ 1 1 ] put} if
+ hax_sep 5 eq {ImageDict /Decode [ 0 0 ] put} if
+} def
+%
+/change_str 12288 string def % must be a multiplicity of 3 and 4
+/CHANGEfilter {
+ /change_file ImageDict /DataSource get def
+ ImageDict /DataSource {
+ change_file change_str readstring pop
+ 0 ncomp 2 index length ncomp sub {
+ 1 index exch 2 copy ncomp
+ getinterval changebits putinterval
+ } for
+ } 0 () /SubFileDecode filter put
+} def
+%
+/hax_image_ {
+ ImageDict /MultipleDataSources known {
+ ImageDict /MultipleDataSources get {
+ ImageDict /MultipleDataSources false put
+ ImageDict /DataSource get length
+ dup 4 eq {merge_multi4} if
+ dup 3 eq {merge_multi3} if
+ 1 eq {ImageDict begin /DataSource DataSource aload pop def end} if
+ } if
+ } if
+ ImageDict begin
+ /DataSource dup load Width BitsPerComponent mul 7 add 8 idiv
+ Height ncomp mul mul () /SubFileDecode filter def
+ end
+ to_change_bitmap {CHANGEfilter} if
+ ncomp 3 eq to_convert_bitmap and {RGBtoCMYKfilter} if
+ ncomp 3 ne to_sep_bitmap and {SEPfilters} if
+ ImageDict ori_image
+} def
+%
+/zero_data_str 65532 string def % length of the data_str
+/hax_imagemask {
+ if_delblack {
+ dup type cvlit /dicttype eq {
+ /ImageDict exch def
+ } {
+ /ImageDict 7 dict def ImageDict begin
+ /DataSource exch def
+ /ImageMatrix exch def
+ /Decode exch {[1 0]} {[0 1]} ifelse def
+ /Height exch def
+ /Width exch def
+ /BitsPerComponent 1 def
+ /ImageType 1 def
+ end
+ } ifelse
+ ImageDict begin
+ /DataSource load Width 7 add 8 idiv Height mul
+ () /SubFileDecode filter
+ end /mask_file exch def
+ ImageDict /DataSource {
+ zero_data_str 0 mask_file data_str readstring pop length getinterval
+ } 0 () /SubFileDecode filter put
+ ImageDict /Decode [1 0] put
+ ImageDict ori_imagemask
+ } {ori_imagemask} ifelse
+} def
+%
+/truebp {0 matrix defaultmatrix matrix currentmatrix
+ matrix invertmatrix matrix concatmatrix dtransform
+ dup mul exch dup mul add sqrt} def
+/truein {72 mul truebp} def
+/truept {72.27 div truein} def
+/truesp {65536 div truept} def
+/truedd {1238 mul 1157 div truept} def
+/truecc {12 mul truedd} def
+/truemm {25.4 div truein} def
+/truecm {10 mul truemm} def
+%
+/epsilon 0.005 def
+/if_delblack false def
+/to_change_bitmap false def
+/to_convert_bitmap false def
+/to_sep_bitmap false def
+%
+currentcmykcolor setcmykcolor
+%
+end % userdict
+}}% \special \CMYKinit
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\PSbegingroup {\begingroup \special{ps: save }}
+\def\PSendgroup {\special{ps: restore }\endgroup}
+%
+\def\forcolor #1{\def\thecolor{#1}}
+\def\checkcolor {\thecolor\space count 4 lt {(Not CMYK ) print} if
+% k_ eq exch y_ eq and exch m_ eq and exch c_ eq and
+% comparison of colours with a predefined accurracy (epsilon):
+ k_ sub abs epsilon le exch
+ y_ sub abs epsilon le and exch
+ m_ sub abs epsilon le and exch
+ c_ sub abs epsilon le and }
+%
+\def\changefill #1{%
+ \edef\changefills{\changefills \checkcolor
+ {#1 hax_setcmykcolor} if }}
+\def\changestroke #1{%
+ \edef\changestrokes{\changestrokes \checkcolor
+ {#1 hax_setcmykcolor} if }}
+\def\changecolor #1{%
+ \edef\changecolors{\changecolors \checkcolor
+ {#1 hax_setcmykcolor} if }}
+\def\addfill #1{%
+ \edef\addfills{\addfills \checkcolor {addfill} if }%
+ \edef\changefills{\changefills \checkcolor
+ {#1 hax_setcmykcolor} if }}
+\def\adddownstroke #1{%
+ \edef\addstrokes{\addstrokes \checkcolor {adddownstroke} if }%
+ \edef\changestrokes{\changestrokes \checkcolor
+ {#1 hax_setcmykcolor} if }}
+\def\addstroke #1{%
+ \edef\addstrokes{\addstrokes \checkcolor {addstroke} if }%
+ \edef\changestrokes{\changestrokes \checkcolor
+ {#1 hax_setcmykcolor} if }}
+\def\addcolor #1{\addstroke{#1}\addfill{#1}}
+\def\delfill {%
+ \edef\delfills{\delfills \checkcolor {delfill} if }}
+\def\delstroke {%
+ \edef\delstrokes{\delstrokes \checkcolor {delstroke} if }}
+\def\delcolor {%
+ \edef\delcolors{\delcolors \checkcolor {delfill delstroke} if }}
+\def\strokehook #1{%
+ \edef\strokehooks{\strokehooks \checkcolor {#1} if }}
+\def\fillhook #1{%
+ \edef\fillhooks{\fillhooks \checkcolor {#1} if }}
+\def\strokeup {%
+ \edef\changestrokes{\changestrokes \checkcolor {upstroke} if }}
+\def\fillup {%
+ \edef\changestrokes{\changestrokes \checkcolor {upfill} if }}
+%
+\def\forbitmap #1{\def\thebitcolor{<#1>}}
+\def\checkbitcolor {dup \thebitcolor\space eq }
+%
+\def\changebitmap #1{%
+ \edef\changebits{\changebits \checkbitcolor {pop <#1>} if }}
+%
+\def\setCMYKchange{%
+ \edef\changestrokes{}%
+ \edef\changefills{}%
+ \edef\changecolors{}%
+ \edef\addstrokes{}%
+ \edef\addfills{}%
+ \edef\delstrokes{}%
+ \edef\delfills{}%
+ \edef\delcolors{}%
+ \edef\strokehooks{}%
+ \edef\fillhooks{}%
+ \edef\changebits{}%
+}
+%
+\def\fillinitials{%
+ /to_fill true def
+ /to_stroke false def
+ /to_upstroke false def
+}
+\def\strokeinitials{%
+ /to_fill false def
+ /to_stroke true def
+ /to_upstroke true def
+}
+%
+\def\useCMYKchange{%
+ \special{ps:
+ userdict begin
+ /addfill {/to_fill true def} def
+ /delfill {/to_fill false def} def
+ /upfill {/to_upstroke false def} def
+ /addstroke {/to_stroke true def upstroke} def
+ /adddownstroke {/to_stroke true def upfill} def
+ /delstroke {/to_stroke false def} def
+ /upstroke {/to_upstroke true def} def
+ /current_point {{currentpoint} stopped {0 0} if} def
+ %
+ /do_stroke {
+ to_stroke {gsave \changestrokes \strokehooks my_stroke grestore} if
+ } def
+ %
+ /eofill {
+ userdict begin
+ \fillinitials \delfills \delcolors \addstrokes
+ current_point
+ to_upstroke {} {do_stroke} ifelse
+ to_fill {gsave \changefills \fillhooks my_eofill grestore} if
+ to_upstroke {do_stroke} if
+ newpath moveto
+ end
+ } def
+ %
+ /fill {
+ userdict begin
+ \fillinitials \delfills \delcolors \addstrokes
+ current_point
+ to_upstroke {} {do_stroke} ifelse
+ to_fill {gsave \changefills \fillhooks my_fill grestore} if
+ to_upstroke {do_stroke} if
+ newpath moveto
+ end
+ } def
+ %
+ /stroke {
+ userdict begin
+ \strokeinitials \delstrokes \delcolors \addfills
+ current_point
+ to_upstroke {} {do_stroke} ifelse
+ to_fill {gsave \changefills \fillhooks my_eofill grestore} if
+ to_upstroke {do_stroke} if
+ newpath moveto
+ end
+ } def
+ %
+ /show {
+ userdict begin
+ \fillinitials \delfills \delcolors \addstrokes
+ to_upstroke {} {dup false gsave charpath do_stroke grestore} ifelse
+ to_fill {dup gsave my_show grestore} {} ifelse
+ to_upstroke {dup false gsave charpath do_stroke grestore} if
+ false charpath current_point newpath moveto
+ end
+ } def
+ %
+ /setcmykcolor {
+ userdict begin
+ /k_ exch def /y_ exch def /m_ exch def /c_ exch def
+ c_ m_ y_ k_ hax_setcmykcolor \changecolors
+ end
+ } def
+ %
+ currentcmykcolor setcmykcolor
+ end}%
+ \ifx\changebits\empty\else
+ \BITinit
+ \special{ps:
+ userdict begin
+ /to_change_bitmap true def
+ /changebits {\changebits} def
+ end}%
+ \fi
+}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\cyan {1 0 0 0}
+\def\magenta {0 1 0 0}
+\def\yellow {0 0 1 0}
+\def\black {0 0 0 1}
+\def\white {0 0 0 0}
+%
+\def\ScreenFrequency {150}
+\def\Cangle {15}
+\def\Mangle {75}
+\def\Yangle {0}
+\def\Kangle {45}
+%
+\def\PSscreen #1{\ifx\ScreenFrequency\empty
+ \special{ps: currentscreen exch pop #1 exch setscreen}%
+ \else
+ \special{ps:
+ /dot_spot {dup mul exch dup mul add 1 exch sub 2 div} def
+ \ScreenFrequency\space #1 {dot_spot} setscreen
+ }\fi}
+%
+\newif\ifdelblack \delblackfalse
+\newif\ifbitmapsep \bitmapseptrue
+%
+\def\sepbitmaptrue{%
+ \bitmapseptrue
+ \BITinit
+ \special{ps:
+ userdict begin
+ /to_sep_bitmap true def
+ end}}
+%
+\def\sepbitmapfalse{%
+ \bitmapsepfalse
+ \special{ps:
+ userdict begin
+ /to_sep_bitmap false def
+ end}}
+%
+\def\convertbitmaptrue{%
+ \BITinit
+ \special{ps:
+ userdict begin
+ /to_convert_bitmap true def
+ end}}
+%
+\def\convertbitmapfalse{%
+ \special{ps:
+ userdict begin
+ /to_convert_bitmap false def
+ end}}
+%
+\def\BITinit{\special{ps:
+ userdict begin
+ /image /hax_image load def
+ /colorimage /hax_colorimage load def
+ /imagemask /hax_imagemask load def
+ end}}
+%
+\def\projectCMYK #1{%
+ \edef\projectcolor{#1}%
+ \ifx\projectcolor\cyan
+ \special{ps:
+ userdict begin
+ /hax_sep 0 def
+ /hax_setcmykcolor {\ifdelblack maybe_black \fi pop pop pop 1 exch sub ori_setgray} def
+ end
+ }%
+ \PSscreen\Cangle
+ \else \ifx\projectcolor\magenta
+ \special{ps:
+ userdict begin
+ /hax_sep 1 def
+ /hax_setcmykcolor {\ifdelblack maybe_black \fi pop pop exch pop 1 exch sub ori_setgray} def
+ end
+ }%
+ \PSscreen\Mangle
+ \else \ifx\projectcolor\yellow
+ \special{ps:
+ userdict begin
+ /hax_sep 2 def
+ /hax_setcmykcolor {\ifdelblack maybe_black \fi pop exch pop exch pop 1 exch sub ori_setgray} def
+ end
+ }%
+ \PSscreen\Yangle
+ \else \ifx\projectcolor\black
+ \special{ps:
+ userdict begin
+ /hax_sep 3 def
+ /hax_setcmykcolor {exch pop exch pop exch pop 1 exch sub ori_setgray} def
+ end
+ }%
+ \PSscreen\Kangle
+ \fi \fi \fi \fi
+ \ifbitmapsep\sepbitmaptrue\fi
+ \special{ps: currentcmykcolor setcmykcolor}%
+}
+%
+\def\CMYKlabels #1{{#1% #1 is a font csname
+ \Cyan{CYAN}
+ \Magenta{MAGENTA}
+ \Yellow{YELLOW}
+ \Black{BLACK}}}
+%
+\ifx\notCMYKinit\undefined\CMYKinit\fi
+%
+\catcode`\/\slashcatcode
+%
+\endinput