%% xypspatt.tex from $Id: xypspatt.doc,v 3.7 1999/02/16 15:12:50 krisrose Exp $
%%
%% Xy-pic ``PostScript pattern prolog''.
%% Copyright (c) 1995-1998 Ross Moore <ross@mpce.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-1998 Kristoffer H. Rose <krisrose@brics.dk>
%%
%% 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, write to the Free Software Foundation, Inc.,
%% 675 Mass Ave, Cambridge, MA 02139, USA.
%%
%% 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
