summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex
blob: a0a7ac9651ec9d38185d36f6dfec49bd2498bf8f (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
% Copyright 2006 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.

\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex,v 1.12 2014/11/02 21:38:01 cfeuersaenger Exp $

% Globals

\newdimen\pgflinewidth


% Set the line width to #1.
% 
% #1 = new line width.
% 
% Example:
%
% \pgfsetlinewidth{3pt}

\def\pgfsetlinewidth#1{%
  \pgfmathsetlength\pgflinewidth{#1}%
  \global\pgflinewidth=\pgflinewidth%
  \pgfsys@setlinewidth{\the\pgflinewidth}%
  \ignorespaces}


% Set the inner line width to #1.
% 
% #1 = new inner line width.
% 
% Description:
%
% The inner line width is the width of a second line that is drawn on
% top of the main stroked line. If the inner line width is 0pt, no
% inner line is drawn. The main use of inner lines is for creating
% "double" lines.
%
% Inner lines are not drawn when a path is used for clipping.
%
% The inner line width is local to the current TeX group, it is not
% part of the graphic state.
%
% Example:
%
% \pgfsetinnerlinewidth{1pt}

\def\pgfsetinnerlinewidth#1{%
  \pgfmathsetlength\pgf@x{#1}%
  \edef\pgfinnerlinewidth{\the\pgf@x}%
}
\def\pgfinnerlinewidth{0pt}


% Set the inner line color to #1.
%
% #1 = color for the inner line
%
% Example:
%
% \pgfsetinnerlinecolor{green} % yikes!

\def\pgfsetinnerstrokecolor#1{\def\pgfinnerstrokecolor{#1}}
\def\pgfinnerstrokecolor{white}


% Set the miter limit to #1.
% 
% #1 = new miter limit factor.
% 
% Example:
%
% \pgfsetmiterlimit{3}

\def\pgfsetmiterlimit#1{%
  \pgfsys@setmiterlimit{#1}%
  \ignorespaces}


% Set the dash pattern to #1 with phase #2/
% 
% #1 = a row of numbers of length of ``on'' and ``off'' points.
% #2 = a phase
% 
% Example:
%
% \pgfsetdash{}          {0pt} % solid line
% \pgfsetdash{{.1cm}}    {0pt} % long dashes
% \pgfsetdash{{1pt}{1ex}}{0pt} % dotted

\def\pgfsetdash#1#2{%
  \def\pgf@temp{}%
  \def\pgf@next{\pgf@strip}%
  \pgf@strip#1{pgf@stop}%
  \pgfmathsetlength\pgf@x{#2}%
  \pgfsys@setdash{\pgf@temp}{\the\pgf@x}%
  \ignorespaces}

\def\pgf@strip#1{%
  \def\pgf@@temp{#1}%
  \ifx\pgf@@temp\pgf@stop%
    \let\pgf@next=\relax%
  \else%
    \pgfmathsetlength\pgf@x{#1}%
    \ifx\pgf@temp\pgfutil@empty%
      \edef\pgf@temp{\the\pgf@x}%
    \else%
      \edef\pgf@temp{\pgf@temp,\the\pgf@x}%
    \fi%
  \fi\pgf@next}

\def\pgf@stop{pgf@stop}


% Set color of strokes. This will overrule the normal color.
% 
% Example:
%
% \pgfsetstrokecolor{red}

\def\pgfsetstrokecolor#1{%
  \pgfutil@colorlet{pgfstrokecolor}{#1}%
  \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{pgfstrokecolor}}%
  \expandafter\let\expandafter\pgf@temp\csname\string\color@pgfstrokecolor\endcsname
  % for arrow tips:
  \global\let\pgf@strokecolor@global=\pgf@temp
  \expandafter\pgf@setstrokecolor\pgf@temp%
}
\def\pgf@setstrokecolor#1#2#3#4#5{%
  \expandafter\ifx\csname pgfsys@color@#4@stroke\endcsname\relax%
    \pgferror{Unsupported color model `#4'. Sorry}%
  \else%
    \edef\pgf@colmarshal{\expandafter\noexpand\csname pgfsys@color@#4@stroke\endcsname}%
    \pgf@uncomma#5,,%
    \pgf@colmarshal%
  \fi}

\def\pgf@uncomma#1,{%
  \def\pgf@coltest{#1}%
  \ifx\pgf@coltest\pgfutil@empty%
    \let\pgf@colnext=\relax%
  \else%
    \expandafter\def\expandafter\pgf@colmarshal\expandafter{\pgf@colmarshal{#1}}%
    \let\pgf@colnext=\pgf@uncomma%
  \fi%
  \pgf@colnext%  
}


% Set color of fills. This will overrule the normal color.
% 
% Example:
%
% \pgfsetfillcolor{gray}

\def\pgfsetfillcolor#1{%
  \pgfutil@colorlet{pgffillcolor}{#1}%
  \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{pgffillcolor}}%
  \expandafter\let\expandafter\pgf@temp\csname\string\color@pgffillcolor\endcsname
  % for arrow tips:
  \global\let\pgf@fillcolor@global=\pgf@temp
  \expandafter\pgf@setfillcolor\pgf@temp
}
\def\pgf@setfillcolor#1#2#3#4#5{%
  \expandafter\ifx\csname pgfsys@color@#4@fill\endcsname\relax%
    \pgferror{Unsupported color model `#4'. Sorry}%
  \else%
    \edef\pgf@colmarshal{\expandafter\noexpand\csname pgfsys@color@#4@fill\endcsname}%
    \pgf@uncomma#5,,%
    \pgf@colmarshal%
  \fi}



% Sets both the stroke and fill color.
% 
% Example:
%
% \pgfsetcolor{blue}

\def\pgfsetcolor#1{%
  \pgfutil@colorlet{pgfstrokecolor}{#1}%
  \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{pgfstrokecolor}}%
  \expandafter\let\expandafter\pgf@temp\csname\string\color@pgfstrokecolor\endcsname
  % for arrow tips:
  \global\let\pgf@strokecolor@global=\pgf@temp
  \global\let\pgf@fillcolor@global=\pgf@temp
  \expandafter\pgf@setcolor\pgf@temp%
}
\def\pgf@setcolor#1#2#3#4#5{%
  \expandafter\ifx\csname pgfsys@color@#4\endcsname\relax%
    \pgferror{Unsupported color model `#4'. Sorry}%
  \else%
    \edef\pgf@colmarshal{\expandafter\noexpand\csname pgfsys@color@#4\endcsname}%
    \pgf@uncomma#5,,%
    \pgf@colmarshal%
  \fi}

% Code for ensuring the stroke/fill colors are correctly reset.
\def\XC@bcolor{\pgfsys@color@reset}

% Set a butt line cap.
% 
% Example:
%
% \pgfsetbuttcap

\def\pgfsetbuttcap{\pgfsys@buttcap\ignorespaces}


% Set a round line cap.
% 
% Example:
%
% \pgfsetroundcap

\def\pgfsetroundcap{\pgfsys@roundcap\ignorespaces}


% Set a rectangular line cap.
% 
% Example:
%
% \pgfsetrectcap

\def\pgfsetrectcap{\pgfsys@rectcap\ignorespaces}


% Set a miter line join.
% 
% Example:
%
% \pgfsetmiterjoin

\def\pgfsetmiterjoin{\pgfsys@miterjoin\ignorespaces}


% Set a bevel line join.
% 
% Example:
%
% \pgfsetbeveljoin

\def\pgfsetbeveljoin{\pgfsys@beveljoin\ignorespaces}


% Set a round line join.
% 
% Example:
%
% \pgfsetroundjoin

\def\pgfsetroundjoin{\pgfsys@roundjoin\ignorespaces}


% Sets the even-odd rule for filling and clipping.
% 
% Example:
%
% \pgfseteorule

\def\pgfseteorule{\pgfsys@eoruletrue\ignorespaces}


% Sets the non-zero winding number rule for filling and clipping.
% 
% Example:
%
% \pgfsetnonzerorule

\def\pgfsetnonzerorule{\pgfsys@eorulefalse\ignorespaces}



\endinput