summaryrefslogtreecommitdiff
path: root/macros/generic/diagrams/xypic/texinputs/xypspatt.tex
blob: 927ad08c116ade2f501a59aae9de1ee33cbf3c7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
%% xypspatt.tex from $Id: xypspatt.doc,v 3.11 2011/03/14 20:14:00 krisrose Exp $
%%
%% Xy-pic ``PostScript pattern prolog''.
%% Copyright (c) 1995-1998 Ross Moore <ross.moore@mq.edu.au>
%%
%% This file is part of the Xy-pic package for graphs and diagrams in TeX.
%% See the companion README and INSTALL files for further information.
%% Copyright (c) 1991-2011 Kristoffer H. Rose <krisrose@tug.org>
%%
%% The Xy-pic package is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by the
%% Free Software Foundation; either version 2 of the License, or (at your
%% option) any later version.
%%
%% The Xy-pic package is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
%% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
%% for more details.
%%
%% You should have received a copy of the GNU General Public License along
%% with this package; if not, see http://www.gnu.org/licenses/.
%%
%% As a special exception, you may use this file and all files derived
%% from it without restrictions. This special exception was added with
%% version 3.7 of Xy-pic.
%%
\begingroup \xycatcodes \xyPSobeylines@@%
\PSdict@@{/XYdict where pop begin XYdict begin}%
\PSdict@@{/:patt
{XYddict begin 
14 dict begin
/BGnd exch def
/FGnd exch def
/PaintData exch def
/PatternType 1 def
/PaintType 1 def
/BBox[0 0 1 1]def
/TilingType 1 def
/XStep 1 def
/YStep 1 def
/PatternMtx[24 0 0 24 0 0]def
/PaintProc BGnd null ne
 {{begin BGnd aload pop setrgbcolor 0 0 1 1 rF
 FGnd aload pop setrgbcolor
 24 24 true PatternMtx PaintData imagemask end}}
 {{begin FGnd aload pop setrgbcolor
 24 24 true PatternMtx PaintData imagemask end}}
 ifelse def
 currentdict PatternMtx end
 gsave patangle xyland{180 add}if
 rotate macfreq patfreq div dup neg exch scale matrix currentmatrix 
 grestore gsave setmatrix /DeviceRGB setcolorspace makepattern grestore
 end}def}%
\PSdict@@{%
/rF{gsave
 newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto neg 0 rlineto
 fill grestore}bind def }%
\PSdict@@{%
 /setpatscreen{/pattstring exch store patfreq
 patangle xyport not{90 add}if
 {1 add 4 mul cvi pattstring exch get exch 1 add 4 mul cvi 7 sub 
 bitshift 1 and}setscreen}bind def 
 /setcolpattern{setpatscreen 64 div 1 exch sub currentrgbcolor
 1 1 3{pop 1 exch sub 3 index mul 1 exch sub 3 1 roll}for
 setrgbcolor pop}def
 /setgraypattern{setpatscreen 64 div setgray}def
 /macfreq 9.375 def /patangle 0 def /patfreq 12.5 def}%
\PSdict@@{/checkland{%
 /normland where{pop normland not}{false}ifelse
 /xyland exch def
 /por where{pop por}{/isls where{pop isls not /xyland true def}
 {/land where{pop land not}{true}
 ifelse}ifelse}ifelse /xyport exch def}def }%
\PSdict@@{%
 /setpatfreq{/patfreq exch def}def
 /setpatangle{/patangle exch def}def
 /setbackcolor{/backcolor exch def}def
 /setforecolor{/forecolor exch def}def
 [1 1 1] setbackcolor xycolarray setforecolor
 /bg /setbackcolor load def /fg /setforecolor load def 
 /pa /setpatangle load def /pq /setpatfreq load def }%
\PSdict@@{%
 /xypattern{checkland counttomark dup 0 eq{pop}
 {dup 1 eq{pop setpatscreen}
 {dup 2 eq{pop setcolpattern}
 {dup 3 eq{pop 
 /setcolorspace where {
 /.setcolorspace where{pop pop pop setcolpattern}
 {/.buildpattern where {pop
 forecolor backcolor :patt setpattern
 }{pop pop setcolpattern}ifelse}ifelse}
 {pop setcolpattern}ifelse}
 {5 eq{/setcolorspace where{
 /.setcolorspace where{pop pop pop pop pop setcolpattern}
 {/.buildpattern where {pop
 :patt setpattern
 }{pop pop pop pop setcolpattern}ifelse}ifelse}
 {pop pop pop setcolpattern}ifelse
 }{}ifelse}ifelse}ifelse}ifelse}ifelse cleartomark }def 
 /xysetpattern{/xypatt exch def}def
 /sp /xysetpattern load def }%
\PSdict@@{end end}%
\endgroup%
\endinput