summaryrefslogtreecommitdiff
path: root/graphics/pgf/base/tex/pgfcorequick.code.tex
blob: 4180440b0086ef08e7b6a5edf8d0b173c337ce8f (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
% Copyright 2018 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{pgfcorequick.code.tex}

% Quick version of basic drawing commands. Most high-level commands
% are not available if these commands are used.

% Move current point to (#1,#2).
%
% #1 = x dimension of new current point
% #2 = y dimension of new current point
% 
% Example:
%
% \pgfpathqmoveto{0pt}{0pt}
% \pgfpathqlineto{1pt}{1pt}
% \pgfpathqcurveto{2pt}{1pt}{2pt}{2pt}{3pt}{2pt}
% \pgfqstroke

\def\pgfpathqmoveto#1#2{\pgfsyssoftpath@moveto{#1}{#2}}


% Append a line to (#1,#2) to the current path.
%
% #1 = x dimension of target
% #2 = y dimension of target
% 
% Example:
%
% \pgfpathqmoveto{0pt}{0pt}
% \pgfpathqlineto{1pt}{1pt}
% \pgfpathqcurveto{2pt}{1pt}{2pt}{2pt}{3pt}{2pt}
% \pgfqstroke

\def\pgfpathqlineto#1#2{\pgfsyssoftpath@lineto{#1}{#2}}


% Append a bezier spline to the current path.
%
% #1 = x dimension of first support point
% #2 = y dimension of first support point
% #3 = x dimension of second support point
% #4 = y dimension of second support point
% #5 = x dimension of target point
% #6 = y dimension of target point
% 
% Example:
%
% \pgfpathqmoveto{0pt}{0pt}
% \pgfpathqlineto{1pt}{1pt}
% \pgfpathqcurveto{2pt}{1pt}{2pt}{2pt}{3pt}{2pt}
% \pgfqstroke

\def\pgfpathqcurveto#1#2#3#4#5#6{\pgfsyssoftpath@curveto{#1}{#2}{#3}{#4}{#5}{#6}}




% Append a circle of the given radius around the origin.
%
% #1 = radius
% 
% Example:
%
% \pgfpathqcircle{10pt}
% is quicker than
% \pgfpathcircle{\pgforigin}{10pt}

\def\pgfpathqcircle#1{%
  {%
    \pgf@x=#1%
    \pgf@y=0.5522847\pgf@x%
    \pgfsyssoftpath@moveto{\the\pgf@x}{0pt}%
    \pgfsyssoftpath@curveto{\the\pgf@x}{\the\pgf@y}{\the\pgf@y}{\the\pgf@x}{0pt}{\the\pgf@x}%
    \pgfsyssoftpath@curveto{-\the\pgf@y}{\the\pgf@x}{-\the\pgf@x}{\the\pgf@y}{-\the\pgf@x}{0pt}%
    \pgfsyssoftpath@curveto{-\the\pgf@x}{-\the\pgf@y}{-\the\pgf@y}{-\the\pgf@x}{0pt}{-\the\pgf@x}%
    \pgfsyssoftpath@curveto{\the\pgf@y}{-\the\pgf@x}{\the\pgf@x}{-\the\pgf@y}{\the\pgf@x}{0pt}%
    \pgfsyssoftpath@closepath%
  }%
}



% Stroke current path. No hooks called.
% 
% Example:
%
% \pgfpathqmoveto{0cm}{0cm}
% \pgfpathqlineto{1cm}{1cm}
% \pgfpathqcurveto{2cm}{1cm}{2cm}{2cm}{3cm}{2cm}
% \pgfqstroke

\def\pgfusepathqstroke{%
  \pgfsyssoftpath@flushcurrentpath%
  \pgfsys@stroke%
  \pgf@resetpathsizes%
}


% Quickly fill current path.

\def\pgfusepathqfill{%
  \pgfsyssoftpath@flushcurrentpath%
  \pgfsys@fill%
  \pgf@resetpathsizes%
}


% Quickly fill and stroke current path.

\def\pgfusepathqfillstroke{%
  \pgfsyssoftpath@flushcurrentpath%
  \pgfsys@fillstroke%
  \pgf@resetpathsizes%
}

% Quickly clip current path.

\def\pgfusepathqclip{%
  \pgfsyssoftpath@flushcurrentpath%
  \pgfsys@clipnext%
  \pgfsys@discardpath%
  \pgf@resetpathsizes%
}


\endinput