Debian Codegraph @

texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex

raw
1 % Copyright 2018 by Till Tantau
2 %
3 % This file may be distributed and/or modified
4 %
5 % 1. under the LaTeX Project Public License and/or
6 % 2. under the GNU Public License.
7 %
8 % See the file doc/generic/pgf/licenses/LICENSE for more details.
9
10 \ProvidesFileRCS{pgfcorequick.code.tex}
11
12 % Quick version of basic drawing commands. Most high-level commands
13 % are not available if these commands are used.
14
15 % Move current point to (#1,#2).
16 %
17 % #1 = x dimension of new current point
18 % #2 = y dimension of new current point
19 %
20 % Example:
21 %
22 % \pgfpathqmoveto{0pt}{0pt}
23 % \pgfpathqlineto{1pt}{1pt}
24 % \pgfpathqcurveto{2pt}{1pt}{2pt}{2pt}{3pt}{2pt}
25 % \pgfqstroke
26
27 \def\pgfpathqmoveto#1#2{\pgfsyssoftpath@moveto{#1}{#2}}
28
29
30 % Append a line to (#1,#2) to the current path.
31 %
32 % #1 = x dimension of target
33 % #2 = y dimension of target
34 %
35 % Example:
36 %
37 % \pgfpathqmoveto{0pt}{0pt}
38 % \pgfpathqlineto{1pt}{1pt}
39 % \pgfpathqcurveto{2pt}{1pt}{2pt}{2pt}{3pt}{2pt}
40 % \pgfqstroke
41
42 \def\pgfpathqlineto#1#2{\pgfsyssoftpath@lineto{#1}{#2}}
43
44
45 % Append a bezier spline to the current path.
46 %
47 % #1 = x dimension of first support point
48 % #2 = y dimension of first support point
49 % #3 = x dimension of second support point
50 % #4 = y dimension of second support point
51 % #5 = x dimension of target point
52 % #6 = y dimension of target point
53 %
54 % Example:
55 %
56 % \pgfpathqmoveto{0pt}{0pt}
57 % \pgfpathqlineto{1pt}{1pt}
58 % \pgfpathqcurveto{2pt}{1pt}{2pt}{2pt}{3pt}{2pt}
59 % \pgfqstroke
60
61 \def\pgfpathqcurveto#1#2#3#4#5#6{\pgfsyssoftpath@curveto{#1}{#2}{#3}{#4}{#5}{#6}}
62
63
64
65
66 % Append a circle of the given radius around the origin.
67 %
68 % #1 = radius
69 %
70 % Example:
71 %
72 % \pgfpathqcircle{10pt}
73 % is quicker than
74 % \pgfpathcircle{\pgforigin}{10pt}
75
76 \def\pgfpathqcircle#1{%
77 {%
78 \pgf@x=#1%
79 \pgf@y=0.5522847\pgf@x%
80 \pgfsyssoftpath@moveto{\the\pgf@x}{0pt}%
81 \pgfsyssoftpath@curveto{\the\pgf@x}{\the\pgf@y}{\the\pgf@y}{\the\pgf@x}{0pt}{\the\pgf@x}%
82 \pgfsyssoftpath@curveto{-\the\pgf@y}{\the\pgf@x}{-\the\pgf@x}{\the\pgf@y}{-\the\pgf@x}{0pt}%
83 \pgfsyssoftpath@curveto{-\the\pgf@x}{-\the\pgf@y}{-\the\pgf@y}{-\the\pgf@x}{0pt}{-\the\pgf@x}%
84 \pgfsyssoftpath@curveto{\the\pgf@y}{-\the\pgf@x}{\the\pgf@x}{-\the\pgf@y}{\the\pgf@x}{0pt}%
85 \pgfsyssoftpath@closepath%
86 }%
87 }
88
89
90
91 % Stroke current path. No hooks called.
92 %
93 % Example:
94 %
95 % \pgfpathqmoveto{0cm}{0cm}
96 % \pgfpathqlineto{1cm}{1cm}
97 % \pgfpathqcurveto{2cm}{1cm}{2cm}{2cm}{3cm}{2cm}
98 % \pgfqstroke
99
100 \def\pgfusepathqstroke{%
101 \pgfsyssoftpath@flushcurrentpath%
102 \pgfsys@stroke%
103 \pgf@resetpathsizes%
104 }
105
106
107 % Quickly fill current path.
108
109 \def\pgfusepathqfill{%
110 \pgfsyssoftpath@flushcurrentpath%
111 \pgfsys@fill%
112 \pgf@resetpathsizes%
113 }
114
115
116 % Quickly fill and stroke current path.
117
118 \def\pgfusepathqfillstroke{%
119 \pgfsyssoftpath@flushcurrentpath%
120 \pgfsys@fillstroke%
121 \pgf@resetpathsizes%
122 }
123
124 % Quickly clip current path.
125
126 \def\pgfusepathqclip{%
127 \pgfsyssoftpath@flushcurrentpath%
128 \pgfsys@clipnext%
129 \pgfsys@discardpath%
130 \pgf@resetpathsizes%
131 }
132
133
134 \endinput