summaryrefslogtreecommitdiff
path: root/graphics/pgf/base/tex/pgfpict2e.sty
blob: 5bb19603eaf4a76458df8038078d6e86f34e798d (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
% 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.

\ProvidesPackage{pgfpict2e}[2004/11/28 ver 0.01]

\RequirePackage{pgfcore}

\def\pgf@pict@line(#1,#2)#3{%
  \pgfsys@beginpurepicture%
  \pgfsetlinewidth{\@wholewidth}%
  \pgfsetroundcap%
  \pgfpathqmoveto{0}{0}%
  \ifnum#1=0\relax%
    \pgf@xa=0pt\relax%
    \pgf@ya=#3\unitlength\relax%
  \else%
    \pgf@y=#2\unitlength%
    \divide\pgf@y by#1\relax%
    \pgf@xa=#3\unitlength\relax%
    \pgf@ya=#3\pgf@y\relax%
  \fi%
  \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@ya}}%
  \pgfusepath{stroke}%
  \pgfsys@endpurepicture%
}%

\def\line(#1,#2)#3{{\pgfsetarrows{-}\pgf@pict@line(#1,#2){#3}}}%
\def\vector(#1,#2)#3{{\pgfsetarrows{-latex}\pgf@pict@line(#1,#2){#3}}}%

\def\@circle#1{{%
  \pgfsys@beginpurepicture%
  \pgfsetlinewidth{\@wholewidth}%
  \pgf@x=#1\unitlength%
  \pgfpathqcircle{.5\pgf@x}%
  \pgfusepathqstroke%
  \pgfsys@endpurepicture}}

\def\@dot#1{{%
  \pgfsys@beginpurepicture%
  \pgfsetlinewidth{\@wholewidth}%
  \pgf@x=#1\unitlength%
  \pgfpathqcircle{.5\pgf@x}%
  \pgfusepathqfill%
  \pgfsys@endpurepicture}}


\def\oval{\pgfutil@ifnextchar[{\pgfpictIIe@oval}{\pgfpictIIe@oval[20pt]}}
\def\pgfpictIIe@oval[#1](#2,#3){\pgfutil@ifnextchar[{\pgfpictIIe@@oval[#1](#2,#3)}{\pgfpictIIe@@oval[#1](#2,#3)[]}}
\def\pgfpictIIe@@oval[#1](#2,#3)[#4]{{%
  \pgfsys@beginpurepicture%
  \@tfor\reserved@a:=#4\do{\csname pgfpictIIe@clip\reserved@a\endcsname}%
  \pgf@x=#2\unitlength%
  \pgf@y=#3\unitlength%
  \pgf@x=-.5\pgf@x%
  \pgf@y=-.5\pgf@y%
  \pgfsys@transformshift{\the\pgf@x}{\the\pgf@y}%
  \pgfsetlinewidth{\@wholewidth}%
  \pgf@ya=#3\unitlength%
  \advance\pgf@ya by-#1\relax%
  \pgfpathmoveto{\pgfpoint{0pt}{\pgf@ya}}%
  \pgfpatharc{180}{90}{#1}%
  \pgf@xa=#2\unitlength%
  \advance\pgf@xa by-#1\relax%
  \pgfpathlineto{\pgfpoint{\pgf@xa}{#3\unitlength}}%
  \pgfpatharc{90}{0}{#1}%
  \pgfpathlineto{\pgfpoint{#2\unitlength}{#1}}%
  \pgfpatharc{0}{-90}{#1}%
  \pgfpathlineto{\pgfpoint{#1}{0pt}}%
  \pgfpatharc{-90}{-180}{#1}%
  \pgfpathclose%
  \pgfusepathqstroke%
  \pgfsys@endpurepicture%
}}
\def\pgfpictIIe@clipr{\pgfpathrectangle{\pgfpoint{0pt}{-1000pt}}{\pgfpoint{1000pt}{2000pt}}\pgfusepath{clip}}
\def\pgfpictIIe@clipl{\pgfpathrectangle{\pgfpoint{-1000pt}{-1000pt}}{\pgfpoint{1000pt}{2000pt}}\pgfusepath{clip}}
\def\pgfpictIIe@clipt{\pgfpathrectangle{\pgfpoint{-1000pt}{0pt}}{\pgfpoint{2000pt}{1000pt}}\pgfusepath{clip}}
\def\pgfpictIIe@clipb{\pgfpathrectangle{\pgfpoint{-1000pt}{-1000pt}}{\pgfpoint{2000pt}{1000pt}}\pgfusepath{clip}}


\renewcommand\bezier[1]{\pgfpictIIe@qbezier}
\renewcommand\qbezier[1][]{\pgfpictIIe@qbezier}
\def\pgfpictIIe@qbezier(#1,#2)(#3,#4)(#5,#6){{%
  \pgfsys@beginpurepicture%
  \pgfsetlinewidth{\@wholewidth}%
  \pgfpathmoveto{\pgfpoint{#1\unitlength}{#2\unitlength}}%
  \pgfpathcurveto%
  {\pgfpointmid{0.66666666}{\pgfpoint{#1\unitlength}{#2\unitlength}}{\pgfpoint{#3\unitlength}{#4\unitlength}}}%
  {\pgfpointmid{0.66666666}{\pgfpoint{#5\unitlength}{#6\unitlength}}{\pgfpoint{#3\unitlength}{#4\unitlength}}}%
  {\pgfpoint{#5\unitlength}{#6\unitlength}}%%
  \pgfusepathqstroke%
  \pgfsys@endpurepicture%
}}
\newcommand\cbezier[1][]{\pgfpictIIe@cbezier}
\def\pgfpictIIe@cbezier(#1,#2)(#3,#4)(#5,#6)(#7,#8){{%
  \pgfsys@beginpurepicture%
  \pgfsetlinewidth{\@wholewidth}%
  \pgfpathmoveto{\pgfpoint{#1\unitlength}{#2\unitlength}}%
  \pgfpathcurveto%
  {\pgfpoint{#3\unitlength}{#4\unitlength}}%
  {\pgfpoint{#5\unitlength}{#6\unitlength}}%
  {\pgfpoint{#7\unitlength}{#8\unitlength}}%%
  \pgfusepathqstroke%
  \pgfsys@endpurepicture%
}}

\endinput