% 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.

\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
