From 873660d1a83ece926fe7206288dda9c36b349c1b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 12 Jan 2006 23:46:03 +0000 Subject: generic 1 git-svn-id: svn://tug.org/texlive/trunk@613 c570f23f-e606-0410-a88d-b1316a301751 --- .../generic/pgf/basiclayer/pgfbaseimage.code.tex | 236 ++ .../generic/pgf/basiclayer/pgfbaselayers.code.tex | 127 + .../generic/pgf/basiclayer/pgfbaseplot.code.tex | 321 +++ .../generic/pgf/basiclayer/pgfbaseshapes.code.tex | 824 ++++++ .../generic/pgf/basiclayer/pgfbasesnakes.code.tex | 346 +++ .../tex/generic/pgf/basiclayer/pgfcore.code.tex | 23 + .../generic/pgf/basiclayer/pgfcorearrows.code.tex | 510 ++++ .../pgf/basiclayer/pgfcoregraphicstate.code.tex | 254 ++ .../generic/pgf/basiclayer/pgfcoremath.code.tex | 262 ++ .../generic/pgf/basiclayer/pgfcoreobjects.code.tex | 97 + .../basiclayer/pgfcorepathconstruction.code.tex | 826 ++++++ .../pgf/basiclayer/pgfcorepathprocessing.code.tex | 502 ++++ .../pgf/basiclayer/pgfcorepathusage.code.tex | 209 ++ .../generic/pgf/basiclayer/pgfcorepoints.code.tex | 822 ++++++ .../generic/pgf/basiclayer/pgfcorequick.code.tex | 131 + .../generic/pgf/basiclayer/pgfcorescopes.code.tex | 379 +++ .../generic/pgf/basiclayer/pgfcoreshade.code.tex | 409 +++ .../pgf/basiclayer/pgfcoretransformations.code.tex | 540 ++++ .../tex/generic/pgf/frontendlayer/tikz.code.tex | 2677 ++++++++++++++++++++ .../pgf/libraries/pgflibraryarrows.code.tex | 806 ++++++ .../pgf/libraries/pgflibraryautomata.code.tex | 189 ++ .../pgf/libraries/pgflibraryplothandlers.code.tex | 450 ++++ .../pgf/libraries/pgflibraryplotmarks.code.tex | 208 ++ .../pgf/libraries/pgflibraryshapes.code.tex | 289 +++ .../pgf/libraries/pgflibrarysnakes.code.tex | 369 +++ .../libraries/pgflibrarytikzbackgrounds.code.tex | 131 + .../pgf/libraries/pgflibrarytikztrees.code.tex | 94 + .../texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg | 23 + .../generic/pgf/systemlayer/pgfsys-common-pdf.def | 91 + .../pgf/systemlayer/pgfsys-common-postscript.def | 155 ++ .../generic/pgf/systemlayer/pgfsys-common-svg.def | 353 +++ .../tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def | 131 + .../tex/generic/pgf/systemlayer/pgfsys-dvips.def | 244 ++ .../tex/generic/pgf/systemlayer/pgfsys-pdftex.def | 169 ++ .../tex/generic/pgf/systemlayer/pgfsys-tex4ht.def | 165 ++ .../tex/generic/pgf/systemlayer/pgfsys.code.tex | 763 ++++++ .../pgf/systemlayer/pgfsysprotocol.code.tex | 68 + .../pgf/systemlayer/pgfsyssoftpath.code.tex | 128 + .../generic/pgf/utilities/pgf-latex-emulation.tex | 291 +++ .../tex/generic/pgf/utilities/pgffor.code.tex | 217 ++ .../tex/generic/pgf/utilities/pgfrcs.code.tex | 85 + 41 files changed, 14914 insertions(+) create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseimage.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaselayers.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseplot.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseshapes.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbasesnakes.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoremath.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruction.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryautomata.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysnakes.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarytikzbackgrounds.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarytikztrees.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/utilities/pgf-latex-emulation.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex create mode 100644 Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex (limited to 'Master/texmf-dist/tex/generic/pgf') diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseimage.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseimage.code.tex new file mode 100644 index 00000000000..41597300e23 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseimage.code.tex @@ -0,0 +1,236 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfbaseimage.code.tex,v 1.2 2005/07/06 15:58:57 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + + +% Declare an image +% +% #1 = optional argument: width, height, page specification +% #2 = name of the image for later use +% #4 = filename without extension, automatic extensions are .pdf, +% .jpg, and .png for PDF and .ps, .eps, .epsi for postscript. +% +% Description: +% +% This command declares an image file for later use. Even if the image +% is used several times in the document, in PDF it will only be stored +% once. +% +% Example: +% +% \pgfdeclareimage[width=2cm,page=2]{myimage}{imagefilename} + +\def\pgfdeclareimage{\@ifnextchar[{\pgf@declareimage}{\pgf@declareimage[]}} +\def\pgf@declareimage[#1]#2#3{% + \setkeys{pgfimage}{height=,width=,page=,interpolate=false,mask=}% defaults + \setkeys{pgfimage}{#1}% + % Try to find the file + \gdef\pgf@filename{}% + % If page= parameter is not empty, try that file first: + \ifx\pgf@imagepage\@empty% + \else% + \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3.page\pgf@imagepage}% + \fi% + \ifx\pgf@filename\@empty% + \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3}% + \else% + \setkeys{pgfimage}{page=}% make page empty + \fi% + \ifx\pgf@filename\@empty% + \PackageWarning{pgf}% + {File "#3" not found when defining image "#2".\MessageBreak + Tried all extensions in "\pgfsys@imagesuffixlist"}% + \pgf@declaredraftimage{#2}% + \else% + \ifpgf@draftmode% + \pgf@declaredraftimage{#2}% + \else% + \pgfsys@defineimage% + \fi% + \fi% + \expandafter\global\expandafter\let\csname pgf@image@#2!\endcsname=\pgf@image% +} + +\define@key{pgfimage}{width}{\edef\pgf@imagewidth{#1}} +\define@key{pgfimage}{height}{\edef\pgf@imageheight{#1}} +\define@key{pgfimage}{page}{\edef\pgf@imagepage{#1}} +\define@key{pgfimage}{interpolate}[true]{\edef\pgf@imageinterpolate{/Interpolate #1}} +\define@key{pgfimage}{mask}{% + \edef\pgf@imagemask{#1}% + \ifx\pgf@imagemask\@empty% + \else% + \@ifundefined{pgf@mask@#1}% + {\PackageError{pgf}{Undefined mask "#1".}{}% + \edef\pgf@imagemask{}}% + {\edef\pgf@imagemask{\csname pgf@mask@#1\endcsname}% + \ifx\pgf@imagemask\@empty% + \else + \edef\pgf@imagemask{/SMask \pgf@imagemask\space 0 R}% + \fi}% + \fi} + +\def\pgf@findfile#1:#2+#3{% + \IfFileExists{#3.#1}% + {\xdef\pgf@filename{#3.#1}}% + {\def\pgf@mightbeempty{#2}% + \ifx\pgf@mightbeempty\@empty\else% + \pgf@findfile#2+{#3}% + \fi}} + +\def\pgf@declaredraftimage#1{% + \ifx\pgf@imagewidth\@empty% + \PackageWarning{pgf}{Missing width for image "#1" in draft mode.\MessageBreak Using 1cm instead}% + \edef\pgf@imagewidth{1cm}% + \fi% + \ifx\pgf@imageheight\@empty% + \PackageWarning{pgf}{Missing height for image "#1" in draft mode.\MessageBreak Using 1cm instead}% + \edef\pgf@imageheight{1cm}% + \fi% + \ifx\pgf@imagepage\@empty\else\edef\pgf@imagepagetext{ page \pgf@imagepage}\fi% + \edef\pgf@image{% + \hbox to \pgf@imagewidth{% + \vrule\kern-0.4pt% + \vbox to \pgf@imageheight{% + \hrule\vfil% + \hbox to \pgf@imagewidth{\hskip-10cm\hfil\noexpand\tiny#1\pgf@imagepage\hfil\hskip-10cm}% + \vfil\hrule}% + \kern-0.4pt\vrule}% + }% +} + + + +% Declare a soft mask +% +% #1 = optional argument: matte specification. default matte is +% white. +% #2 = name of the mask for later use +% #3 = filename without extension, automatic extensions are .pdf, +% .jpg, and .png for PDF. Postscript is not supported. +% +% Description: +% +% This command declares a soft mask for later masking an image. The +% declared mask should be used together with an image of exactly the +% same height/width if matte is defined. Matte should be the +% preblended background color (see pdf spec for details). +% +% Example: +% +% \pgfdeclaremask[matte=white]{maskname}{maskfilename} +% \pgfdeclareimage[mask=maskname]{image}{imagefilename} + +\def\pgfdeclaremask{\@ifnextchar[\pgf@declaremask{\pgf@declaremask[]}} +\def\pgf@declaremask[#1]#2#3{% + \setkeys{pgfmask}{matte={1 1 1}}% defaults + \setkeys{pgfmask}{#1}% + \def\pgf@mask{}% + % Try to find the file + \gdef\pgf@filename{}% + \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3}% + \ifx\pgf@filename\@empty% + \PackageWarning{pgf}% + {File "#3" not found when defining mask "#2".\MessageBreak + Tried all extensions in "\pgfsys@imagesuffixlist"}% + \else% + \pgfsys@definemask% + \fi% + \expandafter\global\expandafter\let\csname pgf@mask@#2\endcsname=\pgf@mask% +} + +\define@key{pgfmask}{matte}{\edef\pgf@maskmatte{#1}} + + + + +% Create an alias name for an image +% +% #1 = name of the alias +% #2 = name of the original +% +% Example: +% +% \pgfdeclareimage{image}{1cm}{1cm}{filename +% \pgfaliasimage{alias}{image} +% \pgfuseimage{alias} + +\def\pgfaliasimage#1#2{% + \expandafter\global\expandafter\let\expandafter\pgf@temp\expandafter=\csname pgf@image@#2!\endcsname% + \expandafter\global\expandafter\let\csname pgf@image@#1!\endcsname=\pgf@temp% + } + + +% Use an image +% +% #1 = name of a previously declared image +% +% Example: +% +% \pgfputat{\pgforigin}{\pgfbox[left,base]{\pgfuseimage{myimage}}} + +\def\pgfuseimage#1{% + \def\pgf@imagename{pgf@image@#1}% + \pgf@tryextensions{\pgf@imagename}{\pgfalternateextension}% + \expandafter\@ifundefined\expandafter{\pgf@imagename}% + {\PackageError{pgf}{Undefined image "#1"}{}}% + {{\leavevmode\csname\pgf@imagename\endcsname}}} + +\def\pgf@tryextensions#1#2{% + \edef\pgf@args{[#2!]}\expandafter\pgf@@tryextensions\pgf@args{#1}} +\def\pgf@@tryextensions[#1!#2]#3{% + \expandafter\@ifundefined\expandafter{#3.#1!#2}% + {\def\pgf@temp{#2}% + \ifx\pgf@temp\@empty% + \edef#3{#3!}% + \else% + \pgf@@tryextensions[#2]{#3}% + \fi}% + {\edef#3{#3.#1!#2}}} + + +% Alternate image +% +% Description: +% +% When an image is used, pgf first attempts to use the image with the +% alternate extension added. If this fails, the original image is +% used. If the alternate extension contains ``!'', then the text up to +% the ! is successively removed and the remainder is tried as an +% alternate extension. +% +% Example: +% +% \def\pgfalternateextension{20!white} + +\def\pgfalternateextension{} + + + +% Directly insert an image +% +% #1 = optional argument: width, height, page specification +% #2 = file name +% +% Description: +% +% Directly inserts an image without declaration. You can, however, +% still access this image using the name pgflastimage. By using +% pgfaliasimage, you can also save this image for later. +% +% Example: +% +% \pgfimage[height=2cm]{filename} + +\def\pgfimage{\@ifnextchar[\pgf@imagecom{\pgf@imagecom[]}} +\def\pgf@imagecom[#1]#2{% + \pgfdeclareimage[#1]{pgflastimage}{#2}% + \pgfuseimage{pgflastimage}} + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaselayers.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaselayers.code.tex new file mode 100644 index 00000000000..8e6e97b8017 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaselayers.code.tex @@ -0,0 +1,127 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfbaselayers.code.tex,v 1.1 2005/08/13 18:59:56 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +% Creates a new pgf layer +% +% #1 = layer name +% +% Declares a new layer for pgf. +% +% Example: +% +% \pgfdeclarelayer{background} + +\def\pgfdeclarelayer#1{% + \expandafter\newbox\csname pgf@layerbox@#1\endcsname% + \expandafter\newbox\csname pgf@layerboxsaved@#1\endcsname% +} + + +% Sets the layers that compose the picture +% +% #1 = List of layers +% +% Description: +% +% Sets the list of layers that make up the picture. The layers will be +% put on top of each other in the order given. +% +% Example: +% +% \pgfsetlayers{background,main} + +\def\pgfsetlayers#1{\edef\pgf@layerlist{#1}} +\pgfsetlayers{main} + + + +% Adds code to a layer +% +% #1 = layer name +% +% Note: +% +% You cannot anything to the ``main'' layer using this command. +% +% Example: +% +% \begin{pgfonlayer}{background} +% \fill[red] (0,0) -- (1,1); +% \end{pgfonlayer} + +\def\pgfonlayer#1{% + \expandafter\global\expandafter% + \setbox\csname pgf@layerbox@#1\endcsname=\hbox to 0pt% + \bgroup% + \expandafter\box\csname pgf@layerbox@#1\endcsname% + \begingroup% +} +\def\endpgfonlayer{% + \endgroup% + \hss + \egroup% +} + + + + +% Hooks into the scoping: + +\def\pgf@insertlayers{% + \expandafter\pgf@dolayer\pgf@layerlist,,\relax% +} +\def\pgf@maintext{main}% +\def\pgf@dolayer#1,#2,\relax{% + \def\pgf@test{#1}% + \ifx\pgf@test\pgf@maintext% + \box\pgf@layerbox@main% + \else% + \pgfsys@beginscope% + \expandafter\box\csname pgf@layerbox@#1\endcsname% + \pgfsys@endscope% + \fi% + \def\pgf@test{#2}% + \ifx\pgf@test\@empty% + \else% + \pgf@dolayer#2,\relax% + \fi% +} + +\def\pgf@savelayers{% + \expandafter\pgf@dosavelayer\pgf@layerlist,,\relax% +} +\def\pgf@dosavelayer#1,#2,\relax{% + \def\pgf@test{#1}% + \ifx\pgf@test\pgf@maintext% + \else% + \setbox\csname pgf@layerboxsaved@#1\endcsname=\box\csname pgf@layerbox@#1\endcsname% + \fi% + \def\pgf@test{#2}% + \ifx\pgf@test\@empty% + \else% + \pgf@dosavelayer#2,\relax% + \fi% +} + +\def\pgf@restorelayers{% + \expandafter\pgf@dorestorelayer\pgf@layerlist,,\relax% +} +\def\pgf@dorestorelayer#1,#2,\relax{% + \def\pgf@test{#1}% + \ifx\pgf@test\pgf@maintext% + \else% + \global\setbox\csname pgf@layerbox@#1\endcsname=\box\csname pgf@layerboxsaved@#1\endcsname% + \fi% + \def\pgf@test{#2}% + \ifx\pgf@test\@empty% + \else% + \pgf@dorestorelayer#2,\relax% + \fi% +} + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseplot.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseplot.code.tex new file mode 100644 index 00000000000..f3d9e4f49a7 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseplot.code.tex @@ -0,0 +1,321 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfbaseplot.code.tex,v 1.2 2005/07/06 15:58:57 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + +% PGF's plotting interface works as follows: +% +% In order to plot something, two things need to be done. First, you +% need to provide the coordinates (obviously) of the points that +% should be plotted. The coordinates are given via a long stream of +% commands. These commands are \pgfplotstreamstart, which is +% given exactly once at the beginning, \pgfplotstreampoint, of which there +% are numerous in the middle, \pgfplotstreamspecial, of which there may be +% numerous in the middle, and \pgfplotstreamend, which must be given +% at the end. Between these commands arbitrary other commands may be +% given. Here is an example: +% +% ... +% \pgfplotstreamstart +% \pgfplotstreampoint{\pgfpointxy{0}{0}} +% \pgfplotstreampoint{\pgfpointxy{1}{1}} +% \pgfplotstreampoint{\pgfpointxy{2}{4}} +% \relax +% \pgfplotstreampoint{\pgfpointxy{3}{9}} +% \pgfplotstreamspecial{some handler-dependent special stuff} +% \pgfplotstreamend +% +% By themselves, the \pgfplotstreamxxxx commands do not do anything by +% default. Rather, the ``use'' such a stream, you must first install a +% stream handler. For example, the ``lineto'' handler will simply +% translate every \pgfplotstreampoint into a \pgfpathlineto. +% +% Example: +% +% \pgfpathmoveto{\pgfpointorigin} +% +% \pgfplothandlerlineto +% \pgfplotstreamstart +% \pgfplotstreampoint{\pgfpointxy{0}{0}} +% \pgfplotstreampoint{\pgfpointxy{1}{1}} +% \pgfplotstreampoint{\pgfpointxy{2}{4}} +% \relax +% \pgfplotstreampoint{\pgfpointxy{3}{9}} +% \pgfplotstreamend + + +% The stream commands actually call their ``internal'' versions, which +% are set by the handlers: +\def\pgfplotstreamstart{\pgf@plotstreamstart} +\def\pgfplotstreampoint#1{\gdef\pgfplotlastpoint{#1}\pgf@plotstreampoint{#1}} +\def\pgfplotstreamspecial{\pgf@plotstreamspecial} +\def\pgfplotstreamend{\pgf@plotstreamend} + + + + +% Sets the action taken for the first point of a plot to a lineto. +% +% Description: +% +% For certain handlers it makes sense either the start a plot by +% moving to the first point of the plot or to do a lineto to that +% first point. Using this command this action can be set to a lineto. +% +% Example: +% +% \pgfsetlinetofirstplotpoint + +\def\pgfsetlinetofirstplotpoint{\let\pgf@plot@first@action=\pgfpathlineto} + + +% Sets the action taken for the first point of a plot to a moveto. +% +% Example: +% +% \pgfsetmovetofirstplotpoint + +\def\pgfsetmovetofirstplotpoint{\let\pgf@plot@first@action=\pgfpathmoveto} + +\let\pgf@plot@first@action=\pgfpathmoveto + + + +% +% Handlers +% + + +% This handler converts each plot stream command into a lineto +% command, except for the first, which is converted to the action that +% has previously been specified using \pgfsetlinetofirstplotpoint or +% \pgfsetmovetofirstplotpoint. +% +% Example: +% +% \pgfplothandlerlineto +% \pgfplotxyfile{mytable} + +\def\pgfplothandlerlineto{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@line@handler% + \global\let\pgf@plotstreamspecial=\@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} + +\def\pgf@plot@line@handler#1{% + \pgf@plot@first@action{#1}% + \global\let\pgf@plotstreampoint=\pgfpathlineto% +} + + + +% More handlers are defined in pgflibraryplothandlers + + + + + +% This handler discards the plot. +% +% Example: +% +% \pgfplothandlerdiscard +% \pgfplotxyfile{mytable} + +\def\pgfplothandlerdiscard{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\@gobble% + \global\let\pgf@plotstreamspecial=\@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} + + + + +% This handler records each plot stream command to a macro. This is +% useful if plot commands are difficult to generate and need to be +% ``recylced'' later on. +% +% Example: +% +% \pgfplothandlerrecord{\myplot} +% \pgfplotxyfile{mytable} % stored in \myplot now +% \pgfplothandlerline +% \myplot +% \pgftransformxshift{1cm} +% \myplot + +\def\pgfplothandlerrecord#1{% + \def\pgf@plot@recordto{#1}% + \gdef#1{\pgfplotstreamstart}% + \def\pgf@plotstreamstart{% + \gdef\pgf@plotstreampoint####1{\expandafter\gdef\expandafter#1\expandafter{#1\pgfplotstreampoint{####1}}}% + \gdef\pgf@plotstreamspecial####1{\expandafter\gdef\expandafter#1\expandafter{#1\pgfplotstreamspecial{####1}}}% + \gdef\pgf@plotstreamend{\expandafter\gdef\expandafter#1\expandafter{#1\pgfplotstreamend}}% + }% +} + + + +% Read a plot stream from a file and plot it. +% +% #1 = file from which to read things +% +% File format: +% +% Each line of the file should begin with two numbers separated by a +% space. Such a line with number #1 and #2 is converted to a +% \pgfplotstreampoint{\pgfpointxy{#1}{#2}}. Extra characters following +% on the line are ignored. +% +% Lines starting with ``%'' and ``#'' are ignored. +% +% Example: +% +% \pgfplotxyfile{tableformgnuplot.dat} + +\def\pgfplotxyfile#1{% + \begingroup% + \pgfplotstreamstart% + \openin1=#1 + \ifeof1 + \PackageWarning{pgf}{Plot data file `#1' not found.} + \else + \catcode`\#=14 + \pgf@readxyfile% + \fi + \pgfplotstreamend% + \endgroup% +} + +\def\pgf@partext{\par} +\def\pgf@readxyfile{% + \read1 to \pgf@temp% + \let\par=\@@par% + \edef\pgf@temp{\pgf@temp}% + \ifx\pgf@temp\@empty% + \else\ifx\pgf@temp\pgf@partext% + \else% + \expandafter\pgf@parsexyline\pgf@temp\pgf@stop% + \fi\fi% + \ifeof1\else\expandafter\pgf@readxyfile\fi% +} + +\def\pgf@parsexyline#1 #2 #3\pgf@stop{% + \pgfplotstreampoint{\pgfpointxy{#1}{#2}}% +} + + + + + +% Read a plot stream from a file and plot it. +% +% #1 = file from which to read things +% +% File format: +% +% Like xy, except that each line contains three numbers, which are +% converted to xyz coordiantes. +% +% Example: +% +% \pgfplotxyfile{tableformgnuplot.dat} + +\def\pgfplotxyzfile#1{% + \begingroup% + \pgfplotstreamstart% + \openin1=#1 + \ifeof1 + \PackageWarning{pgf}{Plot data file `#1' not found.} + \else + \catcode`\#=14 + \pgf@readxyzfile% + \fi + \pgfplotstreamend% + \endgroup% +} + +\def\pgf@readxyzfile{% + \read1 to \pgf@temp% + \ifx\pgf@temp\@empty% + \else\ifx\pgf@temp\pgf@partext% + \else% + \expandafter\pgf@parsexyzline\pgf@temp\pgf@stop% + \fi\fi% + \ifeof1\else\expandafter\pgf@readxyzfile\fi% +} + +\def\pgf@parsexyzline#1 #2 #3 #4\pgf@stop{% + \pgfplotstreampoint{\pgfpointxyz{#1}{#2}{#3}}% +} + + + + +% Render a function using gnuplot. +% +% #1 = filename prefix for .gnuplot and .table files (optional, +% default is \jobname) +% #2 = gnuplot function text +% +% Description: +% +% This command will write a file called #1.gnuplot that sets up +% some gnuplot commands to write output to a file called +% #1.table. Then it calls gnuplot (using the \write18 mechanism) +% to execute the file. Then it reads #2.table using \pgfplotxyfile. +% +% Example: +% +% \pgfplothandlerlineto +% \pgfplotgnuplot[\jobname]{plot [x=0:5] x*sin(x)} + +{ + \catcode`\%=12 + \catcode`\"=12 + \xdef\pgf@gnuplot@head#1{set terminal table; set output "#1.table"; set format "%.5f"} +} + +\newwrite\pgf@plotwrite +\newif\ifpgf@resample@plot + +\def\pgfplotgnuplot{\@ifnextchar[{\pgf@plotgnuplot}{\pgf@plotgnuplot[\jobname]}}%} +\def\pgf@plotgnuplot[#1]#2{% + \pgf@resample@plottrue% + % Check, whether it is up-to-date + \openin\@inputcheck=#1.gnuplot + \ifeof\@inputcheck% + \else% + \read\@inputcheck to\pgf@temp% ignored + \read\@inputcheck to\pgf@plot@line% + \edef\pgf@plot@code{#2\space}% + \ifx\pgf@plot@code\pgf@plot@line% + \openin\@inputcheck=#1.table + \ifeof\@inputcheck% + \else% + \pgf@resample@plotfalse% + \fi% + \fi% + \fi + \ifpgf@resample@plot% + \immediate\openout\pgf@plotwrite=#1.gnuplot + \immediate\write\pgf@plotwrite{\pgf@gnuplot@head{#1}}% + \immediate\write\pgf@plotwrite{#2}% + \immediate\closeout\pgf@plotwrite% + \immediate\write18{gnuplot #1.gnuplot} + \fi% + \pgfplotxyfile{#1.table} +} + + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseshapes.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseshapes.code.tex new file mode 100644 index 00000000000..494f328994d --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseshapes.code.tex @@ -0,0 +1,824 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfbaseshapes.code.tex,v 1.9 2005/10/13 10:12:31 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + +\newbox\pgfnodeparttextbox + + +% Creates a node +% +% #1 = shape type +% #2 = anchor +% #3 = name for later reference +% #4 = path usage command +% +% Description: +% +% This command draws a shape that has previously been defined using +% \pgfdeclareshape. The shape is shifted such that the anchor is at +% the origin. In order to transform the whole shape, you should setup +% pgf's transformation matrix prior to calling this command. +% +% When this command is called, the shape-specific TeX boxes of the +% node must be have been setup correctly. +% +% Example: +% +% \pgftransformshift{\pgfpoint{1cm}{1cm}} +% \pgfmultipartnode{rectangle}{center}{Hello}{hellonode}{\pgfusepath{stroke}} + +\def\pgfmultipartnode#1#2#3#4{% + \@ifundefined{pgf@sh@s@#1}% + {\PackageError{pgf}{Unknown shape ``#1''}{}}% + {% + {% + \let\pgf@sh@savedpoints=\@empty% + \csname pgf@sh@s@#1\endcsname% + \pgf@sh@savedpoints% + \pgftransformshift{% + \pgf@sh@reanchor{#1}{#2}% + \pgf@x=-\pgf@x% + \pgf@y=-\pgf@y% + }% + % Save the saved points and the transformation matrix + \edef\pgf@test{#3}% + \ifx\pgf@test\@empty% + \else% + \expandafter\xdef\csname pgf@sh@ns@#3\endcsname{#1}% + \edef\pgf@sh@@temp{\noexpand\gdef\expandafter\noexpand\csname pgf@sh@np@#3\endcsname}% + \expandafter\pgf@sh@@temp\expandafter{\pgf@sh@savedpoints}% + \pgfgettransform\pgf@temp + \expandafter\xdef\csname pgf@sh@nt@#3\endcsname{\pgf@temp}% + \fi% + \@ifundefined{pgf@sh@bbg@#1}{} + {{\pgfscope\csname pgf@sh@bbg@#1\endcsname\endpgfscope}}% + \@ifundefined{pgf@sh@bg@#1}{}% + {\csname pgf@sh@bg@#1\endcsname#4}% + \@ifundefined{pgf@sh@fbg@#1}{} + {{\pgfscope\csname pgf@sh@fbg@#1\endcsname\endpgfscope}}% + {% + \expandafter\@for\expandafter\pgf@shape@com\expandafter:\expandafter=\csname pgf@sh@boxes@#1\endcsname\do{% + {% + \pgftransformshift{\pgf@sh@reanchor{#1}{\pgf@shape@com}}% + \expandafter\pgfqboxsynced\expandafter{\csname pgfnodepart\pgf@shape@com box\endcsname}% + }% + }% + }% + \@ifundefined{pgf@sh@bfg@#1}{}% + {{\pgfscope\csname pgf@sh@bfg@#1\endcsname\endpgfscope}}% + \@ifundefined{pgf@sh@fg@#1}{}% + {\csname pgf@sh@fg@#1\endcsname#4}% + \@ifundefined{pgf@sh@ffg@#1}{}% + {{\pgfscope\csname pgf@sh@ffg@#1\endcsname\endpgfscope}}% + }% + }% +} + + +% Creates a node +% +% #1 = shape type +% #2 = anchor +% #3 = normal TeX text +% #4 = name for later reference +% #5 = path usage command +% +% Description: +% +% This command draws a shape that has previously been defined using +% \pgfdeclareshape. The shape is shifted such that the anchor is at +% the origin. In order to transform the whole shape, you should setup +% pgf's transformation matrix prior to calling this command. +% +% Example: +% +% \pgftransformshift{\pgfpoint{1cm}{1cm}} +% \pgfnode{rectangle}{center}{Hello}{hellonode}{\pgfusepath{stroke}} + +\def\pgfnode#1#2#3#4#5{% + {% + \setbox\pgfnodeparttextbox=\hbox% + {% + \pgfinterruptpicture% + {#3}% + \endpgfinterruptpicture% + }% + \pgfmultipartnode{#1}{#2}{#4}{#5}% + } +} + +\def\pgf@sh@resavedanchor#1#2{% + \pgf@process{#2}% + \edef\pgf@sh@marshal{% + \noexpand\g@addto@macro\noexpand\pgf@sh@savedpoints{% + \noexpand\def\noexpand#1{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + }}% + \pgf@sh@marshal% +} + + +\def\pgf@sh@resaveddimen#1#2{% + {#2\global\pgf@x=\pgf@x}% + \edef\pgf@sh@marshal{% + \noexpand\g@addto@macro\noexpand\pgf@sh@savedpoints{% + \noexpand\def\noexpand#1{\the\pgf@x}% + }}% + \pgf@sh@marshal% +} + +% Invoke an anchor +\def\pgf@sh@reanchor#1#2{% + \@ifundefined{pgf@anchor@#1@#2}% + {% + \setcounter{pgf@counta}{#2}% + \csname pgf@anchor@#1@border\endcsname{\pgfpointpolar{\c@pgf@counta}{1pt}}% + }% + {\csname pgf@anchor@#1@#2\endcsname}% +} + + + +% Retrieves an anchor of a shape +% +% #1 = name +% #2 = anchor or a number (corresponding to a degree) +% +% Description: +% +% This command yields a point at the anchor of the given named shape. +% +% Example: +% +% \pgfshape{rectangle}{center}{Hello}{hellonode}{\pgfusepath[stroke]} +% \pgfpathmoveto{\pgfpointanchor{hellonode}{center}} + +\def\pgfpointanchor#1#2{% + % Ok, check whether #1 is known! + \@ifundefined{pgf@sh@ns@#1} + {\PackageError{pgf}{No shape named #1 is known}{}% + \pgfpointorigin}% + {% + \pgf@process{% + % install special coordinates + \csname pgf@sh@np@#1\endcsname + \pgf@sh@reanchor{\csname pgf@sh@ns@#1\endcsname}{#2}% + {% + \pgfsettransform{\csname pgf@sh@nt@#1\endcsname}% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \global\pgf@x=\pgf@x% + \global\pgf@y=\pgf@y% + }% + % Undo current transformation + \pgftransforminvert% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + }% + }% +} + + + +% Retrieves a border point of a shape +% +% #1 = name +% #2 = another point +% +% Description: +% +% This command yields a point on the border of the shape that is on a +% straight line from the center to the point #2. +% +% Example: +% +% \pgfshape{rectangle}{center}{Hello}{hellonode}{\pgfusepath[stroke]} +% \pgfpathmoveto{\pgfpointshapeborder{hellonode}{\pgfpoint{2cm}{1cm}} +% \pgfpathlineto{\pgfpoint{2cm}{1cm}} +% \pgfusepath{stroke} + +\def\pgfpointshapeborder#1#2{% + % Ok, check whether #1 is known! + \@ifundefined{pgf@sh@ns@#1} + {\PackageError{pgf}{No shape named #1 is known}{}% + \pgfpointorigin}% + {% + \pgf@process{% + % install special coordinates + \csname pgf@sh@np@#1\endcsname% + {% + \pgf@process{\pgfpointtransformed{#2}}% + \pgfsettransform{\csname pgf@sh@nt@#1\endcsname}% + \pgftransforminvert% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\csname pgf@anchor@\csname pgf@sh@ns@#1\endcsname @center\endcsname}% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + \csname pgf@anchor@\csname pgf@sh@ns@#1\endcsname @border\endcsname{\pgfpoint{\pgf@xa}{\pgf@ya}}% + \pgfsettransform{\csname pgf@sh@nt@#1\endcsname}% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \global\pgf@x=\pgf@x% + \global\pgf@y=\pgf@y% + }% + % Undo current transformation + \pgftransforminvert% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + }% + }% +} + + + +% Declares a shape type +% +% #1 = shape type +% #2 = shape specification +% +% Description: +% +% This command declares a new shape type. The shape specification +% should contain the following commands: +% +% - \savedanchor +% This command takes two arguments: a name and some code. The point +% specified by the code (the \pgf@x and \pgf@y values resulting from +% executing the code, to be precise), will be stored under the given +% name. Whenever, later on, an anchor is invoked these stored points +% will be available. The \saveddimen works like \savedanchor, only a +% single dimension is stored (taken from \pgf@x). +% When a savedanchor is calculated, the height/width/depth of the +% boxes mentioned in \nodeparts can be used. +% +% - \anchor +% Specifies an anchor. This command takes two arguments: an anchor +% name and some code for computing the anchor. When the anchor +% computation starts, all shape points and shape dimension will be +% setup. +% +% - \anchorborder +% This command should compute a point on the border of the +% shape. When the code is called, \pgf@x and \pgf@y will have been +% preinitialised with a direction. +% +% - \behindbackgroundpath +% Some things to be draw behind everything. +% +% - \backgroundpath +% A path that is drawn behind the main box. How this path is used +% depends on how \pgfshape is called. +% +% - \beforebackgroundpath +% Some things to be draw before the background path, but behind the +% main box. +% +% - \behindforegroundpath +% Some things to be draw on top of the main box. +% +% - \foregroundpath +% A path that is drawn on top of all of the above. How this path is +% used depends on how \pgfshape is called. +% +% - \beforeforegroundpath +% Some things to be draw before everything. +% +% - \nodeparts +% List of node parts that make up the shape. For each entry XYZ in +% the list there must be a box named \pgfnodepartXYZbox (possibly +% ``redirected'' to some different box using \let). Each such box +% will be placed at the anchor XYZ. +% By default, \nodeparts is just {text}. Thus, there will be one +% node part box named \pgfnodeparttextbox and this node will be +% placed at the anchor text. +% +% +% Example: +% +% See the definition of rectangle, below. + +\long\def\pgfdeclareshape#1#2{% + { + \def\shape@name{#1} + \let\savedanchor=\pgf@sh@savedanchor + \let\saveddimen=\pgf@sh@saveddimen + \let\anchor=\pgf@sh@anchor + \let\anchorborder=\pgf@sh@anchorborder + \let\behindbackgroundpath=\pgf@sh@behindbgpath + \let\backgroundpath=\pgf@sh@bgpath + \let\beforebackgroundpath=\pgf@sh@beforebgpath + \let\behindforegroundpath=\pgf@sh@behindfgpath + \let\foregroundpath=\pgf@sh@fgpath + \let\beforeforegroundpath=\pgf@sh@beforefgpath + \let\nodeparts=\pgf@sh@boxes + \let\inheritsavedanchors=\pgf@sh@inheritsavedanchors + \let\inheritanchor=\pgf@sh@inheritanchor + \let\inheritanchorborder=\pgf@sh@inheritanchorborder + \let\inheritbehindbackgroundpath=\pgf@sh@inheritbehindbgpath + \let\inheritbackgroundpath=\pgf@sh@inheritbgpath + \let\inheritbeforebackgroundpath=\pgf@sh@inheritbeforebgpath + \let\inheritbehindforegroundpath=\pgf@sh@inheritbehindfgpath + \let\inheritforegroundpath=\pgf@sh@inheritfgpath + \let\inheritbeforeforegroundpath=\pgf@sh@inheritbeforefgpath + \let\inheritnodeparts=\pgf@sh@inheritboxes + \anchorborder{\csname pgf@anchor@#1@center\endcsname}% + \anchor{text}{\pgfpointorigin}% + \nodeparts{text}% + \expandafter\global\expandafter\let\csname pgf@sh@s@\shape@name\endcsname=\@empty% + #2 + } +} + +\def\pgf@sh@savedanchor#1#2{% + \expandafter\g@addto@macro\csname pgf@sh@s@\shape@name\endcsname{\pgf@sh@resavedanchor{#1}{#2}}} +\def\pgf@sh@saveddimen#1#2{% + \expandafter\g@addto@macro\csname pgf@sh@s@\shape@name\endcsname{\pgf@sh@resaveddimen{#1}{#2}}} +\def\pgf@sh@anchor#1#2{\expandafter\gdef\csname pgf@anchor@\shape@name @#1\endcsname{#2}} +\def\pgf@sh@anchorborder#1{\expandafter\gdef\csname pgf@anchor@\shape@name @border\endcsname##1{\pgf@process{##1}#1}} +\long\def\pgf@sh@behindbgpath#1{\expandafter\gdef\csname pgf@sh@bbg@\shape@name\endcsname{#1}} +\long\def\pgf@sh@bgpath#1{\expandafter\gdef\csname pgf@sh@bg@\shape@name\endcsname{#1}} +\long\def\pgf@sh@beforebgpath#1{\expandafter\gdef\csname pgf@sh@fbg@\shape@name\endcsname{#1}} +\long\def\pgf@sh@behindfgpath#1{\expandafter\gdef\csname pgf@sh@bfg@\shape@name\endcsname{#1}} +\long\def\pgf@sh@fgpath#1{\expandafter\gdef\csname pgf@sh@fg@\shape@name\endcsname{#1}} +\long\def\pgf@sh@beforefgpath#1{\expandafter\gdef\csname pgf@sg@ffg@\shape@name\endcsname{#1}} +\def\pgf@sh@boxes#1{\expandafter\gdef\csname pgf@sh@boxes@\shape@name\endcsname{#1}} + +\def\pgf@sh@inheritsavedanchors[from=#1]{% + \expandafter\g@addto@macro\csname pgf@sh@s@\shape@name\endcsname{\csname pgf@sh@s@#1\endcsname}} +\def\pgf@sh@inheritanchor[from=#1]#2{% + \edef\pgf@marshal{\global\let\expandafter\noexpand\csname + pgf@anchor@\shape@name @#2\endcsname=\expandafter\noexpand\csname + pgf@anchor@#1@#2\endcsname}% + \pgf@marshal% +} +\def\pgf@sh@inheritanchorborder[from=#1]{% + \edef\pgf@marshal{\global\let\expandafter\noexpand\csname + pgf@anchor@\shape@name @border\endcsname=\expandafter\noexpand\csname + pgf@anchor@#1@border\endcsname}% + \pgf@marshal% +} +\def\pgf@sh@inheritor#1#2{% + \edef\pgf@marshal{\global\let\expandafter\noexpand\csname + pgf@sh@#1@\shape@name\endcsname=\expandafter\noexpand\csname + pgf@sh@#1@#2\endcsname}% + \pgf@marshal% +} +\def\pgf@sh@inheritbehindbgpath[from=#1]{\pgf@sh@inheritor{bbg}{#1}} +\def\pgf@sh@inheritbgpath[from=#1]{\pgf@sh@inheritor{bg}{#1}} +\def\pgf@sh@inheritbeforebgpath[from=#1]{\pgf@sh@inheritor{fbg}{#1}} +\def\pgf@sh@inheritbehindfgpath[from=#1]{\pgf@sh@inheritor{bfg}{#1}} +\def\pgf@sh@inheritfgpath[from=#1]{\pgf@sh@inheritor{fg}{#1}} +\def\pgf@sh@inheritbeforefgpath[from=#1]{\pgf@sh@inheritor{ffg}{#1}} +\def\pgf@sh@inheritboxes[from=#1]{\pgf@sh@inheritor{boxes}{#1}} + + + +% +% Coordinate. This shape is special: It is only used to reference a +% point for later usage. Nothing is drawn, all anchors are identical +% to the center. +% + +\pgfdeclareshape{coordinate} +{ + \savedanchor\centerpoint{% + % x + \pgf@x=.5\wd\pgfnodeparttextbox% + % y + \pgf@y=.5\ht\pgfnodeparttextbox% + \advance\pgf@y by -.5\dp\pgfnodeparttextbox% + } + + \anchor{center}{\centerpoint} + \anchor{north}{\centerpoint} + \anchor{north west}{\centerpoint} + \anchor{north east}{\centerpoint} + \anchor{center}{\centerpoint} + \anchor{west}{\centerpoint} + \anchor{east}{\centerpoint} + \anchor{mid}{\centerpoint} + \anchor{mid west}{\centerpoint} + \anchor{mid east}{\centerpoint} + \anchor{base}{\centerpoint} + \anchor{base west}{\centerpoint} + \anchor{base east}{\centerpoint} + \anchor{south}{\centerpoint} + \anchor{south west}{\centerpoint} + \anchor{south east}{\centerpoint} + \anchorborder{\centerpoint} + + \nodeparts{}% no text +} + + +% Set the recommended inner x separation +% +% #1 = size +% +% Example: +% +% \pgfsetshapeinnerxsep{2pt} + +\def\pgfsetshapeinnerxsep#1{\def\pgfshapeinnerxsep{#1}} +\pgfsetshapeinnerxsep{.3333em} + + +% Set the recommended inner y separation +% +% #1 = size +% +% Example: +% +% \pgfsetshapeinnerxsep{2pt} + +\def\pgfsetshapeinnerysep#1{\def\pgfshapeinnerysep{#1}} +\pgfsetshapeinnerysep{.3333em} + + +% Set the recommended outer x separation +% +% #1 = size +% +% Example: +% +% \pgfsetshapeouterxsep{2pt} + +\def\pgfsetshapeouterxsep#1{\def\pgfshapeouterxsep{#1}} +\pgfsetshapeouterxsep{.5\pgflinewidth} + + +% Set the recommended outer y separation +% +% #1 = size +% +% Example: +% +% \pgfsetshapeouterxsep{2pt} + +\def\pgfsetshapeouterysep#1{\def\pgfshapeouterysep{#1}} +\pgfsetshapeouterysep{.5\pgflinewidth} + + +% Set the recommended minimum width +% +% #1 = size +% +% Example: +% +% \pgfsetshapeminwidth{1cm} + +\def\pgfsetshapeminwidth#1{\def\pgfshapeminwidth{#1}} +\pgfsetshapeminwidth{1pt} + + +% Set the recommended minimum height +% +% #1 = size +% +% Example: +% +% \pgfsetshapeminheight{1cm} + +\def\pgfsetshapeminheight#1{\def\pgfshapeminheight{#1}} +\pgfsetshapeminheight{1pt} + + +% +% Rectangle +% + +\pgfdeclareshape{rectangle} +{ + \savedanchor\northeast{% + % Calculate x + % + % First, is width < minimum width? + \pgf@x=\the\wd\pgfnodeparttextbox% + \setlength\pgf@xc{\pgfshapeinnerxsep}% + \advance\pgf@x by 2\pgf@xc% + \setlength\pgf@xb{\pgfshapeminwidth}% + \ifdim\pgf@x<\pgf@xb% + % yes, too small. Enlarge... + \pgf@x=\pgf@xb% + \fi% + % Now, calculate right border: .5\wd\pgfnodeparttextbox + .5 \pgf@x + outer sep + \pgf@x=.5\pgf@x% + \advance\pgf@x by.5\wd\pgfnodeparttextbox% + \setlength\pgf@xa{\pgfshapeouterxsep}% + \advance\pgf@x by\pgf@xa% + % Calculate y + % + % First, is height+depth < minimum height? + \pgf@y=\ht\pgfnodeparttextbox% + \advance\pgf@y by\dp\pgfnodeparttextbox% + \setlength\pgf@yc{\pgfshapeinnerysep}% + \advance\pgf@y by 2\pgf@yc% + \setlength\pgf@yb{\pgfshapeminheight}% + \ifdim\pgf@y<\pgf@yb% + % yes, too small. Enlarge... + \pgf@y=\pgf@yb% + \fi% + % Now, calculate upper border: .5\ht-.5\dp + .5 \pgf@y + outer sep + \pgf@y=.5\pgf@y% + \advance\pgf@y by-.5\dp\pgfnodeparttextbox% + \advance\pgf@y by.5\ht\pgfnodeparttextbox% + \setlength\pgf@ya{\pgfshapeouterysep}% + \advance\pgf@y by\pgf@ya% + } + + \savedanchor\southwest{% + % Calculate x + % + % First, is width < minimum width? + \pgf@x=\wd\pgfnodeparttextbox% + \setlength\pgf@xc{\pgfshapeinnerxsep}% + \advance\pgf@x by 2\pgf@xc% + \setlength\pgf@xb{\pgfshapeminwidth}% + \ifdim\pgf@x<\pgf@xb% + % yes, too small. Enlarge... + \pgf@x=\pgf@xb% + \fi% + % Now, calculate left border: .5\wd\pgfnodeparttextbox - .5 \pgf@x - outer sep + \pgf@x=-.5\pgf@x% + \advance\pgf@x by.5\wd\pgfnodeparttextbox% + \setlength\pgf@xa{\pgfshapeouterxsep}% + \advance\pgf@x by-\pgf@xa% + % Calculate y + % + % First, is height+depth < minimum height? + \pgf@y=\ht\pgfnodeparttextbox% + \advance\pgf@y by\dp\pgfnodeparttextbox% + \setlength\pgf@yc{\pgfshapeinnerysep}% + \advance\pgf@y by 2\pgf@yc% + \setlength\pgf@yb{\pgfshapeminheight}% + \ifdim\pgf@y<\pgf@yb% + % yes, too small. Enlarge... + \pgf@y=\pgf@yb% + \fi% + % Now, calculate upper border: .5\ht-.5\dp - .5 \pgf@y - outer sep + \pgf@y=-.5\pgf@y% + \advance\pgf@y by-.5\dp\pgfnodeparttextbox% + \advance\pgf@y by.5\ht\pgfnodeparttextbox% + \setlength\pgf@ya{\pgfshapeouterysep}% + \advance\pgf@y by-\pgf@ya% + } + + % + % Anchors + % + \anchor{center}{ + \pgf@process{\northeast}% + \pgf@xa=.5\pgf@x% + \pgf@ya=.5\pgf@y% + \pgf@process{\southwest}% + \pgf@x=.5\pgf@x% + \pgf@y=.5\pgf@y% + \advance\pgf@x by \pgf@xa% + \advance\pgf@y by \pgf@ya% + } + \anchor{mid}{\pgf@anchor@rectangle@center\setlength\pgf@y{.5ex}} + \anchor{base}{\pgf@anchor@rectangle@center\pgf@y=0pt} + \anchor{north}{ + \pgf@process{\southwest}% + \pgf@xa=.5\pgf@x% + \pgf@process{\northeast}% + \pgf@x=.5\pgf@x% + \advance\pgf@x by \pgf@xa% + } + \anchor{south}{ + \pgf@process{\northeast}% + \pgf@xa=.5\pgf@x% + \pgf@process{\southwest}% + \pgf@x=.5\pgf@x% + \advance\pgf@x by \pgf@xa% + } + \anchor{west}{ + \pgf@process{\northeast}% + \pgf@ya=.5\pgf@y% + \pgf@process{\southwest}% + \pgf@y=.5\pgf@y% + \advance\pgf@y by \pgf@ya% + } + \anchor{mid west}{\southwest\setlength\pgf@y{.5ex}} + \anchor{base west}{\southwest\pgf@y=0pt} + \anchor{north west}{ + \southwest + \pgf@xa=\pgf@x + \northeast + \pgf@x=\pgf@xa} + \anchor{south west}{\southwest} + \anchor{east}{% + \pgf@process{\southwest}% + \pgf@ya=.5\pgf@y% + \pgf@process{\northeast}% + \pgf@y=.5\pgf@y% + \advance\pgf@y by \pgf@ya% + } + \anchor{mid east}{\northeast\setlength\pgf@y{.5ex}} + \anchor{base east}{\northeast\pgf@y=0pt} + \anchor{north east}{\northeast} + \anchor{south east}{ + \northeast + \pgf@xa=\pgf@x + \southwest + \pgf@x=\pgf@xa + } + \anchorborder{% + \pgf@xb=\pgf@x% xb/yb is target + \pgf@yb=\pgf@y% + \southwest% + \pgf@xa=\pgf@x% xa/ya is se + \pgf@ya=\pgf@y% + \northeast% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \pgf@xc=.5\pgf@x% x/y is half width/height + \pgf@yc=.5\pgf@y% + \advance\pgf@xa by\pgf@xc% xa/ya becomes center + \advance\pgf@ya by\pgf@yc% + \edef\pgf@marshal{% + \noexpand\pgfpointborderrectangle + {\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}} + {\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}% + }% + \pgf@process{\pgf@marshal}% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + } + + % + % Background path + % + \backgroundpath{ + \pgfpathrectanglecorners + {\pgfpointadd{\southwest}{\pgfpoint{\pgfshapeouterxsep}{\pgfshapeouterysep}}} + {\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfshapeouterxsep}{\pgfshapeouterysep}}}} + } +} + + + +% Special current bounding box rectangle: +\expandafter\def\csname pgf@sh@ns@current bounding box\endcsname{rectangle} +\expandafter\def\csname pgf@sh@np@current bounding box\endcsname{% + \def\southwest{\pgfpoint{\pgf@picminx}{\pgf@picminy}}% + \def\northeast{\pgfpoint{\pgf@picmaxx}{\pgf@picmaxy}}% +} +\expandafter\def\csname pgf@sh@nt@current bounding box\endcsname{{1}{0}{0}{1}{0pt}{0pt}} + + + +% +% Circle +% + +\pgfdeclareshape{circle} +% +% Draws a circle around the text +% +{ + \savedanchor\centerpoint{% + \pgf@x=.5\wd\pgfnodeparttextbox% + \pgf@y=.5\ht\pgfnodeparttextbox% + \advance\pgf@y by-.5\dp\pgfnodeparttextbox% + } + + \saveddimen\radius{% + % + % Caculate ``height radius'' + % + \pgf@ya=.5\ht\pgfnodeparttextbox% + \advance\pgf@ya by.5\dp\pgfnodeparttextbox% + \setlength\pgf@yb{\pgfshapeinnerysep}% + \advance\pgf@ya by\pgf@yb% + % + % Caculate ``width radius'' + % + \pgf@xa=.5\wd\pgfnodeparttextbox% + \setlength\pgf@xb{\pgfshapeinnerxsep}% + \advance\pgf@xa by\pgf@xb% + % + % Calculate length of radius vector: + % + \pgf@process{\pgfpointnormalised{\pgfpoint{\pgf@xa}{\pgf@ya}}}% + \ifdim\pgf@x>\pgf@y% + \c@pgf@counta=\pgf@x% + \ifnum\c@pgf@counta=0\relax% + \else% + \divide\c@pgf@counta by 255\relax% + \pgf@xa=16\pgf@xa\relax% + \divide\pgf@xa by\c@pgf@counta% + \pgf@xa=16\pgf@xa\relax% + \fi% + \else% + \c@pgf@counta=\pgf@y% + \ifnum\c@pgf@counta=0\relax% + \else% + \divide\c@pgf@counta by 255\relax% + \pgf@ya=16\pgf@ya\relax% + \divide\pgf@ya by\c@pgf@counta% + \pgf@xa=16\pgf@ya\relax% + \fi% + \fi% + \pgf@x=\pgf@xa% + % + % If necessary, adjust radius so that the size requirements are + % met: + % + \setlength{\pgf@xb}{\pgfshapeminwidth}% + \setlength{\pgf@yb}{\pgfshapeminheight}% + \ifdim\pgf@x<.5\pgf@xb% + \pgf@x=.5\pgf@xb% + \fi% + \ifdim\pgf@x<.5\pgf@yb% + \pgf@x=.5\pgf@yb% + \fi% + % + % Now, add larger of outer sepearations. + % + \setlength{\pgf@xb}{\pgfshapeouterxsep}% + \setlength{\pgf@yb}{\pgfshapeouterysep}% + \ifdim\pgf@xb<\pgf@yb% + \advance\pgf@x by\pgf@yb% + \else% + \advance\pgf@x by\pgf@xb% + \fi% + } + + % + % Anchors + % + \anchor{center}{\centerpoint} + \anchor{mid}{\centerpoint\setlength\pgf@y{.5ex}} + \anchor{base}{\centerpoint\pgf@y=0pt} + \anchor{north}{\centerpoint\advance\pgf@y by\radius} + \anchor{south}{\centerpoint\advance\pgf@y by-\radius} + \anchor{west}{\centerpoint\advance\pgf@x by-\radius} + \anchor{east}{\centerpoint\advance\pgf@x by\radius} + \anchor{mid west}{\centerpoint\advance\pgf@x by-\radius\setlength\pgf@y{.5ex}} + \anchor{mid east}{\centerpoint\advance\pgf@x by\radius\setlength\pgf@y{.5ex}} + \anchor{base west}{\centerpoint\advance\pgf@x by-\radius\pgf@y=0pt} + \anchor{base east}{\centerpoint\advance\pgf@x by\radius\pgf@y=0pt} + \anchor{north west}{ + \centerpoint + \pgf@xa=\radius + \advance\pgf@x by-0.707107\pgf@xa + \advance\pgf@y by0.707107\pgf@xa + } + \anchor{south west}{ + \centerpoint + \pgf@xa=\radius + \advance\pgf@x by-0.707107\pgf@xa + \advance\pgf@y by-0.707107\pgf@xa + } + \anchor{north east}{ + \centerpoint + \pgf@xa=\radius + \advance\pgf@x by0.707107\pgf@xa + \advance\pgf@y by0.707107\pgf@xa + } + \anchor{south east}{ + \centerpoint + \pgf@xa=\radius + \advance\pgf@x by0.707107\pgf@xa + \advance\pgf@y by-0.707107\pgf@xa + } + \anchorborder{ + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \edef\pgf@marshal{% + \noexpand\pgfpointborderellipse + {\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}} + {\noexpand\pgfpoint{\radius}{\radius}}% + }% + \pgf@marshal% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \centerpoint% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + } + + % + % Background path + % + \backgroundpath{ + \@tempdima=\radius% + \setlength{\pgf@xb}{\pgfshapeouterxsep}% + \setlength{\pgf@yb}{\pgfshapeouterysep}% + \ifdim\pgf@xb<\pgf@yb% + \advance\@tempdima by-\pgf@yb% + \else% + \advance\@tempdima by-\pgf@xb% + \fi% + \pgfpathcircle{\centerpoint}{\@tempdima}% + } +} + + + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbasesnakes.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbasesnakes.code.tex new file mode 100644 index 00000000000..7403f2a7b8e --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbasesnakes.code.tex @@ -0,0 +1,346 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfbasesnakes.code.tex,v 1.5 2005/10/10 08:38:29 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +\newdimen\pgfsnakeremainingdistance +\newdimen\pgfsnakecompleteddistance + + +% Creates a new pgf snake +% +% #1 = snake name +% #1 = initial state +% #3= states of the snake +% +% +% This command declares a new snake for later use. The second +% parameter specifies the states of the snake, see also the +% description of pgfpathsnake. +% +% Inside the code of #3 the command \state may be used. This command +% will only be defined while #3 is executed. +% +% Example: +% +% \pgfdeclaresnake{zig zag}{one zig zag} +% { +% \state{one zig zag}[width=10pt] +% { +% \pgfpathlineto{\pgfpoint{2.5pt}{2.5pt}} +% \pgfpathlineto{\pgfpoint{7.5pt}{-2.5pt}} +% \pgfpathlineto{\pgfpoint{10pt}{0pt}} +% } +% \state{final} +% { +% \pgfpathlineto{\pgfpoint{\pgfsnakeremainingdistance}{0pt}} +% } +% } + +\long\def\pgfdeclaresnake#1#2#3{% + \def\pgf@snake@name{#1}% + \@namedef{pgf@snake@@#1@initial}{#2}% + \let\pgf@orig@state=\state% + \let\state=\pgf@snake@state + #3 + \let\state=\pgf@orig@state% +} + + +% Sets the additional transformation applied to every segment of a snake +% +% #1 = transformation +% +% Example: +% +% \pgfsetsnakesegmenttransformation{\pgftransformyshift{5pt}} + +\def\pgfsetsnakesegmenttransformation#1{\def\pgf@snakeadditionaltransform{#1}} +\pgfsetsnakesegmenttransformation{} + + +% Declares a new state +% +% #1 = state name +% #2 = options +% #3 = path element +% +% Description: +% +% When a snake is drawn and the current state is #1, the following +% happens. First, the options are executed, which will possible change +% the state. If that does not happen, the path element is added to the +% path and the coordinate system is translated by the path element's +% width (which is specified using the width option). +% +% Example: +% +% \state{initial}[width=10pt] +% { +% \pgfpathlineto{\pgfpoint{2.5pt}{2.5pt}} +% \pgfpathlineto{\pgfpoint{7.5pt}{-2.5pt}} +% \pgfpathlineto{\pgfpoint{10pt}{0pt}} +% } + +\def\pgf@snake@state#1{\@ifnextchar[{\pgf@@snake@start#1}{\pgf@@snake@start#1[]}}%} +\def\pgf@@snake@start#1[#2]#3{% + \@namedef{pgf@snake@@\pgf@snake@name @#1@options}{#2}% + \@namedef{pgf@snake@@\pgf@snake@name @#1@code}{#3}% +} + + + +% Use multiple snakes +% +% #1 = list of snake names/length pairs +% #2 = point to which the snake leads +% +% This operation uses the snakes in parameter #1 to get to the point +% #4. The parameter #1 should contain pairs consisting of a snake name +% and a length for which this snake should be used. When the length is +% computed, the dimensions \pgfsnakeremainingdistance and +% \pgfsnakecompleteddistance will have been set to the length of the +% total distance to #2 that has already been covered/that still needs +% to be covered. +% +% Example: +% +% \pgfpathsnakesto{{lineto}{1cm},{zig zag}{\pgfsnakeremainingdistance}}{\pgfpoint{2cm}{3cm}} + +\def\pgfpathsnakesto#1#2{% + \begingroup% + % compute target vector + \pgfpointtransformed{#2}% + \advance\pgf@x by-\pgf@path@lastx% + \advance\pgf@y by-\pgf@path@lasty% + % Ok, now normalize the vector... + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgfpointnormalised{}}% + % ok, now computer length (arghh...) + % In theory that's easy: divide the larger of the values x or y by + % the normalizes x or y. Well... + % + % First, make xa and ya positive: + \ifdim\pgf@xa<0pt% + \pgf@xa=-\pgf@xa% + \fi% + \ifdim\pgf@ya<0pt% + \pgf@ya=-\pgf@ya% + \fi% + % Now do division: + \ifdim\pgf@xa>\pgf@ya% + \c@pgf@counta=\pgf@x% + \ifnum\c@pgf@counta=0\relax% + \else% + \divide\c@pgf@counta by 255\relax% + \pgf@xa=16\pgf@xa\relax% + \divide\pgf@xa by\c@pgf@counta% + \pgf@xa=16\pgf@xa\relax% + \fi% + \else% + \c@pgf@counta=\pgf@y% + \ifnum\c@pgf@counta=0\relax% + \else% + \divide\c@pgf@counta by 255\relax% + \pgf@ya=16\pgf@ya\relax% + \divide\pgf@ya by\c@pgf@counta% + \pgf@xa=16\pgf@ya\relax% + \fi% + \fi% + % Make positive: + \ifdim\pgf@xa<0pt% + \pgf@xa=-\pgf@xa% + \fi% + % Ok, now we draw things... + \edef\pgf@list{#1}% + \pgfsnakeremainingdistance=\pgf@xa% + \pgfsnakecompleteddistance=0pt% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \@for\pgf@temp:=\pgf@list\do{% + \ifx\pgf@temp\@empty% + \else% + \expandafter\pgf@snake@invoke\pgf@temp% + \fi% + }% + \endgroup% +} + +\def\pgf@snake@invoke#1#2{% + \setlength\pgf@xa{#2}% + {% + \edef\pgf@marshal{\noexpand\pgfpathsnakealongvector{#1}{\the\pgf@xa}{\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}}}% + \pgf@marshal% + }% + \advance\pgfsnakecompleteddistance by\pgf@xa% + \advance\pgfsnakeremainingdistance by-\pgf@xa% +} + +% Use a snake +% +% #1 = snake name +% #2 = point to which the snake leads +% +% This operation mainly computes \pgfpathsnakealongvector for a vector +% appropriately choosen. See \pgfpathsnakealongvector for details. +% +% Example: +% +% \pgfpathsnaketo{zig zag}{\pgfpoint{2cm}{3cm}} + +\def\pgfpathsnaketo#1#2{\pgfpathsnakesto{{#1}{\pgfsnakeremainingdistance}}{#2}} + + + +% Use a snake +% +% #1 = snake name +% #2 = length of the snake +% #3 = vector along which the snake grows, should have unit length. +% +% This command draws a snake (more precisely, it adds a snake to the +% path). This works as follows: +% +% First, the coordinate system is transformed such that the vector #3 +% points to the right. +% +% Next, the state `initial' of the snake is entered. Unless the +% options of this state cause it to switch to another state, the path +% element is added to the path. Then, the coordinate system is +% translated by the width of the path element as specified in the +% width option of the path element. The dimensions +% \pgfsnakeremainingdistance and \pgfsnakecompleteddistance are +% updated. +% +% The process ends when the state `final' is entered. The code of the +% final state is executed and the process stops. +% +% Example: +% +% \pgfpathsnakealongvector{zig zag}{100pt}{\pgfpolar{30}{1pt}} + +\def\pgfpathsnakealongvector#1#2#3{% + \@ifundefined{pgf@snake@@#1@initial}{\PackageError{pgf}{Undefined snake ``#1''}{}} + { + \begingroup% keep things local + \pgftransformreset% + \pgf@pt@x=\pgf@path@lastx% evil trickery to transform to the last point + \pgf@pt@y=\pgf@path@lasty% + \pgf@process{#3}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@xb=-\pgf@y% + \pgf@yb=\pgf@x% + \pgftransformcm + {\pgf@sys@tonumber{\pgf@xa}}{\pgf@sys@tonumber{\pgf@ya}} + {\pgf@sys@tonumber{\pgf@xb}}{\pgf@sys@tonumber{\pgf@yb}} + {\pgfpointorigin}% + % Now, setup the automaton + \expandafter\let\expandafter\pgf@snake@current@state\expandafter=\csname pgf@snake@@#1@initial\endcsname% + \def\pgf@snake@name{#1}% + \pgfsnakecompleteddistance=0pt% + \setlength\pgfsnakeremainingdistance{#2}% + \pgf@snake@run% + % Last step: + {% + \pgftransformxshift{\pgfsnakecompleteddistance}% + \pgf@snakeadditionaltransform% + \csname pgf@snake@@#1@final@code\endcsname% + }% + \endgroup% + }% +} + +\def\pgf@final@text{final} + +\def\pgf@snake@run{% + \let\pgf@snake@next=\pgf@snake@do@state% + \ifx\pgf@snake@current@state\pgf@final@text% + \let\pgf@snake@next=\relax% + \fi% + \pgf@snake@next% +} + +\def\pgf@snake@do@state{% + \let\pgf@snake@next=\relax% + \let\pgf@snake@next@state=\pgf@snake@current@state% + % execute options + \def\pgf@marshal{\setkeys{pgfsnake}}% + \expandafter\expandafter\expandafter\pgf@marshal + \expandafter\expandafter\expandafter{\csname pgf@snake@@\pgf@snake@name @\pgf@snake@current@state @options\endcsname}% + \ifx\pgf@snake@next\relax% + \pgf@snake@next=\pgf@snake@do@code% + \fi% + \pgf@snake@next% +} + +\def\pgf@snake@do@code{% + % Ok, execute code: + {% + \pgftransformxshift{\pgfsnakecompleteddistance}% + \pgf@snakeadditionaltransform% + \csname pgf@snake@@\pgf@snake@name @\pgf@snake@current@state @code\endcsname% + }% + % next, do transformation and update + \setlength{\pgf@xa}{\pgf@snake@width}% + \advance\pgfsnakeremainingdistance by-\pgf@xa% + \advance\pgfsnakecompleteddistance by\pgf@xa% + % Next iteration: + \let\pgf@snake@current@state=\pgf@snake@next@state% + \pgf@snake@run +} + +\define@key{pgfsnake}{width}{% + \def\pgf@snake@width{#1}% + \pgf@snake@switch@if#1 to final\pgf@stop% +} +\define@key{pgfsnake}{switch if less than}{% + \pgf@snake@switch@if#1\pgf@stop% +} +\define@key{pgfsnake}{next state}{% + \def\pgf@snake@next@state{#1}% +} + +\def\pgf@snake@switch@if#1to #2\pgf@stop{% + \ifx\pgf@snake@next\relax% + \setlength\pgf@x{#1}% + \ifdim\pgfsnakeremainingdistance<\pgf@x% + \def\pgf@snake@current@state{#2}% + \let\pgf@snake@next=\pgf@snake@run% + \fi% + \fi% +} + + + +% lineto snake +% +% This snake simply adds a straight line. This snake is mainly useful +% in conjunction with other snakes. + +\pgfdeclaresnake{lineto}{final} +{ + \state{final} + { \pgfpathlineto{\pgfpoint{\pgfsnakeremainingdistance}{0pt}} } +} + + + +% moveto snake +% +% This snake simply jumps to the end. This snake, too, is mainly +% useful in conjunction with other snakes. + +\pgfdeclaresnake{moveto}{final} +{ + \state{final} + { \pgfpathmoveto{\pgfpoint{\pgfsnakeremainingdistance}{0pt}} } +} + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex new file mode 100644 index 00000000000..3496b92cf6d --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex @@ -0,0 +1,23 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcore.code.tex,v 1.2 2005/07/06 15:58:57 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + +\newif\ifpgf@draftmode + +\input pgfcoremath.code.tex +\input pgfcorepoints.code.tex +\input pgfcorepathconstruction.code.tex +\input pgfcorepathusage.code.tex +\input pgfcorescopes.code.tex +\input pgfcoregraphicstate.code.tex +\input pgfcoretransformations.code.tex +\input pgfcorequick.code.tex +\input pgfcoreobjects.code.tex +\input pgfcorepathprocessing.code.tex +\input pgfcorearrows.code.tex +\input pgfcoreshade.code.tex + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex new file mode 100644 index 00000000000..0283f40c4d2 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex @@ -0,0 +1,510 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorearrows.code.tex,v 1.2 2005/07/10 20:11:23 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + +% Sets the end arrow +% +% #1 = An arrow name +% +% Example: +% +% \pgfsetarrowsend{stealth} + +\def\pgfsetarrowsend#1{\pgf@arrowset{end}{#1}} +\def\pgf@arrowset#1#2{% + \@ifundefined{pgf@arrow@code@#2} + {\PackageError{pgf}{Arrow #1 type ``#2'' unknown}{}} + {% + \edef\pgf@arrow@temp{#2}% + \ifx\pgf@arrow@temp\@empty% ah. clear! + \expandafter\let\csname pgf@#1arrow\endcsname=\@empty% + \expandafter\let\csname pgf@shorten@#1\endcsname=\@empty% + \else% + %\pgf@arrow@prepare{#2}% + \expandafter\def\csname pgf@#1arrow\endcsname{\pgf@arrow@call{#2}}% + \expandafter\edef\csname pgf@shorten@#1\endcsname{\expandafter\noexpand\csname pgf@arrow@right@#2\endcsname}% + \fi% + }% +} + + +% Sets the start arrow +% +% #1 = An arrow name +% +% Example: +% +% \pgfsetarrowsstart{stealth} + +\def\pgfsetarrowsstart#1{\pgf@arrowset{start}{\csname pgf@arrows@invert#1\endcsname}} + +\def\pgf@arrows@invname#1#2{\expandafter\def\csname pgf@arrows@invert#1\endcsname{#2}} +\pgf@arrows@invname{}{} + + + + +% Sets arrows +% +% #1 = An arrow specification of the form ``left''-``right''. The last +% and right should be arrow types that have been defined using +% the \pgfarrowsdef command +% +% Example: +% +% \pgfsetarrows{-to} + +\def\pgfsetarrows#1{\pgf@arrows#1\pgf@stop} +\def\pgf@arrows#1-#2\pgf@stop{% + \pgfsetarrowsstart{#1} + \pgfsetarrowsend{#2} +} + +\def\pgf@arrows@checked#1#2#3{% + \@ifundefined{pgf@arrow@code@#2}% + {% + \PackageError{pgf}{Arrow end type ``#2'' unknown}{}}% + {% + \@ifundefined{pgf@arrow@code@\csname pgf@arrows@invert#1\endcsname} + {\PackageError{pgf}{Arrow start type ``#1'' unknown}{}}% + {#3}% + }% +} + +\def\pgf@arrows@check@already#1#2#3{% + \@ifundefined{pgf@arrow@code@#2} + {#3}% + {\PackageError{pgf}{Arrow end type ``#2'' already defined}{}}% +} + + +% Called when an arrow needs to be rendered + +\def\pgf@arrow@call#1{% + \expandafter\ifx\csname pgf@arrow@prot@#1@\the\pgflinewidth\endcsname\relax% + \pgfsysprotocol@getcurrentprotocol\pgf@arrow@temp% + {% + \pgfinterruptpath% + \let\pgfusepath=\pgf@nousepath@here% + \pgf@relevantforpicturesizefalse% + \pgftransformreset% + \pgfsysprotocol@setcurrentprotocol\@empty% + \pgfsysprotocol@bufferedtrue% + \pgfsys@beginscope% + \csname pgf@arrow@code@#1\endcsname% + \pgfsys@endscope% + \pgfsysprotocol@getcurrentprotocol\pgf@@arrow@temp% + \global\let\pgf@@arrow@temp=\pgf@@arrow@temp% + \endpgfinterruptpath% + \expandafter\xdef\csname pgf@arrow@prot@#1@\the\pgflinewidth\endcsname{% + \noexpand\pgfsys@invoke{\pgf@@arrow@temp}}% + }% + \pgfsysprotocol@setcurrentprotocol\pgf@arrow@temp% + \fi% + \csname pgf@arrow@prot@#1@\the\pgflinewidth\endcsname% +} + +\def\pgf@arrow@code@{} % dummy + +\def\pgf@nousepath@here#1{% + \PackageError{pgf}{The definition of an arrow may not use \string\pgfusepath}{} +} + + + +% Define an arrow type. +% +% #1 = name or mnemonic for arrow when used at the start (examples: ``to'' or ``<'') +% #2 = name or mnemonic for arrow when used at the end (examples: ``to'' or ``>'') +% #3 = code to setup the left and right extend of the arrow. To set +% the left extend, call \pgfarrowsleftextend, for the right \pgfarrowsrightextend. +% #4 = protocolable code +% +% Description: +% +% When you define an arrow using this command, you must give two +% names. The first is used for the arrow when it is ``at the start'', +% the other when it is at the end. For example, a simple arrow might +% have the names ``<'' and ``>'', though these particular names are +% not used by pgf and left for the user. +% +% The code should be ``protocolable'' code. This means that it uses +% only pretty simple commands. +% +% The arrow code will be protocolled once for each line width at which +% the arrow is used. Thus, the code can (and often should) depend on +% the line width. +% +% The arrow should ``point right'' in the coordinate system. The end +% of the line at which the arrow should be drawn will be at the origin +% of the coordinate system. The coordinate system will be scaled and +% rotated appropriately before the arrow is drawn. +% +% The right extend of the arrow should be set to how much the arrow +% ``protrudes over the right''. Prior to drawing the arrow, the line +% will be shortened by this amount so that the arrow tip will exactly +% touch the original right end of the unshortened line. +% +% The left extend specifies the leftmost point of the arrow. This is +% important only if you use the swapping command, when this end is +% used to compute the shortening. +% +% The definition of an arrow should normally take care of the fact +% that the line cap of the main line may be a butt cap, a round cap or +% a rect cap. In all cases, the arrow should ``cover'' the cap +% completely or not at all. +% +% Example: +% +% \pgfarrowsdeclare{stealth}{stealth} +% { +% \pgfarrowsleftextend{-6\pgflinewidth} +% \pgfarrowsrightextend{2\pgflinewidth} +% { +% \pgfpathmoveto{\pgfpoint{2\pgflinewidth}{0pt}} +% \pgfpathlineto{\pgfpoint{-6\pgflinewidth}{4\pgflinewidth}} +% \pgfpathlineto{\pgfpoint{-3\pgflinewidth}{0pt}} +% \pgfpathlineto{\pgfpoint{-6\pgflinewidth}{-4\pgflinewidth}} +% \pgfusepathqfill +% } + +\def\pgfarrowsdeclare#1#2#3#4{% + \pgf@arrows@check@already{#1}{#2} + {% + \expandafter\def\csname pgf@arrow@code@#2\endcsname{#4}% + \expandafter\def\csname pgf@arrow@left@#2\endcsname{#3\advance\pgf@x by-\pgf@xa}% + \expandafter\def\csname pgf@arrow@right@#2\endcsname{#3\advance\pgf@x by\pgf@xb}% + \pgf@arrows@invname{#1}{#2}% + }% +} + +\def\pgfarrowsleftextend#1{\setlength\pgf@xa{#1}} +\def\pgfarrowsrightextend#1{\setlength\pgf@xb{#1}} + +\def\pgf@arrows@repeat#1#2{% + \edef\pgf@arrows@marshal{\noexpand\let\expandafter\noexpand\csname#2\endcsname=\expandafter\noexpand\csname#1\endcsname}% + \pgf@arrows@marshal} + + + +% Declare a new arrow type to be the same as another one. +% +% #1 = name of new start +% #2 = name or new end +% #3 = name or old start +% #4 = name or old end +% +% Example: +% +% \pgfarrowsdeclarealias{<}{>}{to}{to} + +\def\pgfarrowsdeclarealias#1#2#3#4{% + \pgf@arrows@check@already{#1}{#2} + {% + \pgf@arrows@checked{#3}{#4}% + {% + \pgf@arrows@repeat{pgf@arrow@code@#4}{pgf@arrow@code@#2}% + \pgf@arrows@repeat{pgf@arrow@left@#4}{pgf@arrow@left@#2}% + \pgf@arrows@repeat{pgf@arrow@right@#4}{pgf@arrow@right@#2}% + \pgf@arrows@invname{#1}{#2}% + }% + }% +} + + + + +% Creates a new arrows by ``swapping'' an existing arrow. +% +% #1 = name of new start +% #2 = name of new end +% #3 = name of old start +% #4 = name of old end +% +% Example: +% +% \pgfarrowsdeclarealias{]}{[}{[}{]} + +\def\pgfarrowsdeclarereversed#1#2#3#4{% + \pgf@arrows@check@already{#1}{#2}% + {% + \pgf@arrows@checked{#3}{#4}% + {% + \expandafter\def\csname pgf@arrow@code@#2\endcsname{% + \pgflowlevel{\pgftransformxscale{-1}}% + \csname pgf@arrow@code@#4\endcsname}% + \pgf@arrows@repeat{pgf@arrow@right@#4}{pgf@arrow@left@#2}% + \pgf@arrows@repeat{pgf@arrow@left@#4}{pgf@arrow@right@#2}% + \pgf@arrows@invname{#1}{#2}% + }% + }% +} + + + +% Creates new arrows by combining two existing arrows. +% +% #1 = optional additional space +% #2 = name of new start +% #3 = name of new end +% #4 = name of second (innermost) start +% #5 = name of second end +% #6 = name of first (outermost) start +% #7 = name of first end +% +% In the star form, the line will end at the innermost arrows, +% otherwise the line will end at the outermost arrows. +% +% Example: +% +% \pgfarrowsdeclarecombine*{|<}{>|}{|}{|}{<}{>} +% \pgfarrowsdeclarecombine{<<}{>>}{<}{>}{<}{>} + +\def\pgfarrowsdeclarecombine{\@ifnextchar*{\pgfarrowsdeclarecombine@star}{\pgf@@arrowsdeclarecombine}} + +\def\pgf@@arrowsdeclarecombine{\@ifnextchar[{\pgf@arrowsdeclarecombine}{\pgf@arrowsdeclarecombine[0pt]}} +\def\pgf@arrowsdeclarecombine[#1]#2#3#4#5#6#7{% + \pgf@arrows@check@already{#2}{#3}% + {% + \pgf@arrows@checked{#4}{#5}% + {% + \pgf@arrows@checked{#6}{#7}% + {% + \expandafter\edef\csname pgf@arrow@code@#3\endcsname{% + \noexpand\pgfscope% + {\expandafter\noexpand\csname pgf@arrow@code@#7\endcsname}% + \noexpand\endpgfscope% + {% + \noexpand\setlength\pgf@x{#1}% + \noexpand\pgf@process{\expandafter\noexpand\csname pgf@arrow@left@#7\endcsname}% + \noexpand\pgf@process{\expandafter\noexpand\csname pgf@arrow@right@#5\endcsname}% + \pgf@x=-\pgf@x% + \noexpand\pgflowlevel{\noexpand\pgftransformxshift{\pgf@x}}% + \expandafter\noexpand\csname pgf@arrow@code@#5\endcsname}% + }% + \pgf@arrows@repeat{pgf@arrow@right@#7}{pgf@arrow@right@#3}% + \expandafter\def\csname pgf@arrow@left@#3\endcsname{% + \pgf@process{% + \setlength\pgf@y{#1}% + \advance\pgf@x by\pgf@y% + \pgf@process{\csname pgf@arrow@left@#7\endcsname}% + \pgf@process{\csname pgf@arrow@right@#5\endcsname}% + \pgf@process{\csname pgf@arrow@left@#5\endcsname}% + }% + }% + \pgf@arrows@invname{#2}{#3}% + }% + }% + }% +} + +\def\pgfarrowsdeclarecombine@star*{\@ifnextchar[{\pgf@arrowsdeclarecombine@star}{\pgf@arrowsdeclarecombine@star[0pt]}} +\def\pgf@arrowsdeclarecombine@star[#1]#2#3#4#5#6#7{% + \pgf@arrows@check@already{#2}{#3}% + {% + \pgf@arrows@checked{#4}{#5}% + {% + \pgf@arrows@checked{#6}{#7}% + {% + \expandafter\edef\csname pgf@arrow@code@#3\endcsname{% + \noexpand\pgfscope% + {% + \noexpand\setlength\pgf@x{#1}% + \pgf@process{\expandafter\noexpand\csname pgf@arrow@left@#7\endcsname}% + \pgf@process{\expandafter\noexpand\csname pgf@arrow@right@#5\endcsname}% + \noexpand\pgflowlevel{\noexpand\pgftransformxshift{\pgf@x}}% + }% + {\expandafter\noexpand\csname pgf@arrow@code@#7\endcsname}% + \noexpand\endpgfscope% + \expandafter\noexpand\csname pgf@arrow@code@#5\endcsname% + }% + \pgf@arrows@repeat{pgf@arrow@left@#7}{pgf@arrow@left@#3}% + \expandafter\def\csname pgf@arrow@right@#3\endcsname{% + \pgf@process{% + \setlength\pgf@y{#1}% + \advance\pgf@x by\pgf@y% + \pgf@process{\csname pgf@arrow@left@#7\endcsname}% + \pgf@process{\csname pgf@arrow@right@#5\endcsname}% + \pgf@process{\csname pgf@arrow@right@#7\endcsname}% + }% + }% + \pgf@arrows@invname{#2}{#3}% + }% + }% + }% +} + + + +% Creates new arrows by doubling/tripling existing arrows. +% +% #1 = optional additional space in multiples of line width +% #2 = name of new start +% #3 = name of new end +% #4 = name of old start +% #5 = name of old end +% +% Example: +% +% \pgfarrowsdeclaredouble{<<}{>>}{<}{>} + +\def\pgfarrowsdeclaredouble{\@ifnextchar[{\pgf@arrowsdeclaredouble}{\pgf@arrowsdeclaredouble[0pt]}} +\def\pgf@arrowsdeclaredouble[#1]#2#3#4#5{\pgfarrowsdeclarecombine[#1]{#2}{#3}{#4}{#5}{#4}{#5}} +\def\pgfarrowsdeclaretriple{\@ifnextchar[{\pgf@arrowsdeclaretriple}{\pgf@arrowsdeclaretriple[0pt]}} +\def\pgf@arrowsdeclaretriple[#1]#2#3#4#5{% + \pgfarrowsdeclarecombine[#1]{pgf@trip@#2}{pgf@trip@#3}{#4}{#5}{#4}{#5}% + \pgfarrowsdeclarecombine[#1]{#2}{#3}{pgf@trip@#2}{pgf@trip@#3}{#4}{#5}% +} + + +% A stealth-fighter-like pointed arrow +% +% Example: +% +% \pgfsetarrows{-stealth} + +\pgfarrowsdeclare{stealth}{stealth} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfarrowsleftextend{-3\@tempdima} + \pgfarrowsrightextend{5\@tempdima} +} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfpathmoveto{\pgfpoint{5\@tempdima}{0pt}} + \pgfpathlineto{\pgfpoint{-3\@tempdima}{4\@tempdima}} + \pgfpathlineto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{-3\@tempdima}{-4\@tempdima}} + \pgfusepathqfill +} + +\pgfarrowsdeclarereversed{stealth reversed}{stealth reversed}{stealth}{stealth} + + +% An arrow similar to the $\to$ arrow +% +% Example: +% +% \pgfsetarrow{-to} + +\pgfarrowsdeclare{to}{to} +{ + \@tempdima=-0.84pt% + \advance\@tempdima by-1.3\pgflinewidth% + \@tempdimb=0.21pt% + \advance\@tempdimb by.625\pgflinewidth% + \pgfarrowsleftextend{\@tempdima} + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfsetlinewidth{0.8\pgflinewidth} + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfsetroundjoin + \pgfpathmoveto{\pgfpoint{-3\@tempdima}{4\@tempdima}} + \pgfpathcurveto + {\pgfpoint{-2.75\@tempdima}{2.5\@tempdima}} + {\pgfpoint{0pt}{0.25\@tempdima}} + {\pgfpoint{0.75\@tempdima}{0pt}} + \pgfpathcurveto + {\pgfpoint{0pt}{-0.25\@tempdima}} + {\pgfpoint{-2.75\@tempdima}{-2.5\@tempdima}} + {\pgfpoint{-3\@tempdima}{-4\@tempdima}} + \pgfusepathqstroke +} + +\pgfarrowsdeclare{to reversed}{to reversed} +{ + \@tempdima=-0.21pt% + \advance\@tempdima by-0.475\pgflinewidth% + \@tempdimb=0.98pt% + \advance\@tempdimb by1.45\pgflinewidth% + \pgfarrowsleftextend{\@tempdima} + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfsetlinewidth{0.8\pgflinewidth} + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfsetroundjoin + \pgfpathmoveto{\pgfpoint{3.5\@tempdima}{4\@tempdima}} + \pgfpathcurveto + {\pgfpoint{3.25\@tempdima}{2.5\@tempdima}} + {\pgfpoint{0.5\@tempdima}{0.25\@tempdima}} + {\pgfpoint{-0.25\@tempdima}{0\@tempdima}} + \pgfpathcurveto + {\pgfpoint{0.5\@tempdima}{-0.25\@tempdima}} + {\pgfpoint{3.25\@tempdima}{-2.5\@tempdima}} + {\pgfpoint{3.5\@tempdima}{-4\@tempdima}} + \pgfusepathqstroke +} + + + +% LaTeX's orginal arrow type +% +% Example: +% +% \pgfsetarrows{-latex} + +\pgfarrowsdeclare{latex}{latex} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfarrowsleftextend{-1\@tempdima} + \pgfarrowsrightextend{9\@tempdima} +} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfpathmoveto{\pgfpoint{9\@tempdima}{0pt}} + \pgfpathcurveto + {\pgfpoint{6.3333\@tempdima}{.5\@tempdima}} + {\pgfpoint{2\@tempdima}{2\@tempdima}} + {\pgfpoint{-1\@tempdima}{3.75\@tempdima}} + \pgfpathlineto{\pgfpoint{-1\@tempdima}{-3.75\@tempdima}} + \pgfpathcurveto + {\pgfpoint{2\@tempdima}{-2\@tempdima}} + {\pgfpoint{6.3333\@tempdima}{-.5\@tempdima}} + {\pgfpoint{9\@tempdima}{0pt}} + \pgfusepathqfill +} +\pgfarrowsdeclarereversed{latex reversed}{latex reversed}{latex}{latex} + + + +% A bar shaped arrow +% +% Example: +% +% \pgfsetarrows{-|} + +\pgfarrowsdeclare{|}{|} +{ + \pgfarrowsleftextend{-0.25\pgflinewidth} + \pgfarrowsrightextend{.75\pgflinewidth} +} +{ + \@tempdima=2pt% + \advance\@tempdima by1.5\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetrectcap + \pgfpathmoveto{\pgfpoint{0.25\pgflinewidth}{-\@tempdima}} + \pgfpathlineto{\pgfpoint{0.25\pgflinewidth}{\@tempdima}} + \pgfusepathqstroke +} + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex new file mode 100644 index 00000000000..f417efcab54 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex @@ -0,0 +1,254 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex,v 1.3 2005/09/21 00:05:34 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + +% Globals + +\newdimen\pgflinewidth + + +% Set the line width to #1. +% +% #1 = new line width. +% +% Example: +% +% \pgfsetlinewidth{3pt} + +\def\pgfsetlinewidth#1{% + \setlength\pgflinewidth{#1}% + \global\pgflinewidth=\pgflinewidth% + \pgfsys@setlinewidth{\the\pgflinewidth}% + \ignorespaces} + + +% 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}% + \setlength\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% + \setlength\pgf@x{#1}% + \ifx\pgf@temp\@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{% + \colorlet{pgf@tempcolor}{#1}% + \@ifundefined{applycolormixins}{}{\applycolormixins{pgf@tempcolor}}% + \expandafter\expandafter\expandafter\pgf@setstrokecolor\csname\string\color@pgf@tempcolor\endcsname% +} +\def\pgf@setstrokecolor#1#2#3#4#5{% + \expandafter\ifx\csname pgfsys@color@#4@stroke\endcsname\relax% + \PackageError{pgfbase}{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\@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{% + \colorlet{pgf@tempcolor}{#1}% + \@ifundefined{applycolormixins}{}{\applycolormixins{pgf@tempcolor}}% + \expandafter\expandafter\expandafter\pgf@setfillcolor\csname\string\color@pgf@tempcolor\endcsname% +} +\def\pgf@setfillcolor#1#2#3#4#5{% + \expandafter\ifx\csname pgfsys@color@#4@fill\endcsname\relax% + \PackageError{pgfbase}{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{% + \colorlet{pgf@tempcolor}{#1}% + \@ifundefined{applycolormixins}{}{\applycolormixins{pgf@tempcolor}}% + \expandafter\expandafter\expandafter\pgf@setcolor\csname\string\color@pgf@tempcolor\endcsname% +} +\def\pgf@setcolor#1#2#3#4#5{% + \expandafter\ifx\csname pgfsys@color@#4\endcsname\relax% + \PackageError{pgfbase}{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} + + +% Sets the opacity of stroking operations. +% +% #1 = opacity, where 1 means fully opaque and 0 means fully +% transparent. +% +% Example: +% +% \pgfsetstrokeopacity{0.5} + +\def\pgfsetstrokeopacity#1{% + \edef\pgf@temp{{#1}}% + \expandafter\pgfsys@stroke@opacity\pgf@temp} + + +% Sets the opacity of stroking operations. +% +% #1 = opacity, where 1 means fully opaque and 0 means fully +% transparent. +% +% Example: +% +% \pgfsetfillopacity{0.5} + +\def\pgfsetfillopacity#1{% + \edef\pgf@temp{{#1}}% + \expandafter\pgfsys@fill@opacity\pgf@temp} + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoremath.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoremath.code.tex new file mode 100644 index 00000000000..a05d934f12b --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoremath.code.tex @@ -0,0 +1,262 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoremath.code.tex,v 1.1.1.1 2005/06/29 12:14:04 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +% Mathematical stuff + + +% Internal registers +\newcounter{pgf@counta} +\newcounter{pgf@countb} +\newcounter{pgf@countc} +\newcounter{pgf@countd} + +% Internal setting function +\def\pgf@setmath#1#2{\edef\pgf@temp{#2pt}\csname pgf@#1\endcsname=\pgf@temp} + + +% Calculate sin of a degree +% +% #1 = degree +% +% x = sin of #1 +% +% Example: +% +% \pgfsin{30} + +\def\pgfsin#1{% + \pgf@setcounter{pgf@counta}{#1}\relax% + \c@pgf@countb=90% + \advance\c@pgf@countb by-\c@pgf@counta% + \ifnum\c@pgf@countb>179% + \advance\c@pgf@countb by-360% + \else% + \ifnum\c@pgf@countb<-179% + \advance\c@pgf@countb by360% + \fi\fi% + \ifnum\c@pgf@countb<0\relax% + \c@pgf@countb=-\c@pgf@countb% + \fi% + \pgf@setmath{x}{\csname pgf@cos\the\c@pgf@countb\endcsname}} + + +% Calculate cos of a degree +% +% #1 = degree +% +% x = cos of #1 +% +% Example: +% +% \pgfcos{30} + +\def\pgfcos#1{% + \pgf@setcounter{pgf@counta}{#1}% + \ifnum\c@pgf@counta>179% + \advance\c@pgf@counta by-360% + \else% + \ifnum\c@pgf@counta<-179% + \advance\c@pgf@counta by360% + \fi\fi% + \ifnum\c@pgf@counta<0\relax% + \c@pgf@counta=-\c@pgf@counta% + \fi% + \pgf@setmath{x}{\csname pgf@cos\the\c@pgf@counta\endcsname}} + + + +% Calculate sin and cos of a degree +% +% #1 = degree +% +% x = cos of #1 +% y = sin of #1 +% +% Example: +% +% \pgfcos{30} + +\def\pgfsincos#1{% + \pgf@setcounter{pgf@counta}{#1}% + \ifnum\c@pgf@counta>179% + \advance\c@pgf@counta by-360% + \else% + \ifnum\c@pgf@counta<-179% + \advance\c@pgf@counta by360% + \fi\fi\relax% + \c@pgf@countb=\c@pgf@counta\relax% + \ifnum\c@pgf@counta<0\relax% + \c@pgf@counta=-\c@pgf@counta% + \fi\relax% + \pgf@setmath{y}{\csname pgf@cos\the\c@pgf@counta\endcsname}% + \c@pgf@counta=90% + \advance\c@pgf@counta by-\c@pgf@countb\relax% + \ifnum\c@pgf@counta>179% + \advance\c@pgf@counta by-360% + \else% + \ifnum\c@pgf@counta<-179% + \advance\c@pgf@counta by360% + \fi\fi\relax% + \ifnum\c@pgf@counta<0\relax% + \c@pgf@counta=-\c@pgf@counta% + \fi\relax% + \pgf@setmath{x}{\csname pgf@cos\the\c@pgf@counta\endcsname}} + + +% Internal tables + +\def\pgf@def#1#2#3{\expandafter\def\csname pgf@#1#2\endcsname{#3}} +\pgf@def{cos}{0}{1} \pgf@def{cos}{1}{0.999848} +\pgf@def{cos}{2}{0.999391} \pgf@def{cos}{3}{0.99863} +\pgf@def{cos}{4}{0.997564} \pgf@def{cos}{5}{0.996195} +\pgf@def{cos}{6}{0.994522} \pgf@def{cos}{7}{0.992546} +\pgf@def{cos}{8}{0.990268} \pgf@def{cos}{9}{0.987688} +\pgf@def{cos}{10}{0.984808} \pgf@def{cos}{11}{0.981627} +\pgf@def{cos}{12}{0.978148} \pgf@def{cos}{13}{0.97437} +\pgf@def{cos}{14}{0.970296} \pgf@def{cos}{15}{0.965926} +\pgf@def{cos}{16}{0.961262} \pgf@def{cos}{17}{0.956305} +\pgf@def{cos}{18}{0.951057} \pgf@def{cos}{19}{0.945519} +\pgf@def{cos}{20}{0.939693} \pgf@def{cos}{21}{0.93358} +\pgf@def{cos}{22}{0.927184} \pgf@def{cos}{23}{0.920505} +\pgf@def{cos}{24}{0.913545} \pgf@def{cos}{25}{0.906308} +\pgf@def{cos}{26}{0.898794} \pgf@def{cos}{27}{0.891007} +\pgf@def{cos}{28}{0.882948} \pgf@def{cos}{29}{0.87462} +\pgf@def{cos}{30}{0.866025} \pgf@def{cos}{31}{0.857167} +\pgf@def{cos}{32}{0.848048} \pgf@def{cos}{33}{0.838671} +\pgf@def{cos}{34}{0.829038} \pgf@def{cos}{35}{0.819152} +\pgf@def{cos}{36}{0.809017} \pgf@def{cos}{37}{0.798636} +\pgf@def{cos}{38}{0.788011} \pgf@def{cos}{39}{0.777146} +\pgf@def{cos}{40}{0.766044} \pgf@def{cos}{41}{0.75471} +\pgf@def{cos}{42}{0.743145} \pgf@def{cos}{43}{0.731354} +\pgf@def{cos}{44}{0.71934} \pgf@def{cos}{45}{0.707107} +\pgf@def{cos}{46}{0.694658} \pgf@def{cos}{47}{0.681998} +\pgf@def{cos}{48}{0.669131} \pgf@def{cos}{49}{0.656059} +\pgf@def{cos}{50}{0.642788} \pgf@def{cos}{51}{0.62932} +\pgf@def{cos}{52}{0.615661} \pgf@def{cos}{53}{0.601815} +\pgf@def{cos}{54}{0.587785} \pgf@def{cos}{55}{0.573576} +\pgf@def{cos}{56}{0.559193} \pgf@def{cos}{57}{0.544639} +\pgf@def{cos}{58}{0.529919} \pgf@def{cos}{59}{0.515038} +\pgf@def{cos}{60}{0.5} \pgf@def{cos}{61}{0.48481} +\pgf@def{cos}{62}{0.469472} \pgf@def{cos}{63}{0.45399} +\pgf@def{cos}{64}{0.438371} \pgf@def{cos}{65}{0.422618} +\pgf@def{cos}{66}{0.406737} \pgf@def{cos}{67}{0.390731} +\pgf@def{cos}{68}{0.374607} \pgf@def{cos}{69}{0.358368} +\pgf@def{cos}{70}{0.34202} \pgf@def{cos}{71}{0.325568} +\pgf@def{cos}{72}{0.309017} \pgf@def{cos}{73}{0.292372} +\pgf@def{cos}{74}{0.275637} \pgf@def{cos}{75}{0.258819} +\pgf@def{cos}{76}{0.241922} \pgf@def{cos}{77}{0.224951} +\pgf@def{cos}{78}{0.207912} \pgf@def{cos}{79}{0.190809} +\pgf@def{cos}{80}{0.173648} \pgf@def{cos}{81}{0.156434} +\pgf@def{cos}{82}{0.139173} \pgf@def{cos}{83}{0.121869} +\pgf@def{cos}{84}{0.104528} \pgf@def{cos}{85}{0.0871557} +\pgf@def{cos}{86}{0.0697565} \pgf@def{cos}{87}{0.052336} +\pgf@def{cos}{88}{0.0348995} \pgf@def{cos}{89}{0.0174524} +\pgf@def{cos}{90}{0} \pgf@def{cos}{91}{-0.0174524} +\pgf@def{cos}{92}{-0.0348995} \pgf@def{cos}{93}{-0.052336} +\pgf@def{cos}{94}{-0.0697565} \pgf@def{cos}{95}{-0.0871557} +\pgf@def{cos}{96}{-0.104528} \pgf@def{cos}{97}{-0.121869} +\pgf@def{cos}{98}{-0.139173} \pgf@def{cos}{99}{-0.156434} +\pgf@def{cos}{100}{-0.173648} \pgf@def{cos}{101}{-0.190809} +\pgf@def{cos}{102}{-0.207912} \pgf@def{cos}{103}{-0.224951} +\pgf@def{cos}{104}{-0.241922} \pgf@def{cos}{105}{-0.258819} +\pgf@def{cos}{106}{-0.275637} \pgf@def{cos}{107}{-0.292372} +\pgf@def{cos}{108}{-0.309017} \pgf@def{cos}{109}{-0.325568} +\pgf@def{cos}{110}{-0.34202} \pgf@def{cos}{111}{-0.358368} +\pgf@def{cos}{112}{-0.374607} \pgf@def{cos}{113}{-0.390731} +\pgf@def{cos}{114}{-0.406737} \pgf@def{cos}{115}{-0.422618} +\pgf@def{cos}{116}{-0.438371} \pgf@def{cos}{117}{-0.45399} +\pgf@def{cos}{118}{-0.469472} \pgf@def{cos}{119}{-0.48481} +\pgf@def{cos}{120}{-0.5} \pgf@def{cos}{121}{-0.515038} +\pgf@def{cos}{122}{-0.529919} \pgf@def{cos}{123}{-0.544639} +\pgf@def{cos}{124}{-0.559193} \pgf@def{cos}{125}{-0.573576} +\pgf@def{cos}{126}{-0.587785} \pgf@def{cos}{127}{-0.601815} +\pgf@def{cos}{128}{-0.615661} \pgf@def{cos}{129}{-0.62932} +\pgf@def{cos}{130}{-0.642788} \pgf@def{cos}{131}{-0.656059} +\pgf@def{cos}{132}{-0.669131} \pgf@def{cos}{133}{-0.681998} +\pgf@def{cos}{134}{-0.694658} \pgf@def{cos}{135}{-0.707107} +\pgf@def{cos}{136}{-0.71934} \pgf@def{cos}{137}{-0.731354} +\pgf@def{cos}{138}{-0.743145} \pgf@def{cos}{139}{-0.75471} +\pgf@def{cos}{140}{-0.766044} \pgf@def{cos}{141}{-0.777146} +\pgf@def{cos}{142}{-0.788011} \pgf@def{cos}{143}{-0.798636} +\pgf@def{cos}{144}{-0.809017} \pgf@def{cos}{145}{-0.819152} +\pgf@def{cos}{146}{-0.829038} \pgf@def{cos}{147}{-0.838671} +\pgf@def{cos}{148}{-0.848048} \pgf@def{cos}{149}{-0.857167} +\pgf@def{cos}{150}{-0.866025} \pgf@def{cos}{151}{-0.87462} +\pgf@def{cos}{152}{-0.882948} \pgf@def{cos}{153}{-0.891007} +\pgf@def{cos}{154}{-0.898794} \pgf@def{cos}{155}{-0.906308} +\pgf@def{cos}{156}{-0.913545} \pgf@def{cos}{157}{-0.920505} +\pgf@def{cos}{158}{-0.927184} \pgf@def{cos}{159}{-0.93358} +\pgf@def{cos}{160}{-0.939693} \pgf@def{cos}{161}{-0.945519} +\pgf@def{cos}{162}{-0.951057} \pgf@def{cos}{163}{-0.956305} +\pgf@def{cos}{164}{-0.961262} \pgf@def{cos}{165}{-0.965926} +\pgf@def{cos}{166}{-0.970296} \pgf@def{cos}{167}{-0.97437} +\pgf@def{cos}{168}{-0.978148} \pgf@def{cos}{169}{-0.981627} +\pgf@def{cos}{170}{-0.984808} \pgf@def{cos}{171}{-0.987688} +\pgf@def{cos}{172}{-0.990268} \pgf@def{cos}{173}{-0.992546} +\pgf@def{cos}{174}{-0.994522} \pgf@def{cos}{175}{-0.996195} +\pgf@def{cos}{176}{-0.997564} \pgf@def{cos}{177}{-0.99863} +\pgf@def{cos}{178}{-0.999391} \pgf@def{cos}{179}{-0.999848} +\pgf@def{cos}{180}{-1} + + + +\pgf@def{cosfrac}{0}{1} +\pgf@def{cosfrac}{1}{0.99995} \pgf@def{cosfrac}{2}{0.9998} +\pgf@def{cosfrac}{3}{0.99955} \pgf@def{cosfrac}{4}{0.999201} +\pgf@def{cosfrac}{5}{0.998752} \pgf@def{cosfrac}{6}{0.998205} +\pgf@def{cosfrac}{7}{0.997559} \pgf@def{cosfrac}{8}{0.996815} +\pgf@def{cosfrac}{9}{0.995974} \pgf@def{cosfrac}{10}{0.995037} +\pgf@def{cosfrac}{11}{0.994004} \pgf@def{cosfrac}{12}{0.992877} +\pgf@def{cosfrac}{13}{0.991656} \pgf@def{cosfrac}{14}{0.990342} +\pgf@def{cosfrac}{15}{0.988936} \pgf@def{cosfrac}{16}{0.987441} +\pgf@def{cosfrac}{17}{0.985856} \pgf@def{cosfrac}{18}{0.984183} +\pgf@def{cosfrac}{19}{0.982424} \pgf@def{cosfrac}{20}{0.980581} +\pgf@def{cosfrac}{21}{0.978653} \pgf@def{cosfrac}{22}{0.976644} +\pgf@def{cosfrac}{23}{0.974555} \pgf@def{cosfrac}{24}{0.972387} +\pgf@def{cosfrac}{25}{0.970143} \pgf@def{cosfrac}{26}{0.967823} +\pgf@def{cosfrac}{27}{0.965429} \pgf@def{cosfrac}{28}{0.962964} +\pgf@def{cosfrac}{29}{0.960429} \pgf@def{cosfrac}{30}{0.957826} +\pgf@def{cosfrac}{31}{0.955157} \pgf@def{cosfrac}{32}{0.952424} +\pgf@def{cosfrac}{33}{0.949629} \pgf@def{cosfrac}{34}{0.946773} +\pgf@def{cosfrac}{35}{0.943858} \pgf@def{cosfrac}{36}{0.940887} +\pgf@def{cosfrac}{37}{0.937862} \pgf@def{cosfrac}{38}{0.934784} +\pgf@def{cosfrac}{39}{0.931655} \pgf@def{cosfrac}{40}{0.928477} +\pgf@def{cosfrac}{41}{0.925252} \pgf@def{cosfrac}{42}{0.921982} +\pgf@def{cosfrac}{43}{0.918669} \pgf@def{cosfrac}{44}{0.915315} +\pgf@def{cosfrac}{45}{0.911922} \pgf@def{cosfrac}{46}{0.90849} +\pgf@def{cosfrac}{47}{0.905024} \pgf@def{cosfrac}{48}{0.901523} +\pgf@def{cosfrac}{49}{0.89799} \pgf@def{cosfrac}{50}{0.894427} +\pgf@def{cosfrac}{51}{0.890835} \pgf@def{cosfrac}{52}{0.887217} +\pgf@def{cosfrac}{53}{0.883573} \pgf@def{cosfrac}{54}{0.879905} +\pgf@def{cosfrac}{55}{0.876216} \pgf@def{cosfrac}{56}{0.872506} +\pgf@def{cosfrac}{57}{0.868777} \pgf@def{cosfrac}{58}{0.865031} +\pgf@def{cosfrac}{59}{0.861269} \pgf@def{cosfrac}{60}{0.857493} +\pgf@def{cosfrac}{61}{0.853704} \pgf@def{cosfrac}{62}{0.849903} +\pgf@def{cosfrac}{63}{0.846092} \pgf@def{cosfrac}{64}{0.842271} +\pgf@def{cosfrac}{65}{0.838444} \pgf@def{cosfrac}{66}{0.834609} +\pgf@def{cosfrac}{67}{0.83077} \pgf@def{cosfrac}{68}{0.826927} +\pgf@def{cosfrac}{69}{0.82308} \pgf@def{cosfrac}{70}{0.819232} +\pgf@def{cosfrac}{71}{0.815383} \pgf@def{cosfrac}{72}{0.811534} +\pgf@def{cosfrac}{73}{0.807687} \pgf@def{cosfrac}{74}{0.803842} +\pgf@def{cosfrac}{75}{0.8} \pgf@def{cosfrac}{76}{0.796162} +\pgf@def{cosfrac}{77}{0.792329} \pgf@def{cosfrac}{78}{0.788502} +\pgf@def{cosfrac}{79}{0.784682} \pgf@def{cosfrac}{80}{0.780869} +\pgf@def{cosfrac}{81}{0.777064} \pgf@def{cosfrac}{82}{0.773268} +\pgf@def{cosfrac}{83}{0.769481} \pgf@def{cosfrac}{84}{0.765705} +\pgf@def{cosfrac}{85}{0.761939} \pgf@def{cosfrac}{86}{0.758185} +\pgf@def{cosfrac}{87}{0.754443} \pgf@def{cosfrac}{88}{0.750714} +\pgf@def{cosfrac}{89}{0.746997} \pgf@def{cosfrac}{90}{0.743294} +\pgf@def{cosfrac}{91}{0.739605} \pgf@def{cosfrac}{92}{0.735931} +\pgf@def{cosfrac}{93}{0.732272} \pgf@def{cosfrac}{94}{0.728628} +\pgf@def{cosfrac}{95}{0.724999} \pgf@def{cosfrac}{96}{0.721387} +\pgf@def{cosfrac}{97}{0.717792} \pgf@def{cosfrac}{98}{0.714213} +\pgf@def{cosfrac}{99}{0.710651} \pgf@def{cosfrac}{100}{0.707107} + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex new file mode 100644 index 00000000000..fd12c5d9146 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex @@ -0,0 +1,97 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreobjects.code.tex,v 1.1.1.1 2005/06/29 12:14:04 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +% Object reuse + + +% Define a pgf object for reuse. Such objects will be stored +% efficiently internally. +% +% #1 = name for later reuse +% #2 = lower left corner point of bounding box +% #3 = upper right left corner point of bounding box +% #4 = pure pgf code (nothing too fancy!) +% +% Description: +% +% Used to define reusable objects. The object must be composed of +% basic pgf graphic primitives. Nothing fancy can be used. The +% created object will be stored as an xform object in pdf or as a +% postscript procedure in postscript. +% +% Example: +% +% \pgfdefobject{myrect}{\pgfpoint{-1pt}{-1pt}}{\pgfpoint{11pt}{11pt}} +% {\pgfpathqmoveto{0pt}{0pt} +% \pgfpathqmoveto{10pt}{0pt} +% \pgfpathqmoveto{10pt}{10pt} +% \pgfpathqmoveto{0pt}{10pt} +% \pgfpathclose +% \pgfusepath{stroke}} +% +% \begin{pgfpicture}{0cm}{0cm}{1cm}{1cm} +% \pgfuseobject{myrect} +% \end{pgfpicture} + +\def\pgfdefobject#1#2#3#4{% + \pgfinterruptpath% + \pgf@relevantforpicturesizefalse% + \pgfsys@defobject{#1}{#2}{#3}{#4}% + \endpgfinterruptpath% + \ignorespaces% +} + + +% Use an object that was previously defined using pgfdefobject +% +% #1 = name of previously defined object +% +% Example: +% +% \pgfdefobject{myrect}{\pgfpoint{-1pt}{-1pt}}{\pgfpoint{11pt}{11pt}} +% {\pgfqmoveto{0}{0} +% \pgfqmoveto{10}{0} +% \pgfqmoveto{10}{10} +% \pgfqmoveto{0}{10} +% \pgfclosestroke} +% +% \begin{pgfpicture}{0cm}{0cm}{1cm}{1cm} +% \pgfuseobject{myrect} +% \end{pgfpicture} + +\def\pgfuseobject#1{\pgfsys@beginscope\pgfsys@useobject{#1}{}\pgfsys@endscope} + + +% Use an object that was previously defined using pgfdefobject, but +% magnify the object by the current x and y register values +% +% #1 = name of previously defined object +% +% Example: +% +% \pgfdefobject{myrect}{\pgfpoint{-1pt}{-1pt}}{\pgfpoint{11pt}{11pt}} +% {\pgfqmoveto{0}{0} +% \pgfqmoveto{10}{0} +% \pgfqmoveto{10}{10} +% \pgfqmoveto{0}{10} +% \pgfclosestroke} +% +% \begin{pgfpicture}{0cm}{0cm}{1cm}{1cm} +% \pgf@x=2pt% Scale by factor two in x-direction +% \pgf@y=2pt% Scale by factor two in y-direction +% \pgfuseobjectmagnify{myrect} +% \end{pgfpicture} + +\def\pgfuseobjectmagnify#1{% + \pgfsys@beginscope% + \pgfsys@useobject{#1}{\pgfsys@transformxyscale{\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}}% + \pgfsys@endscope% +} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruction.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruction.code.tex new file mode 100644 index 00000000000..b96bf719320 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruction.code.tex @@ -0,0 +1,826 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathconstruction.code.tex,v 1.2 2005/09/30 07:14:03 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + +\newdimen\pgf@path@lastx +\newdimen\pgf@path@lasty + + + +% Replace corners by arcs. +% +% #1 = in-size of arc +% #2 = out-size of arc +% +% Description: +% +% This command influences path construction command like +% \pgfpathlineto or \pgfpatharc. It will cause the corners at the end +% of these commands to be replaced by little arcs. If the +% corner is a 90 degrees corner and if #1=#2, a quarter-circle of +% radius #1 is put in place of the corner. If #1 and #2 are different, +% the quarter circle will instead by a quarter ellipse. If the angle +% is different from 90 degrees, a deformed quarter circle will +% result, which may or may not be desirable. For a ``perfect'' arc you +% must use the \pgfpatharc command. +% +% +% Example: One rounded corner. +% +% \pgfpathmoveto{\pgfpointxy{0}{0}} +% \pgfsetcornersarced{4pt}{4pt} +% \pgfpathlineto{\pgfpointxy{0}{1}} +% \pgfpathlineto{\pgfpointxy{1}{1}} +% \pgfstroke +% +% Example: A rounded rectangle +% +% \pgfsetcornersarced{4pt}{4pt} +% \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{1cm}{1cm}} +% \pgfstroke +% +% Example: A rounded triangles +% +% \pgfsetcornersarced{4pt}{4pt} +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathlineto{\pgfpoint{1cm}{0cm}} +% \pgfpathlineto{\pgfpoint{1cm}{1cm}} +% \pgfpathclose +% \pgfstroke + +\newif\ifpgf@arccorners + +\def\pgfsetcornersarced#1{% + \pgf@process{#1}% + \edef\pgf@corner@arc{{\the\pgf@x}{\the\pgf@y}}% + \pgf@arccornerstrue% + \ifdim\pgf@x=0pt% + \ifdim\pgf@y=0pt\relax% + \pgf@arccornersfalse% + \fi% + \fi% +} + +\def\pgf@roundcornerifneeded{% + \ifpgf@arccorners\expandafter\pgfsyssoftpath@specialround\pgf@corner@arc\fi% +} + + +% Move current point to #1. +% +% #1 = new current point +% +% Example: +% +% \pgfpathmoveto{\pgfxy(0,0)} +% \pgfpathlineto{\pgfxy(0,1)} +% \pgfstroke + +\def\pgfpathmoveto#1{% + \pgfpointtransformed{#1}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgfsyssoftpath@moveto{\the\pgf@x}{\the\pgf@y}% + \global\pgf@path@lastx=\pgf@x% + \global\pgf@path@lasty=\pgf@y% +} + +\def\pgf@protocolsizes#1#2{% + \ifpgf@relevantforpicturesize% + \ifdim#1<\pgf@picminx\global\pgf@picminx#1\fi% + \ifdim#1>\pgf@picmaxx\global\pgf@picmaxx#1\fi% + \ifdim#2<\pgf@picminy\global\pgf@picminy#2\fi% + \ifdim#2>\pgf@picmaxy\global\pgf@picmaxy#2\fi% + \fi% + \ifdim#1<\pgf@pathminx\global\pgf@pathminx#1\fi% + \ifdim#1>\pgf@pathmaxx\global\pgf@pathmaxx#1\fi% + \ifdim#2<\pgf@pathminy\global\pgf@pathminy#2\fi% + \ifdim#2>\pgf@pathmaxy\global\pgf@pathmaxy#2\fi% +} + + +\def\pgf@resetpathsizes{% + \global\pgf@pathmaxx=-16000pt\relax% + \global\pgf@pathminx=16000pt\relax% + \global\pgf@pathmaxy=-16000pt\relax% + \global\pgf@pathminy=16000pt\relax% +} + +\def\pgf@getpathsizes#1{% + \edef#1{{\the\pgf@pathmaxx}{\the\pgf@pathminx}{\the\pgf@pathmaxy}{\the\pgf@pathminy}}% +} +\def\pgf@setpathsizes#1{% + \expandafter\pgf@@setpathsizes#1% +} +\def\pgf@@setpathsizes#1#2#3#4{% + \global\pgf@pathmaxx=#1\relax% + \global\pgf@pathminx=#2\relax% + \global\pgf@pathmaxy=#3\relax% + \global\pgf@pathminy=#4\relax% +} + + + + + +% Append a line from the current point to #1 to the current path. +% +% #1 = end of line +% +% Example: +% +% \pgfpathmoveto{\pgfxy(0,0)} +% \pgfpathlineto{\pgfxy(0,1)} +% \pgfstroke + +\def\pgfpathlineto#1{% + \pgfpointtransformed{#1}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@roundcornerifneeded% + \pgfsyssoftpath@lineto{\the\pgf@x}{\the\pgf@y}% + \global\pgf@path@lastx=\pgf@x% + \global\pgf@path@lasty=\pgf@y% +} + + + +% Close the current path. +% +% Example: +% +% % Draws two triangles +% \pgfpathmoveto{\pgfxy(0,0)} +% \pgfpathlineto{\pgfxy(0,1)} +% \pgfpathlineto{\pgfxy(1,0)} +% \pgfclosepath +% \pgfpathmoveto{\pgfxy(2,0)} +% \pgfpathlineto{\pgfxy(2,1)} +% \pgfpathlineto{\pgfxy(3,0)} +% \pgfpathclose +% \pgfstroke + +\def\pgfpathclose{% + \pgf@roundcornerifneeded% + \pgfsyssoftpath@closepath% +} + + +% Append a bezier spline from the current point to #3 with control +% points #1 and #2 to the current path. +% +% #1 = first control point +% #2 = second control point +% #3 = end point +% +% Example: +% +% \pgfpathmoveto{\pgfxy(0,0)} +% \pgfpathcurveto{\pgfxy(0,1)}{\pgfxy(1,1)}{\pgfxy(1,2)} +% \pgfstroke + +\def\pgfpathcurveto#1#2#3{% + \pgfpointtransformed{#3}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgfpointtransformed{#2}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgfpointtransformed{#1}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@roundcornerifneeded% + \pgfsyssoftpath@curveto{\the\pgf@x}{\the\pgf@y}{\the\pgf@xa}{\the\pgf@ya}{\the\pgf@xb}{\the\pgf@yb}% + \global\pgf@path@lastx=\pgf@xb% + \global\pgf@path@lasty=\pgf@yb% +} + +% Append an arc to the current point, where the current point is at +% angle #1 and the end is at angle #2. If #2 > #1, the arc is drawn +% counter-clockwise, otherwise it is clockwise. +% +% #1 = angle of first point +% #2 = angle of second point +% #3 = radius or x-radius/y-radius +% +% Example: +% +% \pgfpathmoveto{\pgfxy(0,0)} +% \pgfpatharc{0}{90}{2cm} +% \pgfstroke + +\def\pgfpatharc#1#2#3{% + \pgf@setcounter{pgf@countc}{#1}% + \pgf@setcounter{pgf@countd}{#2}% + \ifnum\c@pgf@countc>360\relax% + \advance\c@pgf@countc by-360\relax% + \fi% + \ifnum\c@pgf@countc<-360\relax% + \advance\c@pgf@countc by360\relax% + \fi% + \ifnum\c@pgf@countd>360\relax% + \advance\c@pgf@countd by-360\relax% + \fi% + \ifnum\c@pgf@countd<-360\relax% + \advance\c@pgf@countd by360\relax% + \fi% + \loop% + \@tempcnta=\c@pgf@countc\relax% + \advance\@tempcnta by-\c@pgf@countd\relax% + \ifnum\@tempcnta<0\relax% + \@tempcnta=-\@tempcnta\relax% + \fi% + \ifnum\@tempcnta>90\relax% + \ifnum\c@pgf@countd>\c@pgf@countc\relax% + \@tempcnta=\c@pgf@countc\relax% + \advance\@tempcnta by 90\relax% + \expandafter\pgf@arc\expandafter{\expandafter\c@pgf@countc\expandafter}\expandafter{\the\@tempcnta}{#3}% + \advance\c@pgf@countc by 90\relax% + \else + \@tempcnta=\c@pgf@countc\relax% + \advance\@tempcnta by -90\relax% + \expandafter\pgf@arc\expandafter{\expandafter\c@pgf@countc\expandafter}\expandafter{\the\@tempcnta}{#3}% + \advance\c@pgf@countc by -90\relax% + \fi% + \repeat% + \pgf@roundcornerifneeded% + \pgf@arc{\c@pgf@countc}{\c@pgf@countd}{#3}% +} + +\def\pgf@arc#1#2#3{% + \in@/{#3}% + \ifin@% + \pgf@@arc{#1}{#2}#3\@@% + \else + \pgf@@arc{#1}{#2}#3/#3\@@% + \fi% +} + +\def\pgf@@arc#1#2#3/#4\@@{% + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{#4}% + \@tempcnta=#1\relax% + \@tempcntb=#2\relax% + \advance\@tempcntb by-\@tempcnta\relax% + \ifnum\@tempcntb<0\relax% + \@tempcntb=-\@tempcntb\relax% + \fi% + \ifnum\@tempcntb>85\relax% hackery to correct the control points + \@tempdima=0.0555\@tempdima\relax% + \@tempdimb=0.0555\@tempdimb\relax% + \else% + \ifnum\@tempcntb>75\relax% + \@tempdima=0.055\@tempdima\relax% + \@tempdimb=0.055\@tempdimb\relax% + \else% + \ifnum\@tempcntb>60\relax% + \@tempdima=0.0545\@tempdima\relax% + \@tempdimb=0.0545\@tempdimb\relax% + \else% + \@tempdima=0.054\@tempdima\relax% + \@tempdimb=0.054\@tempdimb\relax% + \fi% + \fi% + \fi + \@tempdima=\@tempcntb\@tempdima\relax% + \divide\@tempdima by 9\relax% + \@tempdimb=\@tempcntb\@tempdimb\relax% + \divide\@tempdimb by 9\relax% + %.. controls +(\@tempcnta+90:\@tempdima) and +(\@tempcntb-90:\@tempdima) .. +(-(#1:#3)+(#2:#3))% + % store first support vector in xa/ya: + \@tempcnta=#1\relax% + \ifnum#2>#1\relax% + \advance\@tempcnta by 90\relax% + \else% + \advance\@tempcnta by -90\relax% + \fi% + \pgfpointtransformed{\pgfpointpolar{\@tempcnta}{\@tempdima/\@tempdimb}}% + \advance\pgf@x by-\pgf@pt@x% + \advance\pgf@y by-\pgf@pt@y% + \pgf@xa=\pgf@path@lastx% + \pgf@ya=\pgf@path@lasty% + \advance\pgf@xa by \pgf@x% + \advance\pgf@ya by \pgf@y% + % store target in xb/yb: + \@tempcnta=#1\relax% + \pgfpointtransformed{\pgfpointpolar{\@tempcnta}{#3/#4}}% + \pgf@xb=\pgf@path@lastx% + \pgf@yb=\pgf@path@lasty% + \advance\pgf@xb by -\pgf@x% + \advance\pgf@yb by -\pgf@y% + \@tempcnta=#2\relax% + \pgfpointtransformed{\pgfpointpolar{\@tempcnta}{#3/#4}}% + \advance\pgf@xb by \pgf@x% + \advance\pgf@yb by \pgf@y% + % store second support xc/yc: + \@tempcnta=#2\relax% + \ifnum#2>#1\relax% + \advance\@tempcnta by -90\relax% + \else% + \advance\@tempcnta by 90\relax% + \fi% + \pgfpointtransformed{\pgfpointpolar{\@tempcnta}{\@tempdima/\@tempdimb}}% + \advance\pgf@x by-\pgf@pt@x% + \advance\pgf@y by-\pgf@pt@y% + \pgf@xc=\pgf@xb\relax% + \pgf@yc=\pgf@yb\relax% + \advance \pgf@xc by \pgf@x\relax% + \advance \pgf@yc by \pgf@y\relax% + \pgfsyssoftpath@curveto{\the\pgf@xa}{\the\pgf@ya}{\the\pgf@xc}{\the\pgf@yc}{\the\pgf@xb}{\the\pgf@yb}% + \global\pgf@path@lastx=\pgf@xb% + \global\pgf@path@lasty=\pgf@yb% + \pgf@protocolsizes{\pgf@xa}{\pgf@ya}% + \pgf@protocolsizes{\pgf@xb}{\pgf@yb}% + \pgf@protocolsizes{\pgf@xc}{\pgf@yc}% +} + +% Append an ellipse to the current path. +% +% #1 = center +% #2 = first axis +% #3 = second axis +% +% Example: +% +% % Add a circle of radius 3cm around the origin +% \pgfpathellipse{\pgforigin}{\pgfxy(2,0)}{\pgfxy(0,1)} +% +% % Draw a non-filled circle of radius 1cm around the point (1,1) +% \pgfpathellipse{\pgfxy(1,1)}{\pgfxy(1,1)}{\pgfxy(-2,2)} +% \pgfstroke + +\def\pgfpathellipse#1#2#3{% + \pgfpointtransformed{#1}% store center in xc/yc + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgfpointtransformed{#2}% + \pgf@xa=\pgf@x% store first axis in xa/ya + \pgf@ya=\pgf@y% + \advance\pgf@xa by-\pgf@pt@x% + \advance\pgf@ya by-\pgf@pt@y% + \pgfpointtransformed{#3}% + \pgf@xb=\pgf@x% store second axis in xb/yb + \pgf@yb=\pgf@y% + \advance\pgf@xb by-\pgf@pt@x% + \advance\pgf@yb by-\pgf@pt@y% + {% + \advance\pgf@xa by\pgf@xc% + \advance\pgf@ya by\pgf@yc% + \pgfsyssoftpath@moveto{\the\pgf@xa}{\the\pgf@ya}% + \pgf@protocolsizes{\pgf@xa}{\pgf@ya}% + }% + \pgf@x=0.555\pgf@xb% first arc + \pgf@y=0.555\pgf@yb% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \edef\pgf@temp{{\the\pgf@x}{\the\pgf@y}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@x=0.555\pgf@xa% + \pgf@y=0.555\pgf@ya% + \advance\pgf@x by\pgf@xb% + \advance\pgf@y by\pgf@yb% + {% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \advance\pgf@xb by\pgf@xc% + \advance\pgf@yb by\pgf@yc% + \expandafter\pgfsyssoftpath@curveto\pgf@temp{\the\pgf@x}{\the\pgf@y}{\the\pgf@xb}{\the\pgf@yb}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@xb}{\pgf@yb}% + }% + \pgf@xa=-\pgf@xa% flip first axis + \pgf@ya=-\pgf@ya% + \pgf@x=0.555\pgf@xa% second arc + \pgf@y=0.555\pgf@ya% + \advance\pgf@x by\pgf@xb% + \advance\pgf@y by\pgf@yb% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \edef\pgf@temp{{\the\pgf@x}{\the\pgf@y}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@x=0.555\pgf@xb% + \pgf@y=0.555\pgf@yb% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + {% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \advance\pgf@xa by\pgf@xc% + \advance\pgf@ya by\pgf@yc% + \expandafter\pgfsyssoftpath@curveto\pgf@temp{\the\pgf@x}{\the\pgf@y}{\the\pgf@xa}{\the\pgf@ya}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@xa}{\pgf@ya}% + }% + \pgf@xb=-\pgf@xb% flip second axis + \pgf@yb=-\pgf@yb% + \pgf@x=0.555\pgf@xb% third arc + \pgf@y=0.555\pgf@yb% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \edef\pgf@temp{{\the\pgf@x}{\the\pgf@y}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@x=0.555\pgf@xa% + \pgf@y=0.555\pgf@ya% + \advance\pgf@x by\pgf@xb% + \advance\pgf@y by\pgf@yb% + {% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \advance\pgf@xb by\pgf@xc% + \advance\pgf@yb by\pgf@yc% + \expandafter\pgfsyssoftpath@curveto\pgf@temp{\the\pgf@x}{\the\pgf@y}{\the\pgf@xb}{\the\pgf@yb}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@xb}{\pgf@yb}% + }% + \pgf@xa=-\pgf@xa% flip first axis once more + \pgf@ya=-\pgf@ya% + \pgf@x=0.555\pgf@xa% fourth arc + \pgf@y=0.555\pgf@ya% + \advance\pgf@x by\pgf@xb% + \advance\pgf@y by\pgf@yb% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \edef\pgf@temp{{\the\pgf@x}{\the\pgf@y}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@x=0.555\pgf@xb% + \pgf@y=0.555\pgf@yb% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + {% + \advance\pgf@x by\pgf@xc% + \advance\pgf@y by\pgf@yc% + \advance\pgf@xa by\pgf@xc% + \advance\pgf@ya by\pgf@yc% + \expandafter\pgfsyssoftpath@curveto\pgf@temp{\the\pgf@x}{\the\pgf@y}{\the\pgf@xa}{\the\pgf@ya}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@xa}{\pgf@ya}% + }% + \pgfsyssoftpath@closepath% + \pgfsyssoftpath@moveto{\the\pgf@xc}{\the\pgf@yc}% +} + + + +% Append a circle to the current path +% +% #1 = center +% #2 = radius +% +% Example: +% +% % Append a circle of radius 3cm around the the point (1,1) +% \pgfpathcircle{\pgxy(1,1)}{3cm} + +\def\pgfpathcircle#1#2{\pgfpathellipse{#1}{\pgfpoint{#2}{0pt}}{\pgfpoint{0pt}{#2}}} + + + +% Append a rectangle to the current path +% +% #1 = lower left corner point of rectangle +% #2 = width and height vector +% +% Example: +% +% % A rectangle with corners (2,2) and (3,3) +% \pgfpathrectangle{\pgfpointxy{2}{2}}{\pgfpointxy{1}{1}} + +\def\pgfpathrectangle{% + \let\pgfrect@next=\pgf@specialrect% + \ifpgf@pt@identity% + \ifpgf@arccorners% + \else% + \let\pgfrect@next=\pgf@normalrect% + \fi% + \fi% + \pgfrect@next% +} + +\def\pgf@normalrect#1#2{% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgfpointtransformed{#1}% + \pgfsyssoftpath@rect{\the\pgf@x}{\the\pgf@y}{\the\pgf@xa}{\the\pgf@ya}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \advance\pgf@x by\pgf@xa\relax% + \advance\pgf@y by\pgf@ya\relax% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% +} + +\def\pgf@specialrect#1#2{% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#1}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \advance\pgf@xa by\pgf@xb% + \advance\pgf@ya by\pgf@yb% + \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}% + \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}% + \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}}% + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}}% + \pgfpathclose% + \pgfpathmoveto{\pgfpoint{\pgf@xb}{\pgf@xb}}% +} + +% Append a rectangle to the current path +% +% #1 = one corner of the rectangle +% #2 = opposite corner of the rectangle +% +% Example: +% +% % A rectangle with corners (2,2) and (3,3) +% \pgfpathrectanglecorners{\pgfpointxy{2}{2}}{\pgfpointxy{3}{3}} + +\def\pgfpathrectanglecorners#1#2{% + \pgf@process{#2}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgf@process{#1}% + \advance\pgf@xc by-\pgf@x% + \advance\pgf@yc by-\pgf@y% + \pgfpathrectangle{#1}{\pgfpoint{\pgf@xc}{\pgf@yc}}% +} + + +% Append a grid to the current path. +% +% #1 = lower left point of grid +% #2 = upper right point of grid +% +% Options: +% +% stepx = x-step dimension (default 1cm) +% stepy = y-step dimension (default 1cm) +% step = dimesion vector +% +% Example: +% +% \pgfsetlinewidth{0.8pt} +% \pgfgrid{\pgfxy(0,0)}{\pgfxy(3,2)} +% \pgfsetlinewidth{0.4pt} +% \pgfgrid[stepx=1cm,stepy=1cm]{\pgfxy(0,0)}{\pgfxy(3,2)} + +\define@key{pgfbase}{stepx}{\setlength{\pgf@x}{#1}\relax} +\define@key{pgfbase}{stepy}{\setlength{\pgf@y}{#1}\relax} +\define@key{pgfbase}{step}{\pgf@process{#1}} + +\def\pgfpathgrid{\@ifnextchar[{\pgf@pathgrid}{\pgf@pathgrid[]}} +\def\pgf@pathgrid[#1]#2#3{% + \setkeys{pgfbase}{stepx=1cm,stepy=1cm}% + \setkeys{pgfbase}{#1}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgf@process{#3}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{#2}% + \pgf@xa=\pgf@x\relax% + \pgf@ya=\pgf@y\relax% + {% + % compute bounding box + % first corner + \pgf@x=\pgf@xb% + \pgf@y=\pgf@yb% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + % second corner + \pgf@x=\pgf@xb% + \pgf@y=\pgf@ya% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + % third corner + \pgf@x=\pgf@xa% + \pgf@y=\pgf@yb% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + % fourth corner + \pgf@x=\pgf@xa% + \pgf@y=\pgf@ya% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + }% + \c@pgf@counta=\pgf@y\relax% + \c@pgf@countb=\pgf@yc\relax% + \divide\c@pgf@counta by\c@pgf@countb\relax% + \pgf@y=\c@pgf@counta\pgf@yc\relax% + \ifdim\pgf@y<\pgf@ya% + \advance\pgf@y by\pgf@yc% + \fi% + \loop% horizontal lines + {% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@pos@transform{\pgf@xa}{\pgf@ya} + \pgfsyssoftpath@moveto{\the\pgf@xa}{\the\pgf@ya}% + \pgf@xa=\pgf@xb% + \pgf@ya=\pgf@y% + \pgf@pos@transform{\pgf@xa}{\pgf@ya} + \pgfsyssoftpath@lineto{\the\pgf@xa}{\the\pgf@ya}% + }% + \advance\pgf@y by\pgf@yc% + \ifdim\pgf@y<\pgf@yb% + \repeat% + \advance\pgf@y by-0.01pt\relax% + \ifdim\pgf@y<\pgf@yb% + {% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@pos@transform{\pgf@xa}{\pgf@ya} + \pgfsyssoftpath@moveto{\the\pgf@xa}{\the\pgf@ya}% + \pgf@xa=\pgf@xb% + \pgf@ya=\pgf@y% + \pgf@pos@transform{\pgf@xa}{\pgf@ya} + \pgfsyssoftpath@lineto{\the\pgf@xa}{\the\pgf@ya}% + }% + \fi% + \c@pgf@counta=\pgf@x\relax% + \c@pgf@countb=\pgf@xc\relax% + \divide\c@pgf@counta by\c@pgf@countb\relax% + \pgf@x=\c@pgf@counta\pgf@xc\relax% + \ifdim\pgf@x<\pgf@xa% + \advance\pgf@x by\pgf@xc% + \fi% + \loop% vertical lines + {% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@ya% + \pgf@pos@transform{\pgf@xc}{\pgf@yc} + \pgfsyssoftpath@moveto{\the\pgf@xc}{\the\pgf@yc}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@yb% + \pgf@pos@transform{\pgf@xc}{\pgf@yc} + \pgfsyssoftpath@lineto{\the\pgf@xc}{\the\pgf@yc}% + }% + \advance\pgf@x by\pgf@xc% + \ifdim\pgf@x<\pgf@xb% + \repeat% + \advance\pgf@x by-0.01pt\relax% + \ifdim\pgf@x<\pgf@xb% + {% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@ya% + \pgf@pos@transform{\pgf@xc}{\pgf@yc} + \pgfsyssoftpath@moveto{\the\pgf@xc}{\the\pgf@yc}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@yb% + \pgf@pos@transform{\pgf@xc}{\pgf@yc} + \pgfsyssoftpath@lineto{\the\pgf@xc}{\the\pgf@yc}% + }% + \fi% +} + + + +% Append two half-parabolas to the path +% +% #1 = bend (relative to current point) +% #2 = end point (relative to bend point) +% +% Description: +% +% This command appends a half-parabola that starts at the current point +% and has its bend at #1+current point. Then, a second parabola is +% appended that starts at #1+current point, where it also has its +% minimum/maximum, and ends at #1+current point+#2, which becomes the +% new current point. +% +% By setting #2 = (0,0) you draw only a half parabola that goes from the +% current point to the bend; by setting #1 = (0,0) +% you draw a half parabola that going to current point + #2 and has its +% bend at the current point. +% +% Examples: +% +% % Half-parabola going ``up and right'' +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathparabola{\pgfpointorigin}{\pgfpoint{2cm}{4cm}} +% +% % Half-parabola going ``down and right'' +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathparabola{\pgfpoint{-2cm}{4cm}}}{\pgfpointorigin} +% +% % Full parabola +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathparabola{\pgfpoint{-2cm}{4cm}}{\pgfpoint{2cm}{4cm}} + +\def\pgfpathparabola#1#2{% + {% + \pgf@process{#2}% untransformed + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{#1}% untransformed + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \@tempswatrue% + \ifdim\pgf@xb=0pt\relax% + \ifdim\pgf@yb=0pt\relax% + \@tempswafalse% + \fi% + \fi% + {% + \if@tempswa% + \pgf@arccornersfalse + \else% + \fi% + \@tempswatrue% + \ifdim\pgf@xc=0pt\relax% + \ifdim\pgf@yc=0pt\relax% + \@tempswafalse% + \fi% + \fi% + \if@tempswa + {% + \pgf@pt@x=\pgf@path@lastx% + \pgf@pt@y=\pgf@path@lasty% + \pgfpathcurveto% + {\pgfpoint{.1125\pgf@xc}{.225\pgf@yc}}% found by trial and error + {\pgfpoint{.5\pgf@xc}{\pgf@yc}}% found by trial and error + {\pgfpoint{\pgf@xc}{\pgf@yc}}% + }% + \fi% + }% + \if@tempswa% + \pgf@xc=\pgf@xb% + \pgf@yc=\pgf@yb% + {% + \pgf@pt@x=\pgf@path@lastx% + \pgf@pt@y=\pgf@path@lasty% + \pgfpathcurveto% + {\pgfpoint{.5\pgf@xc}{0\pgf@yc}}% found by trial and error + {\pgfpoint{.8875\pgf@xc}{.775\pgf@yc}}% found by trial and error + {\pgfpoint{\pgf@xc}{\pgf@yc}}% + }% + \fi% + }% +} + + + + +% Append a sine curve between 0 and \pi/2 to the path. +% +% #1 = vector, describing the width and height of the curve +% +% Description: +% +% This command appends a sine curve in the interval 0 and \pi/2 to the +% current path. The sine curve ends at currentpoint+#1. +% +% Examples: +% +% % One complete sine in the interval [0,\pi] +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathsine{\pgfpoint{1.57cm}{1cm}} +% \pgfpathcosine{\pgfpoint{3.141cm}{0cm}} + +\def\pgfpathsine#1{% + {% + \pgf@process{#1}% untransformed + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgf@pt@x=\pgf@path@lastx% evil trickery to transform to the last point + \pgf@pt@y=\pgf@path@lasty% + \pgfpathcurveto% + {\pgfpoint{.31830988618\pgf@xc}{.5\pgf@yc}}% found by trial and error + {\pgfpoint{.63502822294\pgf@xc}{\pgf@yc}}% found by trial and error + {\pgfpoint{\pgf@xc}{\pgf@yc}}% + }% +} + +% Append a cosine curve between 0 and \pi/2 to the path. +% +% #1 = vector, describing the width and height of the curve +% +% Examples: +% +% % One complete sine in the interval [0,\pi] +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathsine{\pgfpoint{1.57cm}{1cm}} +% \pgfpathcosine{\pgfpoint{3.141cm}{0cm}} + +\def\pgfpathcosine#1{% + {% + \pgf@process{#1}% untransformed + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgf@pt@x=\pgf@path@lastx% evil trickery to transform to the last point + \pgf@pt@y=\pgf@path@lasty% + \pgfpathcurveto% + {\pgfpoint{.36497177706\pgf@xc}{0pt}}% found by trial and error + {\pgfpoint{.68169011382\pgf@xc}{.5\pgf@yc}}% found by trial and error + {\pgfpoint{\pgf@xc}{\pgf@yc}}% + }% +} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex new file mode 100644 index 00000000000..db2a9d7c068 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex @@ -0,0 +1,502 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex,v 1.2 2005/10/03 15:52:27 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + +% Cleanup path +% +% #1 = a macro name that stores a path +% +% Description: +% +% This command will remove superfluous parts from a path. Movetos with +% a moveto following are removed. +% +% Example: +% +% \pgfsyssoftpath@moveto{0}{0} +% \pgfsyssoftpath@moveto{10}{10} +% \pgfsyssoftpath@lineto{0}{0} +% \pgfsyssoftpath@getcurrentpath\mypath +% \pgfprocesspathcleanup\mypath + +\def\pgfprocesspathcleanup#1{% + {% + \let\pgf@newpath=\@empty% + \expandafter\pgf@cleanupprocessor#1\pgf@stop% + }% + \let#1=\pgf@newpath% +} + +\def\pgf@cleanupprocessor#1{% + \ifx#1\pgf@stop% + \let\next=\@gobble% ok, done + \else% + \ifx#1\pgfsyssoftpath@movetotoken% + \let\next=\pgf@cleanupmoveto% + \else% + \let\next=\pgf@cleanupredo% + \fi% + \fi% + \next#1% +} + +\def\pgf@cleanupredo#1#2#3{% + \g@addto@macro\pgf@newpath{#1{#2}{#3}}% + \pgf@cleanupprocessor% +} + +\def\pgf@cleanupmoveto#1#2#3#4{% + \ifx#4\pgfsyssoftpath@movetotoken% + % Ok, skip + \else% + \g@addto@macro\pgf@newpath{#1{#2}{#3}}% + \fi% + \pgf@cleanupprocessor#4% +} + + + +% Extract start and end vectors of a path +% +% #1 = a macro that stores a path +% +% Description: +% +% This command will extract the first and second coordinate on the +% path as well as the last and second-last. These coordinates will be +% put in the pgfpoint-macros \pgfpointfirstonpath, +% \pgfpointsecondonpath, \pgfpointsecondlastonpath, and +% \pgfpointlastonpath. If the path is empty, these macros are set to +% \pgfpointorigin. +% +% Example: +% +% \pgfsyssoftpath@moveto{0}{0} +% \pgfsyssoftpath@lineto{10}{10} +% \pgfsyssoftpath@curveto{20}{20}{30}{30}{40}{40} +% \pgfsyssoftpath@getcurrentpath\mypath +% \pgfprocesspathextractpoints\mypath +% +% % \pgfpointfirstonpath is now \pgfpoint{0}{0} +% % \pgfpointsecondonpath is now \pgfpoint{10bp}{10bp} +% % \pgfpointsecondlastonpath is now \pgfpoint{30bp}{30bp} +% % \pgfpointlastonpath is now \pgfpoint{40bp}{40bp} + +\def\pgfprocesspathextractpoints#1{% + \ifx#1\@empty% + \let\pgfpointfirstonpath=\pgfpointorigin% + \let\pgfpointsecondonpath=\pgfpointorigin% + \let\pgfpointsecondlastonpath=\pgfpointorigin% + \let\pgfpointlastonpath=\pgfpointorigin% + \else% + \expandafter\pgf@extractprocessorfirst#1\pgf@stop% + \fi% +} + +\def\pgf@extractprocessorfirst#1#2#3#4{% + \def\pgfpointfirstonpath{\pgfpoint{#2}{#3}}% + \ifx#4\pgf@stop% + % pretty short path... + \let\pgfpointsecondonpath=\pgfpointfirstonpath% + \let\pgfpointsecondlastonpath=\pgfpointfirstonpath% + \let\pgfpointlastonpath=\pgfpointfirstonpath% + \let\next=\@gobble% + \else + \let\next=\pgf@extractprocessorsecond% + \fi% + \next#4% +} + +\def\pgf@extractprocessorsecond#1{% + \ifx#1\pgfsyssoftpath@movetotoken% + % Reset things... + \let\pgf@next=\pgf@extractprocessorfirst% + \else% + \let\pgf@next=\pgf@@extractprocessorsecond% + \fi% + \pgf@next#1% +} +\def\pgf@@extractprocessorsecond#1#2#3#4{% + \def\pgfpointsecondonpath{\pgfpoint{#2}{#3}}% + \let\pgfpointsecondlastonpath=\pgfpointfirstonpath% + \let\pgfpointlastonpath=\pgfpointsecondonpath% + \ifx#4\pgf@stop% + % short path... + \let\next=\@gobble% + \else + \let\next=\pgf@extractprocessorother% + \fi% + \next#4% +} + +\def\pgf@extractprocessorother#1{% + \ifx#1\pgfsyssoftpath@movetotoken% + % Reset things... + \let\pgf@next=\pgf@extractprocessorfirst% + \else% + \let\pgf@next=\pgf@@extractprocessorother% + \fi% + \pgf@next#1% +} +\def\pgf@@extractprocessorother#1#2#3#4{% + \let\pgfpointsecondlastonpath=\pgfpointlastonpath% + \def\pgfpointlastonpath{\pgfpoint{#2}{#3}}% + \ifx#4\pgf@stop% + % end! + \let\next=\@gobble% + \fi% + \next#4% +} + + + +% Check for closepath and rectangles +% +% #1 = a macro that stores a path +% #2 = command to be executed when a closepath or a rectangle is encountered +% +% Example: +% +% \pgfsyssoftpath@moveto{0}{0} +% \pgfsyssoftpath@lineto{10}{10} +% \pgfsyssoftpath@curveto{20}{20}{30}{30}{40}{40} +% \pgfsyssoftpath@getcurrentpath\mypath +% \pgfprocesscheckclosed{\mypath}{\pgf@drawarrowsfalse} + +\def\pgfprocesscheckclosed#1#2{% + {% + \global\let\pgf@proc@todo=\relax% + \let\pgfsyssoftpath@movetotoken=\@gobbletwo% + \let\pgfsyssoftpath@linetotoken=\@gobbletwo% + \let\pgfsyssoftpath@curvetosupportatoken=\@gobbletwo% + \let\pgfsyssoftpath@curvetosupportbtoken=\@gobbletwo% + \let\pgfsyssoftpath@curvetotoken=\@gobbletwo% + \def\pgfsyssoftpath@rectcornertoken{\gdef\pgf@proc@todo{#2}\@gobbletwo}% + \def\pgfsyssoftpath@rectsizetoken{\gdef\pgf@proc@todo{#2}\@gobbletwo}% + \def\pgfsyssoftpath@closepathtoken{\gdef\pgf@proc@todo{#2}\@gobbletwo}% + #1% + }% + \pgf@proc@todo% +} + + +% Resolve specialround +% +% #1 = a macro that stores a path +% #2 = a macro that stores the new path +% +% Description: +% +% Resolves all specialround tokens. When such a token is encountered, +% the objective is to replace the next corner by a rounded corner. +% + +\def\pgfprocessround#1#2{% + % first, check whether #1 contains \pgfsyssoftpath@specialroundtoken. + % if not, do quick assignment! + \expandafter\pgf@processroundcheck\expandafter#1\expandafter#2#1\pgfsyssoftpath@specialroundtoken\pgf@stop% +} + +\def\pgf@processroundcheck#1#2#3\pgfsyssoftpath@specialroundtoken#4\pgf@stop{% + \def\pgf@test{#4}% + \ifx\pgf@test\@empty% + % ok, nothing to be done! + \let#2=#1% + \else% + % very well... + \pgf@@processround#1#2% + \fi% +} + + +\def\pgf@@processround#1#2{% + \let\pgfprocess@newpath\@empty% + \let\pgfprocess@moveto\@empty% + \let\pgfprocess@firstto\@empty% + \let\pgfprocess@segment\@empty% + \pgf@xa=0pt% + \pgf@ya=0pt% + \expandafter\pgfprocess@round#1\pgf@stop{0pt}{0pt}% + \expandafter\g@addto@macro\expandafter\pgfprocess@newpath\expandafter{\pgfprocess@moveto}% + \expandafter\g@addto@macro\expandafter\pgfprocess@newpath\expandafter{\pgfprocess@segment}% + \let#2=\pgfprocess@newpath% +} + +\def\pgfprocess@round#1#2#3{% + \ifx#1\pgf@stop% + \let\next=\relax% + \else% + \ifx#1\pgfsyssoftpath@specialroundtoken% + \def\pgfprocess@savex{#2}% + \def\pgfprocess@savey{#3}% + \let\next=\pgfprocess@specialround% + \ifdim#2=0pt% + \ifdim#3=0pt% + \let\next=\pgfprocess@round% skip! + \fi% + \fi% + \else% + \ifx\pgfprocess@firstto\@empty% + \def\pgfprocess@firstto{{#2}{#3}}% + \fi% + \pgf@xa=#2% + \pgf@ya=#3% + \ifx#1\pgfsyssoftpath@movetotoken% + % ok, move old segment to newpath + \expandafter\g@addto@macro\expandafter\pgfprocess@newpath\expandafter{\pgfprocess@moveto}% + \expandafter\g@addto@macro\expandafter\pgfprocess@newpath\expandafter{\pgfprocess@segment}% + \def\pgfprocess@moveto{#1{#2}{#3}}% + \let\pgfprocess@firstto=\@empty% + \let\pgfprocess@segment=\@empty% + \else% + \g@addto@macro\pgfprocess@segment{#1{#2}{#3}}% + \fi% + \let\next=\pgfprocess@round% + \fi% + \fi% + \next% +} + +\def\pgfprocess@specialround#1#2#3{% + \ifx\pgfprocess@firstto\@empty% + \def\pgfprocess@firstto{{#2}{#3}}% + \fi% + \let\next=\pgfprocess@round% default: do nothing + \ifx#1\pgfsyssoftpath@linetotoken% + % Ok, round a lineto + \let\next=\pgfprocess@specialroundcope% + \else% + \ifx#1\pgfsyssoftpath@curvetosupportatoken% + % Ok, round a curveto. + \let\next=\pgfprocess@specialroundcurveto% + \else% + \ifx#1\pgfsyssoftpath@closepathtoken% + % Ok, round a closepath (this is tricky...) + \let\next=\pgfprocess@specialroundclose% + \fi% + \fi% + \fi% + \next#1{#2}{#3}% +}% + +\def\pgfprocess@specialroundcope#1#2#3#4#5#6{% + \let\next=\pgfprocess@round% do nothing by default + \let\pgfprocess@continueafterrounding=\pgfprocess@round% + \ifx#4\pgfsyssoftpath@linetotoken% + % ok, let's get kicking... + \pgf@xc=#5% + \pgf@yc=#6% + \let\next=\pgfprocess@@specialround% + \else% + \ifx#4\pgfsyssoftpath@curvetosupportatoken% + \pgf@xc=#5% + \pgf@yc=#6% + \let\next=\pgfprocess@@specialround% + \else% + \ifx#4\pgfsyssoftpath@closepathtoken% + \pgf@xc=#5% + \pgf@yc=#6% + \let\next=\pgfprocess@@specialround% + \else + \ifx#4\pgfsyssoftpath@specialroundtoken% + \let\next=\pgfprocess@@findrightcoordinates% + \fi% + \fi% + \fi% + \fi% + \next#1{#2}{#3}#4{#5}{#6}% +} + +\def\pgfprocess@@findrightcoordinates#1#2#3#4#5#6#7#8#9{% + \pgf@xc=#8% + \pgf@yc=#9% + \pgfprocess@@specialround#1{#2}{#3}#4{#5}{#6}#7{#8}{#9}% +} + +\def\pgfprocess@@specialround#1#2#3{% + \g@addto@macro\pgfprocess@segment{#1}% + % calculate start coordinate of the curve + \pgf@xb=#2% + \pgf@yb=#3% + % + \edef\pgf@marshal% + {\noexpand\pgfpointlineatdistance{\pgfprocess@savex}% + {\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}}% + \pgf@process{\pgf@marshal}% + \pgf@xa=\pgf@x% save start point of added curve + \pgf@ya=\pgf@y% + \edef\pgfprocess@addition{{\the\pgf@x}{\the\pgf@y}}% + \expandafter\g@addto@macro\expandafter\pgfprocess@segment\expandafter{\pgfprocess@addition}% + % + % now add curve + % + \edef\pgf@marshal% + {\noexpand\pgfpointlineatdistance{\pgfprocess@savey}% + {\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}}% + \pgf@process{\pgf@marshal}% + \pgf@xc=\pgf@x% save end point of added curve + \pgf@yc=\pgf@y% + % calculate first support: + {% + \pgf@x=\pgf@xb% + \pgf@y=\pgf@yb% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \advance\pgf@xa by 0.555\pgf@x% + \advance\pgf@ya by 0.555\pgf@y% + \edef\pgfprocess@addition{\noexpand\pgfsyssoftpath@curvetosupportatoken{\the\pgf@xa}{\the\pgf@ya}}% + \expandafter\g@addto@macro\expandafter\pgfprocess@segment\expandafter{\pgfprocess@addition}% + }% + % calculate second support: + {% + \pgf@x=\pgf@xb% + \pgf@y=\pgf@yb% + \advance\pgf@x by-\pgf@xc% + \advance\pgf@y by-\pgf@yc% + \advance\pgf@xc by 0.555\pgf@x% + \advance\pgf@yc by 0.555\pgf@y% + \edef\pgfprocess@addition{\noexpand\pgfsyssoftpath@curvetosupportbtoken{\the\pgf@xc}{\the\pgf@yc}}% + \expandafter\g@addto@macro\expandafter\pgfprocess@segment\expandafter{\pgfprocess@addition}% + }% + % add end: + \edef\pgfprocess@addition{\noexpand\pgfsyssoftpath@curvetotoken{\the\pgf@xc}{\the\pgf@yc}}% + \expandafter\g@addto@macro\expandafter\pgfprocess@segment\expandafter{\pgfprocess@addition}% + % + % continue! + % + \pgf@xa=#2% + \pgf@ya=#3% + \pgfprocess@continueafterrounding% +} + +\def\pgfprocess@specialroundcurveto#1#2#3#4#5#6{% + \g@addto@macro\pgfprocess@segment{#1{#2}{#3}#4{#5}{#6}}% supports + \pgf@xa=#5% + \pgf@ya=#6% + \pgfprocess@specialroundcope} + +\def\pgfprocess@specialroundclose{% + \let\next=\pgfprocess@round% + \ifx\pgfprocess@moveto\@empty% + \else% + \ifx\pgfprocess@firstto\@empty% + \else% + \expandafter\pgfprocess@@specialclosetarget\pgfprocess@firstto% + \let\pgfprocess@continueafterrounding=\pgfprocess@cleanupafterclose% + \edef\next{% + \noexpand\pgfprocess@@specialround% + \expandafter\expandafter\expandafter\noexpand\expandafter\pgfprocess@@specialclosemoveto\pgfprocess@moveto% + }% + \fi% + \fi% + \next% +} + +\def\pgfprocess@@specialclosetarget#1#2{% + \pgf@xc=#1% + \pgf@yc=#2% +} + +\def\pgfprocess@@specialclosemoveto#1#2#3{% + \pgfsyssoftpath@linetotoken{#2}{#3}% +} + + +\def\pgfprocess@cleanupafterclose#1#2#3{% + \edef\pgfprocess@moveto{\noexpand\pgfsyssoftpath@movetotoken{\the\pgf@xc}{\the\pgf@yc}}% + \edef\pgf@marshal{\noexpand\pgfprocess@round\noexpand\pgfsyssoftpath@closepathtoken{\the\pgf@xc}{\the\pgf@yc}}% + \pgf@marshal% +} + + +% Replace start and end coordinates of a path +% +% #1 = new start coordinate +% #2 = new end coordinate +% +% Description: +% +% This command will replace the first and last coordinates on a path +% by the given coordinates. +% +% Example: +% +% \pgfsyssoftpath@moveto{0}{0} +% \pgfsyssoftpath@lineto{10}{10} +% \pgfsyssoftpath@curveto{20}{20}{30}{10}{40}{0} +% \pgfsyssoftpath@getcurrentpath\mypath +% \pgfsetlinewidth{2pt} +% \pgfusepath{stroke} +% \pgfprocesspathextractpoints{\mypath} +% \pgfprocesspathreplacestartandend{\mypath} +% {\pgfpointlineatdistance{2pt}{\pgfpointfirstonpath}{\pgfpointsecondonpath}}% +% {\pgfpointlineatdistance{2pt}{\pgfpointlastonpath}{\pgfpointsecondlastonpath}}% +% \pgfsyssoftpath@setcurrentpath\mypath +% \pgfsetlinewidth{1pt} +% \color{red} +% \pgfusepath{stroke} + +\def\pgfprocesspathreplacestartandend#1#2#3{% + {% + \let\pgf@newpath=\@empty% + \let\pgf@prepath=\@empty% + \ifx#1\@empty% + \else% + \pgf@process{#3}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#2}% + \expandafter\pgf@replaceprocessfirst#1\pgf@stop% + \fi% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter\pgf@newpath + \expandafter\expandafter\expandafter{\expandafter\pgf@prepath\pgf@newpath}% + \global\let#1=\pgf@newpath% + }% +} + +\def\pgf@replaceprocessfirst#1#2#3#4{% + \def\pgf@temppath{#1{#2}{#3}}% + \edef\pgf@newpath{\noexpand#1{\the\pgf@x}{\the\pgf@y}}% + \ifx#4\pgf@stop% + \let\next=\@gobble% + \else% + \let\next=\pgf@replaceprocessother% + \fi% + \next#4% +} + +\def\pgf@replaceprocessother#1{% + \ifx#1\pgfsyssoftpath@movetotoken% + % Arggghh! Must reset everything! + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter\pgf@prepath + \expandafter\expandafter\expandafter{\expandafter\pgf@prepath\pgf@temppath}% + % Redo first. + \let\pgf@next=\pgf@replaceprocessfirst% + \else% + \let\pgf@next=\pgf@@replaceprocessother% + \fi% + \pgf@next#1% +} +\def\pgf@@replaceprocessother#1#2#3#4{% + \ifx#4\pgf@stop% + \edef\pgf@newpathaddition{{\noexpand#1{\the\pgf@xa}{\the\pgf@ya}}}% + \expandafter\g@addto@macro\expandafter\pgf@newpath\pgf@newpathaddition% + \let\next=\@gobble% + \else% + \g@addto@macro\pgf@temppath{#1{#2}{#3}}% + \g@addto@macro\pgf@newpath{#1{#2}{#3}}% + \let\next=\pgf@replaceprocessother% + \fi% + \next#4% +} + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex new file mode 100644 index 00000000000..38bbdf07bba --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex @@ -0,0 +1,209 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathusage.code.tex,v 1.2 2005/07/17 22:34:19 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +% Stroke/fill/clip/etc. the current path. Depending on the options, +% the current path will be stroked/filled/clipped/etc. If no options +% are given, the path is stroked. If multiple options are given, all +% of them are performed (in a sensible order). +% +% #1 = action(s) to be applied to the current path. Valid actions are: +% stroke - strokes the path. If no options are given, this is the +% default. +% draw - same as stroke. +% fill - fills the path. +% clip - clip the path. +% discard - Discards the path. Same effect as having an empty +% options list. +% +% Example: +% +% % Draws an edge. +% \pgfpathmoveto{\pgfxy(0,0)} +% \pgfpathlineto{\pgfxy(0,1)} +% \pgfpathlineto{\pgfxy(1,0)} +% \pgfusepath{stroke} + +\define@key{pgfup}{stroke}[]{\def\pgf@up@stroke{stroke}} +\define@key{pgfup}{draw}[]{\def\pgf@up@stroke{stroke}} +\define@key{pgfup}{fill}[]{\def\pgf@up@fill{fill}} +\define@key{pgfup}{clip}[]{\def\pgf@up@clip{clip}} +\define@key{pgfup}{discard}[]{} +\define@key{pgfup}{use as bounding box}[]{\def\pgf@up@bb{\pgf@relevantforpicturesizefalse}} + +\def\pgfusepath#1{% + \let\pgf@up@stroke\@empty% + \let\pgf@up@fill\@empty% + \let\pgf@up@clip\@empty% + \let\pgf@up@discard\@empty% + \let\pgf@up@bb\@empty% + \setkeys{pgfup}{#1}% + \expandafter\def\expandafter\pgf@up@action\expandafter{\csname pgfsys@\pgf@up@fill\pgf@up@stroke\endcsname}% + \ifx\pgf@up@stroke\@empty% + \ifx\pgf@up@fill\@empty% + \ifx\pgf@up@clip\@empty% + \let\pgf@up@action=\@empty% + \pgfsyssoftpath@setcurrentpath\@empty% + \else% + % only clipping + \let\pgf@up@action=\pgfsys@discardpath% + \fi% + \fi% + \fi% + \pgfprocessround{\pgfsyssoftpath@currentpath}{\pgfsyssoftpath@currentpath}% change the current path + % + % Check whether the path is stroked. If so, add half the path width + % to the bounding box. + % + \ifpgf@relevantforpicturesize% + \ifx\pgf@up@stroke\@empty% + \else% + \pgf@x=\pgf@pathminx\advance\pgf@x by-.5\pgflinewidth% + \ifdim\pgf@x<\pgf@picminx\global\pgf@picminx\pgf@x\fi% + \pgf@y=\pgf@pathminy\advance\pgf@y by-.5\pgflinewidth% + \ifdim\pgf@y<\pgf@picminy\global\pgf@picminy\pgf@y\fi% + \pgf@x=\pgf@pathmaxx\advance\pgf@x by.5\pgflinewidth% + \ifdim\pgf@x>\pgf@picmaxx\global\pgf@picmaxx\pgf@x\fi% + \pgf@y=\pgf@pathmaxy\advance\pgf@y by.5\pgflinewidth% + \ifdim\pgf@y>\pgf@picmaxy\global\pgf@picmaxy\pgf@y\fi% + \fi% + \fi% + % + \ifx\pgf@up@clip\@empty% + \ifx\pgf@up@stroke\@empty% + \pgfsyssoftpath@invokecurrentpath% + \pgfsyssoftpath@getcurrentpath\pgf@last@used@path% + \pgf@up@action% + \else% + \pgf@check@for@arrows% + \ifpgf@drawarrows% + \pgf@shorten@path@as@needed% + \pgfsyssoftpath@invokecurrentpath% + \pgfsyssoftpath@getcurrentpath\pgf@last@used@path% + \pgf@up@action% + \pgfsyssoftpath@setcurrentpath\@empty% + \pgf@add@arrows@as@needed% + \else% + \pgfsyssoftpath@invokecurrentpath% + \pgfsyssoftpath@getcurrentpath\pgf@last@used@path% + \pgf@up@action% + \fi% + \fi% + \else% + \pgfsyssoftpath@invokecurrentpath% + \pgfsyssoftpath@getcurrentpath\pgf@last@used@path% + \pgfsys@clipnext% + \pgf@up@action% + \pgf@relevantforpicturesizefalse% + \fi% + \pgf@up@bb% + \pgfsyssoftpath@setcurrentpath\@empty% + \pgf@resetpathsizes% + \ignorespaces% +} + + +% Shorten start/end of paths by a certain amount. +% +% #1 = amount by which paths should be shortened. +% +% Example: +% +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathlineto{\pgfpoint{10pt}{0pt} +% +% % The following has the same effect: +% \pgfsetshortenstart{1pt} +% \pgfpathmoveto{\pgfpointorigin} +% \pgfpathlineto{\pgfpoint{11pt}{0pt} + +\def\pgfsetshortenstart#1{\setlength\pgf@shorten@start@additional{#1}} +\def\pgfsetshortenend#1{\setlength\pgf@shorten@end@additional{#1}} + +\newif\ifpgf@drawarrows + +\def\pgf@check@for@arrows{% + \pgf@drawarrowsfalse% + \ifx\pgf@startarrow\@empty\else\pgf@drawarrowstrue\fi% + \ifx\pgf@endarrow\@empty\else\pgf@drawarrowstrue\fi% + \ifdim\pgf@shorten@end@additional=0pt\relax\else\pgf@drawarrowstrue\fi% + \ifdim\pgf@shorten@start@additional=0pt\relax\else\pgf@drawarrowstrue\fi% + \ifpgf@drawarrows% + \pgfsyssoftpath@getcurrentpath\pgf@arrowpath% + \ifx\pgf@arrowpath\@empty% + \pgf@drawarrowsfalse% + \else% + \pgfprocesscheckclosed{\pgf@arrowpath}{\pgf@drawarrowsfalse}% + \fi% + \fi% +} + +\newdimen\pgf@shorten@end@additional +\newdimen\pgf@shorten@start@additional + +\let\pgf@shorten@end=\@empty +\let\pgf@shorten@start=\@empty + +\def\pgf@shorten@path@as@needed{% + \pgfprocesspathextractpoints{\pgf@arrowpath}% + \let\pgf@arrow@next=\pgf@shorten@now% + \ifx\pgf@shorten@start\@empty% + \ifx\pgf@shorten@end\@empty% + \ifdim\pgf@shorten@end@additional=0pt\relax% + \ifdim\pgf@shorten@start@additional=0pt\relax% + \let\pgf@arrow@next=\relax% + \fi% + \fi% + \fi% + \fi% + \pgf@arrow@next% +} + +\def\pgf@shorten@now{% + {% + \pgf@x=0pt% + \pgf@shorten@start% + \advance\pgf@x by\pgf@shorten@start@additional% + \pgf@xc=\pgf@x% + \pgf@process{\pgfpointlineatdistance{\pgf@xc}{\pgfpointfirstonpath}{\pgfpointsecondonpath}}% + \global\pgf@x=\pgf@x% + \global\pgf@y=\pgf@y% + }% + \edef\pgfpointfirstonpath{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + {% + \pgf@x=0pt% + \pgf@shorten@end% + \advance\pgf@x by\pgf@shorten@end@additional% + \pgf@xc=\pgf@x% + \pgf@process{\pgfpointlineatdistance{\pgf@xc}{\pgfpointlastonpath}{\pgfpointsecondlastonpath}}% + \global\pgf@x=\pgf@x% + \global\pgf@y=\pgf@y% + }% + \edef\pgfpointlastonpath{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + \pgfprocesspathreplacestartandend{\pgf@arrowpath}{\pgfpointfirstonpath}{\pgfpointlastonpath}% + \pgfsyssoftpath@setcurrentpath\pgf@arrowpath% +} + +\def\pgf@add@arrows@as@needed{% + \ifx\pgf@startarrow\@empty% + \else% + \pgflowlevelobj% + {\pgftransformarrow{\pgfpointsecondonpath}{\pgfpointfirstonpath}} + {\pgf@startarrow}% + \fi% + \ifx\pgf@endarrow\@empty% + \else% + \pgflowlevelobj% + {\pgftransformarrow{\pgfpointsecondlastonpath}{\pgfpointlastonpath}} + {\pgf@endarrow}% + \fi% +} + +\let\pgf@startarrow=\@empty +\let\pgf@endarrow=\@empty + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex new file mode 100644 index 00000000000..26e63666e02 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex @@ -0,0 +1,822 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepoints.code.tex,v 1.1.1.1 2005/06/29 12:14:04 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + +\newdimen\pgf@picminx +\newdimen\pgf@picmaxx +\newdimen\pgf@picminy +\newdimen\pgf@picmaxy + +\newdimen\pgf@pathminx +\newdimen\pgf@pathmaxx +\newdimen\pgf@pathminy +\newdimen\pgf@pathmaxy + +\newif\ifpgf@relevantforpicturesize + +\def\pgf@process#1{{#1\global\pgf@x=\pgf@x\global\pgf@y=\pgf@y}} + +\newdimen\pgf@tempdim +\def\pgf@setlength#1#2{% these will be used only when \nullfont is active + \begingroup% keep font setting local + \pgf@selectfontorig% restore font + \pgf@setlengthorig\pgf@tempdim{#2}% calculate dimension (possibly using calc) + \global\pgf@tempdim\pgf@tempdim% make dimension global + \endgroup% + #1=\pgf@tempdim\relax} +\def\pgf@addtolength#1#2{% + \begingroup% keep font setting local + \pgf@selectfontorig% restore font + \pgf@tempdim#1\relax% + \pgf@addtolengthorig\pgf@tempdim{#2}% calculate dimension (possibly using calc) + \global\pgf@tempdim\pgf@tempdim% make dimension global + \endgroup% + #1=\pgf@tempdim\relax} +\newcounter{pgf@tempcount} +\def\pgf@setcounter#1#2{% + \setcounter{pgf@tempcount}{#2}% makes change global! + \csname c@#1\endcsname=\c@pgf@tempcount\relax} +\def\pgf@selectfont{\pgf@selectfontorig\nullfont} + + + +% Return a point +% +% #1 = x-coordinate of the point +% #2 = y-coordinate of the point +% +% x = #1 +% y = #2 +% +% Example: +% +% \pgfpathmoveto{\pgfpoint{2pt}{3cm}} + +\def\pgfpoint#1#2{% + \setlength\pgf@x{#1}% + \setlength\pgf@y{#2}\ignorespaces} + +% Return the origin. +% +% x = 0 +% y = 0 +% +% Example: +% +% \pgfpathmoveto{\pgfpointorigin} + +\def\pgfpointorigin{\pgfpoint{0pt}{0pt}\ignorespaces} + + + +% Return a transformed point +% +% #1 = a point +% +% Description: +% +% This command applies pgf's current transformation matrix to the +% given point. Normally, this is done automatically by commands like +% lineto or moveto, but sometimes you may wish to access a transformed +% point yourself. For example, this command is useful for a low level +% coordinate system shift: +% +% Example: +% +% \begin{pgflowleveltransformshiftscope}{\pgfpointtransformed{\pgfpointorigin}} +% \pgfbox[center,center]{Hi!} +% \end{pgflowleveltransformshiftscope} + +\def\pgfpointtransformed#1{% + \pgf@process{% + #1% + \pgf@pos@transform{\pgf@x}{\pgf@y}% + }% +} + + +% Return the difference vector of two points. +% +% #1 = start of vector +% #2 = end of vector +% +% x = x-component of difference +% y = y-component of difference +% +% Example: +% +% \pgfpathmoveto{\pgfpointdiff{\pgfpointxy{1}{1}}{\pgfpointxy{2}{3}}} + +\def\pgfpointdiff#1#2{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#2}% + \advance\pgf@x by-\pgf@xa\relax% + \advance\pgf@y by-\pgf@ya\relax\ignorespaces} + +% Add two vectors. +% +% #1 = first vector +% #2 = second vector +% +% x = x-component of addition +% y = y-component of addition +% +% Example: +% +% \pgfpathmoveto{\pgfpointadd{\pgfpointxy{0}{1}}{\pgfpointxy{2}{3}}} + +\def\pgfpointadd#1#2{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#2}% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya} + + + +% Multiply a vector by a factor. +% +% #1 = factor +% #2 = vector +% +% Example: +% +% \pgfpointscale{2}{\pgfpointxy{0}{1}} + +\def\pgfpointscale#1#2{% + \pgf@process{#2}% + \pgf@x=#1\pgf@x% + \pgf@y=#1\pgf@y% +} + + +% The intersection of two lines +% +% #1 = point on first line +% #2 = another point on first line +% #3 = point on second line +% #4 = another point on second line +% +% Returns the intersection of the two lines. If there is no +% intersection or if the points #1 and #2 or the points #3 and #4 are +% identical, the behaviour is not specified. +% +% Example: +% +% \pgfpointintersectionoflines{\pgfpointxy{0}{1}}{\pgfpointxy{1}{0}}{\pgfpointxy{2}{2}}{\pgfpointxy{3}{4}} + +\def\pgfpointintersectionoflines#1#2#3#4{% + { + % + % Compute orthogonal vector to #1--#2 + % + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#1}% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + \pgf@ya=-\pgf@ya% + % Normalise a bit + \c@pgf@counta=\pgf@xa% + \ifnum\c@pgf@counta<0\relax% + \c@pgf@counta=-\c@pgf@counta\relax% + \fi% + \c@pgf@countb=\pgf@ya% + \ifnum\c@pgf@countb<0\relax% + \c@pgf@countb=-\c@pgf@countb\relax% + \fi% + \advance\c@pgf@counta by\c@pgf@countb\relax% + \divide\c@pgf@counta by 65536\relax% + \ifnum\c@pgf@counta>0\relax% + \divide\pgf@xa by\c@pgf@counta\relax% + \divide\pgf@ya by\c@pgf@counta\relax% + \fi% + % + % Compute projection + % + \pgf@xc=\pgf@sys@tonumber{\pgf@ya}\pgf@x% + \advance\pgf@xc by\pgf@sys@tonumber{\pgf@xa}\pgf@y% + % + % The orthogonal vector is (\pgf@ya,\pgf@xa) + % + % + % Compute orthogonal vector to #3--#4 + % + \pgf@process{#4}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{#3}% + \advance\pgf@xb by-\pgf@x% + \advance\pgf@yb by-\pgf@y% + \pgf@yb=-\pgf@yb% + % Normalise a bit + \c@pgf@counta=\pgf@xb% + \ifnum\c@pgf@counta<0\relax% + \c@pgf@counta=-\c@pgf@counta\relax% + \fi% + \c@pgf@countb=\pgf@yb% + \ifnum\c@pgf@countb<0\relax% + \c@pgf@countb=-\c@pgf@countb\relax% + \fi% + \advance\c@pgf@counta by\c@pgf@countb\relax% + \divide\c@pgf@counta by 65536\relax% + \ifnum\c@pgf@counta>0\relax% + \divide\pgf@xb by\c@pgf@counta\relax% + \divide\pgf@yb by\c@pgf@counta\relax% + \fi% + % + % Compute projection + % + \pgf@yc=\pgf@sys@tonumber{\pgf@yb}\pgf@x% + \advance\pgf@yc by\pgf@sys@tonumber{\pgf@xb}\pgf@y% + % + % The orthogonal vector is (\pgf@yb,\pgf@xb) + % + % Setup transformation matrx (this is just to use the matrix + % inversion) + % + \pgfsettransform{{\pgf@sys@tonumber\pgf@ya}{\pgf@sys@tonumber\pgf@yb}{\pgf@sys@tonumber\pgf@xa}{\pgf@sys@tonumber\pgf@xb}{0pt}{0pt}}% + \pgftransforminvert% + \pgf@process{\pgfpointtransformed{\pgfpoint{\pgf@xc}{\pgf@yc}}}% + }% +} + + +% Returns point on a line from #2 to #3 at time #1. +% +% #1 = a time, where 0 is the start and 1 is the end +% #2 = start point +% #3 = end point +% +% x = x-component of #1*start + (1-#1)*end +% y = y-component of #1*start + (1-#1)*end +% +% Example: +% +% % Middle of (1,1) and (2,3) +% \pgfpathmoveto{\pgfpointlineattime{0.5}{\pgfpointxy{0}{1}}{\pgfpointxy{2}{3}}} + +\def\pgfpointlineattime#1#2#3{% + \pgf@process{#3}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#2}% + \advance\pgf@xa by-\pgf@x\relax% + \advance\pgf@ya by-\pgf@y\relax% + \advance\pgf@x by #1\pgf@xa\relax% + \advance\pgf@y by #1\pgf@ya\relax% + \ignorespaces} + + +% Move point #2 #1 many units in the direction of #3. +% +% #1 = a distance +% #2 = start point +% #3 = end point +% +% x = x-component of start + #1*(normalise(end-start)) +% y = y-component of start + #1*(normalise(end-start)) +% +% Example: +% +% +% \pgfpathmoveto{\pgfpointlineatdistance{2pt}{\pgfpointxy{0}{1}}{\pgfpointxy{2}{3}}} +% \pgfpathlineto{\pgfpointlineatdistance{3pt}{\pgfpointxy{2}{3}}{\pgfpointxy{0}{1}}} + +\def\pgfpointlineatdistance#1#2#3{% + \pgf@process{#2}% + \pgf@xb=\pgf@x\relax% xb/yb = start point + \pgf@yb=\pgf@y\relax% + \pgf@process{#3}% + \advance\pgf@x by-\pgf@xb\relax% + \advance\pgf@y by-\pgf@yb\relax% + \pgf@process{\pgfpointnormalised{}}% x/y = normalised vector + \setlength\pgf@xa{#1}% + \pgf@ya=\pgf@xa\relax% + \pgf@xa=\pgf@sys@tonumber{\pgf@x}\pgf@xa% + \pgf@ya=\pgf@sys@tonumber{\pgf@y}\pgf@ya% + \pgf@x=\pgf@xb\relax% + \pgf@y=\pgf@yb\relax% + \advance\pgf@x by\pgf@xa\relax% + \advance\pgf@y by\pgf@ya\relax% + \ignorespaces} + + +% Returns point on a curve from #2 to #5 with controls #3 and #4 at time #1. +% +% #1 = a time +% #2 = start point +% #3 = first control point +% #4 = second control point +% #5 = end point +% +% x = x-component of place on the curve at time t +% y = y-component of place on the curve at time t +% +% Additionally, (\pgf@xa,\pgf@ya) and (\pgf@xb,\pgf@yb) will be on a +% tangent to the point on the curve (this can be useful for computing +% a label rotation). +% +% Example: +% +% % Middle of (1,1) and (2,3) +% \pgfpathmoveto{\pgfpointcurveattime{0.5}{\pgfpointxy{0}{1}}{\pgfpointxy{1}{1}}{\pgfpointxy{1}{1}}{\pgfpointxy{2}{3}}} + +\def\pgfpointcurveattime#1#2#3#4#5{% + \def\pgf@time@s{#1}% + \pgf@x=#1pt% + \pgf@x=-\pgf@x% + \advance\pgf@x by 1pt% + \edef\pgf@time@t{\pgf@sys@tonumber{\pgf@x}}% + \pgf@process{#5}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgf@process{#4}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{#3}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#2}% + % First iteration: + \pgf@x=\pgf@time@t\pgf@x\advance\pgf@x by\pgf@time@s\pgf@xa% + \pgf@y=\pgf@time@t\pgf@y\advance\pgf@y by\pgf@time@s\pgf@ya% + \pgf@xa=\pgf@time@t\pgf@xa\advance\pgf@xa by\pgf@time@s\pgf@xb% + \pgf@ya=\pgf@time@t\pgf@ya\advance\pgf@ya by\pgf@time@s\pgf@yb% + \pgf@xb=\pgf@time@t\pgf@xb\advance\pgf@xb by\pgf@time@s\pgf@xc% + \pgf@yb=\pgf@time@t\pgf@yb\advance\pgf@yb by\pgf@time@s\pgf@yc% + % Second iteration: + \pgf@x=\pgf@time@t\pgf@x\advance\pgf@x by\pgf@time@s\pgf@xa% + \pgf@y=\pgf@time@t\pgf@y\advance\pgf@y by\pgf@time@s\pgf@ya% + \pgf@xa=\pgf@time@t\pgf@xa\advance\pgf@xa by\pgf@time@s\pgf@xb% + \pgf@ya=\pgf@time@t\pgf@ya\advance\pgf@ya by\pgf@time@s\pgf@yb% + % Save x/y + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + % Third iteration: + \pgf@x=\pgf@time@t\pgf@x\advance\pgf@x by\pgf@time@s\pgf@xa% + \pgf@y=\pgf@time@t\pgf@y\advance\pgf@y by\pgf@time@s\pgf@ya% +} + + + + + + +% Internal registers +\newdimen\pgf@xx +\newdimen\pgf@xy +\newdimen\pgf@yx +\newdimen\pgf@yy +\newdimen\pgf@zx +\newdimen\pgf@zy + + + +% Store a value in polar-coordinates +% +% #1 = a degree +% #2 = a radius +% +% x = #2 * cos(#1) +% y = #2 * sin(#2) +% +% Example: +% +% % Create a slanted rectangle +% +% \pgfpathmoveto{\pgfpointpolar{30}{1cm}} + +\def\pgfpointpolar#1#2{% + \pgfsincos{#1}% + \in@/{#2}% + \ifin@% + \pgf@polar@#2\@@% + \else% + \pgf@polar@#2/#2\@@% + \fi% + \pgf@xa=\pgf@sys@tonumber{\pgf@x}\pgf@xa% + \pgf@ya=\pgf@sys@tonumber{\pgf@y}\pgf@ya% + \pgf@y=\pgf@xa\relax% + \pgf@x=\pgf@ya\ignorespaces} + +\def\pgf@polar@#1/#2\@@{% + \setlength{\pgf@xa}{#2}% + \setlength{\pgf@ya}{#1}% +} + + + +% Store the vector #1 * x-vec + #2 * y-vec +% +% #1 = a factor for the x-vector +% #2 = a factor fot the y-vector +% +% x = x-component of result vector +% y = y-component of result vector +% +% Description: +% +% This command can be used to create a new coordinate system +% without using the rotate/translate/scale commands. This +% may be useful, if you do not want arrows and line width to +% be scaled/transformed together with the coordinate system. +% +% Example: +% +% % Create a slanted rectangle +% +% \pgfsetxvec{\pgfpoint{1cm}{1cm}} +% \pgfsetyvec{\pgfpoint{0cm}{1cm}} +% +% \pgfpathmoveto{\pgfpointxy{0}{0}} +% \pgfpathlineto{\pgfpointxy{1}{0}} +% \pgfpathlineto{\pgfpointxy{1}{1}} +% \pgfpathlineto{\pgfpointxy{0}{1}} +% \pgfclosestroke + +\def\pgfpointxy#1#2{\pgf@x=#1\pgf@xx% + \advance\pgf@x by #2\pgf@yx% + \pgf@y=#1\pgf@xy% + \advance\pgf@y by #2\pgf@yy} + + +% Store the vector #1 * x-vec + #2 * y-vec + #3 * z-vec +% +% #1 = a factor for the x-vector +% #2 = a factor fot the y-vector +% #3 = a factor fot the z-vector +% +% x = x-component of result vector +% y = y-component of result vector +% +% +% Description: +% +% This command allows you to use a 3d coordinate system. +% +% +% Example: +% +% % Draw a cubus +% +% \pgfline{\pgfpointxyz{0}{0}{0}}{\pgfpointxyz{0}{0}{1}} +% \pgfline{\pgfpointxyz{0}{1}{0}}{\pgfpointxyz{0}{1}{1}} +% \pgfline{\pgfpointxyz{1}{0}{0}}{\pgfpointxyz{1}{0}{1}} +% \pgfline{\pgfpointxyz{1}{1}{0}}{\pgfpointxyz{1}{1}{1}} +% \pgfline{\pgfpointxyz{0}{0}{0}}{\pgfpointxyz{0}{1}{0}} +% \pgfline{\pgfpointxyz{0}{0}{1}}{\pgfpointxyz{0}{1}{1}} +% \pgfline{\pgfpointxyz{1}{0}{0}}{\pgfpointxyz{1}{1}{0}} +% \pgfline{\pgfpointxyz{1}{0}{1}}{\pgfpointxyz{1}{1}{1}} +% \pgfline{\pgfpointxyz{0}{0}{0}}{\pgfpointxyz{1}{0}{0}} +% \pgfline{\pgfpointxyz{0}{0}{1}}{\pgfpointxyz{1}{0}{1}} +% \pgfline{\pgfpointxyz{0}{1}{0}}{\pgfpointxyz{1}{1}{0}} +% \pgfline{\pgfpointxyz{0}{1}{1}}{\pgfpointxyz{1}{1}{1}} + +\def\pgfpointxyz#1#2#3{% + \pgf@x=#1\pgf@xx% + \advance\pgf@x by #2\pgf@yx% + \advance\pgf@x by #3\pgf@zx% + \pgf@y=#1\pgf@xy% + \advance\pgf@y by #2\pgf@yy% + \advance\pgf@y by #3\pgf@zy} + + + + +% Set the x-vector +% +% #1 = a point the is the new x-vector +% +% Example: +% +% \pgfsetxvec{\pgfpoint{1cm}{0cm}} + +\def\pgfsetxvec#1{% + \pgf@process{#1}% + \pgf@xx=\pgf@x% + \pgf@xy=\pgf@y% + \ignorespaces} + + +% Set the y-vector +% +% #1 = a point the is the new y-vector +% +% Example: +% +% \pgfsetyvec{\pgfpoint{0cm}{1cm}} + +\def\pgfsetyvec#1{% + \pgf@process{#1}% + \pgf@yx=\pgf@x% + \pgf@yy=\pgf@y% + \ignorespaces} + + +% Set the z-vector +% +% #1 = a point the is the new z-vector +% +% Example: +% +% \pgfsetzvec{\pgfpoint{-0.385cm}{-0.385cm}} + +\def\pgfsetzvec#1{% + \pgf@process{#1}% + \pgf@zx=\pgf@x% + \pgf@zy=\pgf@y% + \ignorespaces} + + + +% Default values +\pgfsetxvec{\pgfpoint{1cm}{0cm}} +\pgfsetyvec{\pgfpoint{0cm}{1cm}} +\pgfsetzvec{\pgfpoint{-0.385cm}{-0.385cm}} + + + + +% Normalise a point. +% +% #1 = point with coordinates (a,b) +% +% x = a/\sqrt(a*a+b*b) +% y = b/\sqrt(a*a+b*b) +% +% Example: +% +% \pgfpointnormalised{\pgfpointxy{2}{1}} + +\def\pgfpointnormalised#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \ifdim\pgf@x<0pt\relax% move into first quadrant + \pgf@x=-\pgf@x% + \fi% + \ifdim\pgf@y<0pt\relax% + \pgf@y=-\pgf@y% + \fi% + \ifdim\pgf@x>\pgf@y% x > y + % make point small + \c@pgf@counta=\pgf@x% + \divide\c@pgf@counta by 65536\relax% + \ifnum\c@pgf@counta=0\relax% + \c@pgf@counta=1\relax% + \fi% + \divide\pgf@x by\c@pgf@counta% + \divide\pgf@y by\c@pgf@counta% + \divide\pgf@xa by\c@pgf@counta% + \divide\pgf@ya by\c@pgf@counta% + % ok. + \pgf@x=.125\pgf@x% + \pgf@y=.125\pgf@y% + \c@pgf@counta=\pgf@x% + \c@pgf@countb=\pgf@y% + \multiply\c@pgf@countb by 100% + \ifnum\c@pgf@counta<64\relax% + \pgf@x=1pt\relax% + \pgf@y=0pt\relax% + \else% + \divide\c@pgf@countb by \c@pgf@counta% + \pgf@setmath{x}{\csname pgf@cosfrac\the\c@pgf@countb\endcsname}% + \pgf@xc=8192pt% + \divide\pgf@xc by\c@pgf@counta% + \pgf@y=\pgf@sys@tonumber{\pgf@xc}\pgf@ya% + \pgf@y=\pgf@sys@tonumber{\pgf@x}\pgf@y% + \fi% + \ifdim\pgf@xa<0pt% + \pgf@x=-\pgf@x% + \fi% + \else% x <= y + % make point small + \c@pgf@counta=\pgf@y% + \divide\c@pgf@counta by 65536\relax% + \ifnum\c@pgf@counta=0\relax% + \c@pgf@counta=1\relax% + \fi% + \divide\pgf@x by\c@pgf@counta% + \divide\pgf@y by\c@pgf@counta% + \divide\pgf@xa by\c@pgf@counta% + \divide\pgf@ya by\c@pgf@counta% + % ok. + \pgf@x=.125\pgf@x% + \pgf@y=.125\pgf@y% + \c@pgf@counta=\pgf@y% + \c@pgf@countb=\pgf@x% + \multiply\c@pgf@countb by 100% + \ifnum\c@pgf@counta<64\relax% + \pgf@y=1pt\relax% + \pgf@x=0pt\relax% + \else% + \divide\c@pgf@countb by \c@pgf@counta% + \pgf@setmath{y}{\csname pgf@cosfrac\the\c@pgf@countb\endcsname}% + \pgf@xc=8192pt% + \divide\pgf@xc by\c@pgf@counta% + \pgf@x=\pgf@sys@tonumber{\pgf@xc}\pgf@xa% + \pgf@x=\pgf@sys@tonumber{\pgf@y}\pgf@x% + \fi% + \ifdim\pgf@ya<0pt% + \pgf@y=-\pgf@y% + \fi% + \fi\ignorespaces} + + + + + +% A point on a rectangle in a certain direction. +% +% #1 = a point pointing in some direction (length should be about 1pt, +% but need not be exact) +% #2 = upper right corner of a rectangle centered at the origin +% +% Returns the intersection of a line starting at the origin going in +% the given direction and the rectangle's border. +% +% Example: +% +% \pgfpointborderrectangle{\pgfpointnormalised{\pgfpointxy{2}{1}} +% {\pgfpoint{1cm}{2cm}} + +\def\pgfpointborderrectangle#1#2{% + \pgf@process{#2}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{#1}% + % Ok, let's find out about the direction: + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \ifnum\pgf@xa<0\relax% move into first quadrant + \pgf@x=-\pgf@x% + \fi% + \ifnum\pgf@ya<0\relax% + \pgf@y=-\pgf@y% + \fi% + \pgf@xc=.125\pgf@x% + \pgf@yc=.125\pgf@y% + \c@pgf@counta=\pgf@xc% + \c@pgf@countb=\pgf@yc% + \ifnum\c@pgf@countb<\c@pgf@counta% + \ifnum\c@pgf@counta<255\relax% + \pgf@y=\pgf@yb\relax% + \pgf@x=0pt\relax% + \else% + \pgf@xc=8192pt% + \divide\pgf@xc by\c@pgf@counta% \pgf@xc = 1/\pgf@x + \pgf@y=\pgf@sys@tonumber{\pgf@xc}\pgf@y% + \pgf@y=\pgf@sys@tonumber{\pgf@xb}\pgf@y% + \ifnum\pgf@y<\pgf@yb% + \pgf@x=\pgf@xb% + \else% rats, calculate intersection on upper side + \ifnum\c@pgf@countb<255\relax% + \pgf@x=\pgf@xb\relax% + \pgf@y=0pt\relax% + \else% + \pgf@yc=8192pt% + \divide\pgf@yc by\c@pgf@countb% \pgf@xc = 1/\pgf@x + \pgf@x=\pgf@sys@tonumber{\pgf@yc}\pgf@x% + \pgf@x=\pgf@sys@tonumber{\pgf@yb}\pgf@x% + \pgf@y=\pgf@yb% + \fi% + \fi% + \fi% + \else% + \ifnum\c@pgf@countb<255\relax% + \pgf@x=\pgf@xb\relax% + \pgf@y=0pt\relax% + \else% + \pgf@yc=8192pt% + \divide\pgf@yc by\c@pgf@countb% \pgf@xc = 1/\pgf@x + \pgf@x=\pgf@sys@tonumber{\pgf@yc}\pgf@x% + \pgf@x=\pgf@sys@tonumber{\pgf@yb}\pgf@x% + \ifnum\pgf@x<\pgf@xb% + \pgf@y=\pgf@yb% + \else% + \ifnum\c@pgf@counta<255\relax% + \pgf@y=\pgf@yb\relax% + \pgf@x=0pt\relax% + \else% + \pgf@xc=8192pt% + \divide\pgf@xc by\c@pgf@counta% \pgf@xc = 1/\pgf@x + \pgf@y=\pgf@sys@tonumber{\pgf@xc}\pgf@y% + \pgf@y=\pgf@sys@tonumber{\pgf@xb}\pgf@y% + \pgf@x=\pgf@xb% + \fi% + \fi% + \fi% + \fi% + \ifnum\pgf@xa<0\relax\pgf@x=-\pgf@x\fi% + \ifnum\pgf@ya<0\relax\pgf@y=-\pgf@y\fi% +} + + + + +% An approximation to a point on an ellipse in a certain +% direction. Will be exact only if the ellipse is a circle. +% +% #1 = a point pointing in some direction +% #2 = upper right corner of a bounding box for the ellipse +% +% Returns the intersection of a line starting at the origin going in +% the given direction and the ellipses border. +% +% Example: +% +% \pgfpointborderellipse{\pgfpointnormalised{\pgfpointxy{2}{1}} +% {\pgfpoint{1cm}{2cm}} + +\def\pgfpointborderellipse#1#2{% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \ifdim\pgf@xa=\pgf@ya% circle. that's easy! + \pgf@process{\pgfpointnormalised{#1}}% + \pgf@x=\pgf@sys@tonumber{\pgf@xa}\pgf@x% + \pgf@y=\pgf@sys@tonumber{\pgf@xa}\pgf@y% + \else% + \ifdim\pgf@xa<\pgf@ya% + % Ok, first, let's compute x/y: + \c@pgf@countb=\pgf@ya% + \divide\c@pgf@countb by65536\relax% + \divide\pgf@x by\c@pgf@countb% + \divide\pgf@y by\c@pgf@countb% + \pgf@xc=\pgf@x% + \pgf@yc=8192pt% + \pgf@y=.125\pgf@y% + \c@pgf@countb=\pgf@y% + \divide\pgf@yc by\c@pgf@countb% + \pgf@process{#1}% + \pgf@y=\pgf@sys@tonumber{\pgf@yc}\pgf@y% + \pgf@y=\pgf@sys@tonumber{\pgf@xc}\pgf@y% + \pgf@process{\pgfpointnormalised{}}% + \pgf@x=\pgf@sys@tonumber{\pgf@xa}\pgf@x% + \pgf@y=\pgf@sys@tonumber{\pgf@ya}\pgf@y% + \else% + % Ok, now let's compute y/x: + \c@pgf@countb=\pgf@xa% + \divide\c@pgf@countb by65536\relax% + \divide\pgf@x by\c@pgf@countb% + \divide\pgf@y by\c@pgf@countb% + \pgf@yc=\pgf@y% + \pgf@xc=8192pt% + \pgf@x=.125\pgf@x% + \c@pgf@countb=\pgf@x% + \divide\pgf@xc by\c@pgf@countb% + \pgf@process{#1}% + \pgf@x=\pgf@sys@tonumber{\pgf@yc}\pgf@x% + \pgf@x=\pgf@sys@tonumber{\pgf@xc}\pgf@x% + \pgf@process{\pgfpointnormalised{}}% + \pgf@x=\pgf@sys@tonumber{\pgf@xa}\pgf@x% + \pgf@y=\pgf@sys@tonumber{\pgf@ya}\pgf@y% + \fi% + \fi% +} + + + + + +% Extract the x-coordinate of a point to a dimensions +% +% #1 = a TeX dimension +% #2 = a point +% +% Example: +% +% \newdimen\mydim +% \pgfextractx{\mydim}{\pgfpoint{2cm}{4pt}} +% % \mydim is now 2cm + +\def\pgfextractx#1#2{% + \pgf@process{#2}% + #1=1.00374\pgf@x\relax} + + +% Extract the y-coordinate of a point to a dimensions +% +% #1 = a TeX dimension +% #2 = a point +% +% Example: +% +% \newdimen\mydim +% \pgfextracty{\mydim}{\pgfpoint{2cm}{4pt}} +% % \mydim is now 4pt + +\def\pgfextracty#1#2{% + \pgf@process{#2}% + #1=1.00374\pgf@y\relax} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex new file mode 100644 index 00000000000..50c63ac22c7 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex @@ -0,0 +1,131 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorequick.code.tex,v 1.1.1.1 2005/06/29 12:14:04 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +% 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.555\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 diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex new file mode 100644 index 00000000000..2f68e256038 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex @@ -0,0 +1,379 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.9 2005/10/14 13:13:23 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + +% Globals + +\newbox\pgfpic +\newbox\pgf@hbox + +\newbox\pgf@layerbox@main + + +% Scopes + + +% Pgf scope environment. All changes of the graphic state are local to +% the scope. +% +% Example: +% +% \begin{pgfscope} +% \pgfsetlinewidth{3pt} +% \pgfline{\pgfxy(0,0)}{\pgfxy(3,3)} +% \end{pgfscope} + +\def\pgfscope{% + \pgfsyssoftpath@setcurrentpath\@empty% + \pgfsys@beginscope% + \pgf@resetpathsizes% + \edef\pgfscope@linewidth{\the\pgflinewidth}% + \begingroup} +\def\endpgfscope{% + \endgroup% + \global\pgflinewidth=\pgfscope@linewidth% + \pgfsys@endscope} + + + + +% Quickly insert a box can contain normal TeX text at the origin. +% +% #1 = box of width/height and depth 0pt +% +% Example: +% +% \pgfqbox{\mybox} + +\def\pgfqbox#1{% + \pgfsys@hbox#1% +} + + +% Insert a box that can contain normal TeX text at the origin, but +% with the current coordinate transformation matrix synced with the +% low-level transformation matrix. +% +% #1 = box of width/height and depth 0pt +% +% In essence, this command does the same as if you first said +% \pgflowlevelsynccm and then \pgfqbox. However, pgf will use a +% ``TeX-translation'' for the translation part of the transformation +% cm. This will ensure that hyperlinks ``survive'' at least +% translations. +% +% Example: +% +% \pgfqboxsynced{\mybox} + +\def\pgfqboxsynced#1{% + \pgfsys@hboxsynced#1% +} + + +% Puts some text in a box and inserts it with the current +% transformations applied. +% +% #1 = List of optional positioning. Possible values are ``left'', ``right'', +% ``top'', ``bottom'' and ``base''. +% #2 = TeX text. May contain verbatims. +% +% Example: +% +% \pgftransformshift{\pgfpoint{1cm}{0cm}} +% \pgftext{Hello World!} + +\def\pgftext{\@ifnextchar[\pgf@text{\pgf@text[]}}% +\def\pgf@text[#1]{% + \def\pgf@text@options{#1}% + \pgf@maketext\pgf@after@text} +\def\pgf@after@text{% + { + \def\pgf@text@hshift{center}% + \def\pgf@text@vshift{center}% + \def\pgf@marshal{\setkeys{pgfbox}}% + \expandafter\pgf@marshal\expandafter{\pgf@text@options}% + \csname pgf@halign\pgf@text@hshift\endcsname% + \csname pgf@valign\pgf@text@vshift\endcsname% + % Protocol sizes: + \pgf@process{\pgfpointtransformed{\pgfpoint{0pt}{\dp\pgf@hbox}}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@process{\pgfpointtransformed{\pgfpoint{\wd\pgf@hbox}{\dp\pgf@hbox}}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@process{\pgfpointtransformed{\pgfpoint{0pt}{\ht\pgf@hbox}}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@process{\pgfpointtransformed{\pgfpoint{\wd\pgf@hbox}{\ht\pgf@hbox}}}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgfqboxsynced{\pgf@hbox}% + }% +} + +\define@key{pgfbox}{left}[]{\def\pgf@text@hshift{left}} +\define@key{pgfbox}{center}[]{} +\define@key{pgfbox}{right}[]{\def\pgf@text@hshift{right}} +\define@key{pgfbox}{top}[]{\def\pgf@text@vshift{top}} +\define@key{pgfbox}{bottom}[]{\def\pgf@text@vshift{bottom}} +\define@key{pgfbox}{base}[]{\def\pgf@text@vshift{base}} +\define@key{pgfbox}{at}{\pgftransformshift{#1}} +\define@key{pgfbox}{x}{\pgftransformxshift{#1}} +\define@key{pgfbox}{y}{\pgftransformyshift{#1}} +\define@key{pgfbox}{rotate}{\pgftransformrotate{#1}} + +\def\pgf@halignleft{}% do nothing +\def\pgf@haligncenter{\pgftransformxshift{-.5\wd\pgf@hbox}} +\def\pgf@halignright{\pgftransformxshift{-\wd\pgf@hbox}}% +\def\pgf@valignbase{}% do nothing +\def\pgf@valignbottom{\pgftransformyshift{\dp\pgf@hbox}}% +\def\pgf@valigncenter{\pgftransformyshift{.5\dp\pgf@hbox}\pgftransformyshift{-.5\ht\pgf@hbox}}% +\def\pgf@valigntop{\pgftransformyshift{-\ht\pgf@hbox}}% + + +% Internal function for creating a hbox. +\def\pgf@maketext#1{% + \def\pgf@@maketextafter{#1}% + \setbox\pgf@hbox=\hbox\bgroup% + \pgfinterruptpicture% + \bgroup% + \aftergroup\pgf@collectresetcolor% + \let\next=% +} +\def\pgf@collectresetcolor{% + \@ifnextchar\reset@color% + {\reset@color\afterassignment\pgf@collectresetcolor\let\pgf@temp=}% + {\pgf@textdone}% +} +\def\pgf@textdone{% + \endpgfinterruptpicture% + \egroup% + \pgf@@maketextafter% +} + +\long\def\pgf@makehbox#1{% + \setbox\pgf@hbox=\hbox{{% + \pgfinterruptpicture% + #1% + \endpgfinterruptpicture% + }}} + + + + +% Picture environment +% +% Example: +% +% \begin{pgfpicture} +% \pgfsetendarrow{\pgfarrowto} +% \pgfpathmoveto{\pgfpointxy{-0.9}{0.2}} +% \pgfpathlineto{\pgfpointxy{0.9}{0.4}} +% \pgfusepath{stroke} +% \end{pgfpicture} + +\newif\ifpgfpicture + +\def\pgfpicture{% + \begingroup% + \pgfpicturetrue% + \pgf@picmaxx=-16000pt\relax% + \pgf@picminx=16000pt\relax% + \pgf@picmaxy=-16000pt\relax% + \pgf@picminy=16000pt\relax% + \pgf@relevantforpicturesizetrue% + \pgf@resetpathsizes% + \@ifnextchar\bgroup\pgf@oldpicture\pgf@picture} +\def\pgf@oldpicture#1#2#3#4{% + \setlength\pgf@picminx{#1}% + \setlength\pgf@picminy{#2}% + \setlength\pgf@picmaxx{#3}% + \setlength\pgf@picmaxy{#4}% + \pgf@relevantforpicturesizefalse% + \pgf@picture} + +\def\pgf@picture{% + \setbox\pgfpic\hbox to0pt\bgroup% + \begingroup% + \color{.}% + \pgfsys@beginpicture% + \pgfsys@beginscope% + \pgfsetlinewidth{0.4pt}% + \pgftransformreset% + \pgfsyssoftpath@setcurrentpath\@empty% + \begingroup% + \let\pgf@setlengthorig=\setlength% + \let\pgf@addtolengthorig=\addtolength% + \let\pgf@selectfontorig=\selectfont% + \let\setlength=\pgf@setlength% + \let\addtolength=\pgf@addtolength% + \let\selectfont=\pgf@selectfont% + \nullfont\spaceskip\z@\xspaceskip\z@% + \setbox\pgf@layerbox@main\hbox to0pt\bgroup% + \begingroup% + } +\def\endpgfpicture{% + % Shift baseline outside: + \global\let\pgf@shift@baseline=\pgf@baseline% + \endgroup% + \egroup% + \pgf@insertlayers% + \endgroup% + \pgfsys@discardpath\pgfsys@endscope% + \pgfsys@endpicture% + \endgroup% + \hss + \egroup% + % ok, now let's position the box + \ifdim\pgf@picmaxx=-16000pt\relax% + % empty picture. make size 0. + \pgf@picmaxx=0pt\relax% + \pgf@picminx=0pt\relax% + \pgf@picmaxy=0pt\relax% + \pgf@picminy=0pt\relax% + \fi% + \pgfsys@typesetpicturebox\pgfpic% + \endgroup% +} + +\def\pgf@insertlayers{% + \box\pgf@layerbox@main% +} + + +% Sets the baseline +% +% #1 = baseline +% +% Sets the baseline of the picture. Default is the lower border, which +% is the same as \pgf@picminy +% +% Example: +% +% \pgfsetbaseline{1cm+2pt} + +\def\pgfsetbaseline#1{\def\pgf@baseline{#1}} +\pgfsetbaseline{\pgf@picminy} + + + + + +% Interrupt path +% +% Description: +% +% The environment can be used to insert some drawing commands while +% constructing a path. The drawing commands inside the environment +% will not interfere with the path being constructed ``outside.'' +% However, you must ward against graphic state changes using a scope. +% +% Example: Draw two parallel lines +% +% \pgfmoveto{\pgfpoint{0cm}{0cm}} +% \begin{pgfinterruptpath} +% \pgfmoveto{\pgfpoint{1cm}{0cm}} +% \pgfmoveto{\pgfpoint{1cm}{1cm}} +% \pgfusepath{stroke} +% \end{pgfinterruptpath} +% \pgflineto{\pgfpoint{0cm}{1cm}} +% \pgfusepath{stroke} + +\def\pgfinterruptpath +{% + \begingroup% + % save all sorts of things... + \edef\pgf@interrupt@savex{\the\pgf@path@lastx}% + \edef\pgf@interrupt@savey{\the\pgf@path@lasty}% + \pgf@getpathsizes\pgf@interrupt@pathsizes% + \pgfsyssoftpath@getcurrentpath\pgf@interrupt@path% + \pgfsyssoftpath@setcurrentpath\@empty% + \edef\pgfscope@linewidth{\the\pgflinewidth}% + \begingroup% +} +\def\endpgfinterruptpath +{% + \endgroup% + \global\pgflinewidth=\pgfscope@linewidth% + \pgfsyssoftpath@setcurrentpath\pgf@interrupt@path% + \pgf@setpathsizes\pgf@interrupt@pathsizes% + \global\pgf@path@lastx=\pgf@interrupt@savex% + \global\pgf@path@lasty=\pgf@interrupt@savey% + \endgroup% +} + + + + +% Interrupts a picture +% +% Description: +% +% This environment interrupts a picture and temporarily returns to +% normal TeX mode. All sorts of things are saved and restored by this +% environment. +% +% WARNING: Using this environment in conjuction with low level +% transformations can *strongly* upset the typesetting. Typically, the +% contents of this environment should have size/height/depth 0pt in +% the end. +% +% WARNING: This environment should only be used inside typesetting a +% box and this box must in turn be inserted using \pgfqbox. +% +% Example: Draw two parallel lines +% +% \pgfmoveto{\pgfpoint{0cm}{0cm}} +% \setbox\mybox=\hbox{ +% \begin{pgfinterruptpicture} +% This is normal text. +% \begin{pgfpicture} % a subpicture +% \pgfmoveto{\pgfpoint{1cm}{0cm}} +% \pgfmoveto{\pgfpoint{1cm}{1cm}} +% \pgfusepath{stroke} +% \end{pgfpicture} +% More text. +% \end{pgfinterruptpicture} +% } +% \ht\mybox=0pt +% \wd\mybox=0pt +% \dp\mybox=0pt +% \pgfqbox{\mybox}% +% \pgfpathlineto{\pgfpoint{0cm}{1cm}} +% \pgfusepath{stroke} + +\def\pgfinterruptpicture +{% + \begingroup% + \edef\pgf@interrupt@savemaxx{\the\pgf@picmaxx}% + \edef\pgf@interrupt@saveminx{\the\pgf@picminx}% + \edef\pgf@interrupt@savemaxy{\the\pgf@picmaxy}% + \edef\pgf@interrupt@saveminy{\the\pgf@picminy}% + \pgftransformreset% + \pgfinterruptpath% + \ifx\pgf@setlengthorig\@undefined% + \else% + \let\setlength\pgf@setlengthorig% + \let\addtolength\pgf@addtolengthorig% + \let\selectfont\pgf@selectfontorig% + \fi% + \selectfont% + \pgfpicturefalse% + \pgf@savelayers% +} +\def\endpgfinterruptpicture +{% + \pgf@restorelayers% + \endpgfinterruptpath% + \global\pgf@picmaxx=\pgf@interrupt@savemaxx% + \global\pgf@picmaxy=\pgf@interrupt@savemaxy% + \global\pgf@picminx=\pgf@interrupt@saveminx% + \global\pgf@picminy=\pgf@interrupt@saveminy% + \endgroup% +} + +\let\pgf@savelayers=\relax +\let\pgf@restorelayers=\relax + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex new file mode 100644 index 00000000000..707c1708789 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex @@ -0,0 +1,409 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreshade.code.tex,v 1.3 2005/07/17 22:34:19 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +% +% Parsing functions +% +\newdimen\pgf@max +\newcount\pgf@sys@shading@range@num +\def\pgf@parsefunc#1{% + \edef\temp{{#1}}% + \expandafter\pgf@convertrgbstring\temp% + \edef\temp{{\pgf@rgbconv}}% + \expandafter\pgf@@parsefunc\temp} +\def\pgf@@parsefunc#1{% + \let\pgf@bounds=\@empty% + \let\pgf@funcs=\@empty% + \let\pgf@psfuncs=\@empty% + \let\pgf@encode=\@empty% + \let\pgf@sys@shading@ranges=\@empty% + \pgf@sys@shading@range@num=0\relax% + \pgf@parsefirst[#1; ]% + \pgf@parselastdom[#1; ]% + \pgf@parsemid[#1; ]% + \ifx\pgf@bounds\@empty% + \edef\pgf@pdfparseddomain{0 1}% + \edef\pgf@pdfparsedfunction{\pgf@singlefunc\space}% + \else% + \edef\pgf@pdfparseddomain{\pgf@doma\space\pgf@domb}% + \edef\pgf@pdfparsedfunction{% + << /FunctionType 3 /Domain [\pgf@doma\space\pgf@domb] /Functions + [\pgf@funcs\space] /Bounds [\pgf@bounds] /Encode [0 1 \pgf@encode] + >> }% + \fi% + \xdef\pgf@psfuncs{\pgf@psfuncs}% + } +\def\pgf@parsefirst[rgb(#1)=(#2,#3,#4)#5]{% + \setlength\pgf@x{#1}% + \edef\pgf@sys@shading@start@pos{\the\pgf@x}% + \pgf@sys@bp@correct\pgf@x% + \edef\pgf@doma{\pgf@sys@tonumber{\pgf@x}}% + \edef\pgf@prevx{\pgf@sys@tonumber{\pgf@x}}% + \pgf@getrgbtuplewithmixin{#2}{#3}{#4}% + \edef\pgf@sys@shading@start@rgb{\pgf@sys@rgb}% + \let\pgf@sys@prevcolor=\pgf@sys@shading@start@rgb% + \let\pgf@sys@prevpos=\pgf@sys@shading@start@pos% + \edef\pgf@prevcolor{\pgf@rgb}% + \edef\pgf@firstcolor{\pgf@rgb}} +\def\pgf@parselastdom[rgb(#1)=(#2,#3,#4); {% + \@ifnextchar]{% + \setlength\pgf@x{#1}% + \edef\pgf@sys@shading@end@pos{\the\pgf@x}% + \pgf@max=\pgf@x\relax% + \pgf@sys@bp@correct\pgf@x% + \edef\pgf@domb{\pgf@sys@tonumber{\pgf@x}}% + \pgf@getrgbtuplewithmixin{#2}{#3}{#4}% + \edef\pgf@sys@shading@end@rgb{\pgf@sys@rgb}% + \@gobble}{\pgf@parselastdom[}} +\def\pgf@parsemid[rgb(#1)=(#2,#3,#4); {\pgf@parserest[} +\def\pgf@parserest[rgb(#1)=(#2,#3,#4); {% + \advance\pgf@sys@shading@range@num by1\relax% + \@ifnextchar]{% + \pgf@getrgbtuplewithmixin{#2}{#3}{#4}% + \edef\pgf@singlefunc{\space% + << /FunctionType 2 /Domain [0 1] /C0 + [\pgf@prevcolor] /C1 [\pgf@rgb] /N 1 >> }% + \edef\pgf@funcs{\pgf@funcs\space% + << /FunctionType 2 /Domain [\pgf@doma\space\pgf@domb] /C0 + [\pgf@prevcolor] /C1 [\pgf@rgb] /N 1 >> }% + \edef\pgf@psfuncs{\pgf@prevx\space \pgf@rgb\space \pgf@prevcolor\space pgfshade \pgf@psfuncs}% + \setlength\pgf@x{#1}% + \edef\pgf@sys@shading@ranges{\pgf@sys@shading@ranges{{\pgf@sys@prevpos}{\the\pgf@x}{\pgf@sys@prevcolor}{\pgf@sys@rgb}}}% + \edef\pgf@sys@prevpos{\the\pgf@x}% + \let\pgf@sys@prevcolor=\pgf@sys@rgb% + \@gobble}{% + \setlength\pgf@x{#1}% + \pgf@getrgbtuplewithmixin{#2}{#3}{#4}% + \edef\pgf@sys@shading@ranges{\pgf@sys@shading@ranges{{\pgf@sys@prevpos}{\the\pgf@x}{\pgf@sys@prevcolor}{\pgf@sys@rgb}}}% + \edef\pgf@sys@prevpos{\the\pgf@x}% + \let\pgf@sys@prevcolor=\pgf@sys@rgb% + \edef\pgf@psfuncs{\pgf@prevx\space \pgf@rgb\space \pgf@prevcolor\space pgfshade \pgf@psfuncs}% + \pgf@sys@bp@correct\pgf@x% + \edef\pgf@prevx{\pgf@sys@tonumber{\pgf@x}}% + \edef\pgf@bounds{\pgf@bounds\space\pgf@sys@tonumber{\pgf@x}}% + \edef\pgf@encode{\pgf@encode\space0 1}% + \edef\pgf@singlefunc{\space% + << /FunctionType 2 /Domain [0 1] /C0 + [\pgf@prevcolor] /C1 [\pgf@rgb] /N 1 >> }% + \edef\pgf@funcs{\pgf@funcs\space% + << /FunctionType 2 /Domain [\pgf@doma\space\pgf@domb] /C0 + [\pgf@prevcolor] /C1 [\pgf@rgb] /N 1 >> }% + \edef\pgf@prevcolor{\pgf@rgb}% + \pgf@parserest[}} + +\def\pgf@getrgbtuplewithmixin#1#2#3{% + \definecolor{pgfshadetemp}{rgb}{#1,#2,#3}% + \@ifundefined{applycolormixins}{}{\applycolormixins{pgfshadetemp}}% + \extractcolorspec{pgfshadetemp}{\pgf@tempcolor}% + \expandafter\convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% + \expandafter\pgf@getrgb@@\pgf@rgbcolor!} +\def\pgf@getrgb@@#1,#2,#3!{% + \def\pgf@rgb{#1 #2 #3}% + \def\pgf@sys@rgb{{#1}{#2}{#3}}% +} + + +\def\pgf@convertrgbstring#1{% + \def\pgf@rgbconv{}% + \pgf@converttorgb#1]% + } +\def\pgf@converttorgb{% + \@ifnextchar]{\@gobble}%done! + {% + \@ifnextchar;{\pgf@grabsemicolor}% + {% + \@ifnextchar r{\pgf@grabrgb}% + {% + \@ifnextchar g{\pgf@grabgray}% + {% + \@ifnextchar c{\pgf@grabcolor}% + {\PackageError{pgfshade}{Illformed shading + specification}{}\pgf@converttorgb}% + }% + }% + }% + }% +} +\def\pgf@grabsemicolor;{% + \edef\pgf@rgbconv{\pgf@rgbconv; }\pgf@converttorgb} +\def\pgf@grabrgb rgb(#1)=(#2,#3,#4){% + \edef\pgf@rgbconv{\pgf@rgbconv rgb(#1)=(#2,#3,#4)}\pgf@converttorgb} +\def\pgf@grabgray gray(#1)=(#2){% + \edef\pgf@rgbconv{\pgf@rgbconv rgb(#1)=(#2,#2,#2)}\pgf@converttorgb} +\def\pgf@grabcolor color(#1)=(#2){% + \colorlet{pgf@tempcol}{#2}% + \extractcolorspec{pgf@tempcol}{\pgf@tempcolor}% + \expandafter\convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% + \expandafter\pgf@convgetrgb@\expandafter{\pgf@rgbcolor}{#1}% +} +\def\pgf@convgetrgb@#1#2{% + \edef\pgf@rgbconv{\pgf@rgbconv rgb(#2)=(#1)}\pgf@converttorgb} + + + + +% Declares a horizontal shading for later use. The shading is a +% horizontal bar that changes its color. +% +% #1 = name of the shading for later use +% #2 = height of the shading +% #3 = color specification in the following format: A list of colors +% that the bar should have at certain points. If the bar should +% be red at 1cm, this is specified as +% "rgb(1cm)=(1,0,0)". Multiple specifications are separated by a +% semicolon and a space. At least two specifications must be +% given. The specified positions must be given in increasing +% order. +% +% Example: +% +% \pgfdeclarehorizontalshading{redtogreentoblue}{1cm}{% +% rgb(0cm)=(1,0,0); % red +% rgb(1cm)=(0,1,0); % green +% rgb(2cm)=(0,0,1)} +% +% \begin{document} +% The following bar is 2cm long: \pgfuseshading{redtogreentoblue}. +% \end{document} + +\def\pgfdeclarehorizontalshading{\@ifnextchar[\pgf@declarehorizontalshading{\pgf@declarehorizontalshading[]}}% +\def\pgf@declarehorizontalshading[#1]#2#3#4{% + \expandafter\def\csname pgf@deps@pgfshading#2!\endcsname{#1}% + \expandafter\ifx\csname pgf@deps@pgfshading#2!\endcsname\@empty% + \pgfsys@horishading{#2}{#3}{#4}% + \else% + \expandafter\def\csname pgf@func@pgfshading#2!\endcsname{\pgfsys@horishading}% + \expandafter\def\csname pgf@args@pgfshading#2!\endcsname{{#3}{#4}}% + \expandafter\let\csname @pgfshading#2!\endcsname=\@empty% + \fi} + + +% Declares a vertical shading for later use. +% +% #1 = name of the shading for later use +% #2 = height of the shading +% #3 = color specification +% +% Example: +% +% \pgfdeclareverticalshading{redtogreentoblue}{1cm}{% +% rgb(0cm)=(1,0,0); % red +% rgb(1cm)=(0,1,0); % green +% rgb(2cm)=(0,0,1)} +% +% \begin{document} +% The following bar is 2cm high: \pgfuseshading{redtogreentoblue}. +% \end{document} + +\def\pgfdeclareverticalshading{\@ifnextchar[\pgf@declareverticalshading{\pgf@declareverticalshading[]}}% +\def\pgf@declareverticalshading[#1]#2#3#4{% + \expandafter\def\csname pgf@deps@pgfshading#2!\endcsname{#1}% + \expandafter\ifx\csname pgf@deps@pgfshading#2!\endcsname\@empty% + \pgfsys@vertshading{#2}{#3}{#4}% + \else% + \expandafter\def\csname pgf@func@pgfshading#2!\endcsname{\pgfsys@vertshading}% + \expandafter\def\csname pgf@args@pgfshading#2!\endcsname{{#3}{#4}}% + \expandafter\let\csname @pgfshading#2!\endcsname=\@empty% + \fi} + + +% Declares a radial shading for later use. +% +% #1 = name of the shading for later use +% #2 = center of inner circle +% #3 = color specification +% +% Description: +% +% A radial shading creates a smooth color transition between two +% circles. The center of the inner circle is at the give position. Its +% radius is the start of the color specification. The +% center of the outer circle is at the center of the whole shading, +% whose radius is the end of the color specification. For example, +% suppose the color specification is "rgb(1cm)=(1,1,1); rgb(2cm)=(0,0,0)". +% Then the shading would be 4cm times 4cm large. The inner circle would +% have diameter 1cm and the outer circle would have diameter 2cm. The +% outer circle would be centered in the middle of the shading, whereas +% the outer circle would be centered at the given position. +% +% Example: +% +% \pgfdeclareradialshading{redtogreentoblue}{\pgfpoint{2cm}{2cm}}{% +% rgb(10pt)=(1,0,0); % red +% rgb(2cm)=(0,1,0); % green +% rgb(3cm)=(0,0,1)} +% +% \begin{document} +% The following ball has diameter 3cm: \pgfuseshading{redtogreentoblue}. +% \end{document} + +\def\pgfdeclareradialshading{\@ifnextchar[\pgf@declareradialshading{\pgf@declareradialshading[]}}% +\def\pgf@declareradialshading[#1]#2#3#4{% + \expandafter\def\csname pgf@deps@pgfshading#2!\endcsname{#1}% + \expandafter\ifx\csname pgf@deps@pgfshading#2!\endcsname\@empty% + \pgfsys@radialshading{#2}{#3}{#4}% + \else% + \expandafter\def\csname pgf@func@pgfshading#2!\endcsname{\pgfsys@radialshading}% + \expandafter\def\csname pgf@args@pgfshading#2!\endcsname{{#3}{#4}}% + \expandafter\let\csname @pgfshading#2!\endcsname=\@empty% + \fi} + + +% Inserts a box into the text that contains a previously defined +% shading. +% +% #1 = Name of a shading +% +% Example: +% +% \pgfuseshading{redtogreentoblue} + +\def\pgfuseshading#1{% + \edef\pgf@shadingname{@pgfshading#1}% + \pgf@tryextensions{\pgf@shadingname}{\pgfalternateextension}% + \expandafter\@ifundefined\expandafter{\pgf@shadingname}% + {\PackageError{pgfshade}{Undefined shading "#1"}{}}% + {% + {% + \globalcolorsfalse% + \def\pgf@shade@adds{}% + \@ifundefined{pgf@deps\pgf@shadingname}% + {}% + {% + \edef\@list{\csname pgf@deps\pgf@shadingname\endcsname}% + \@for\@temp:=\@list\do{% + {% + \@ifundefined{applycolormixins}{}{\applycolormixins{\@temp}}% + \extractcolorspec{\@temp}{\pgf@tempcolor}% + \expandafter\convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% + \xdef\pgf@shade@adds{\pgf@shade@adds,\pgf@rgbcolor}% + }% + }% + }% + \expandafter\pgf@strip@shadename\pgf@shadingname!!% + \@ifundefined{@pgfshading\pgf@basename\pgf@shade@adds!}% + {% + {% + \expandafter\def\expandafter\@temp\expandafter{\csname pgf@func\pgf@shadingname\endcsname}% + \edef\@args{{\pgf@basename\pgf@shade@adds}}% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\@@args% + \expandafter\expandafter\expandafter{\csname pgf@args\pgf@shadingname\endcsname}% + \expandafter\expandafter\expandafter\@temp\expandafter\@args\@@args% + % + }% + }% + {}% + \pgf@invokeshading{\csname @pgfshading\pgf@basename\pgf@shade@adds!\endcsname}% + }% + }% +} + +\def\pgf@strip@shadename @pgfshading#1!!!{\def\pgf@basename{#1}} + +\def\pgf@invokeshading#1{% + \ifpgfpicture% + \pgfsys@shadinginsidepgfpicture{#1}% + \else% + \pgfsys@shadingoutsidepgfpicture{#1}% + \fi% +} + + +% Create an alias name for a shading +% +% #1 = name of the alias +% #2 = name of the original +% +% Example: +% +% \pgfaliasshading{shading!25}{shadingshaded} + +\def\pgfaliasshading#1#2{% + \expandafter\let\expandafter\pgf@temp\expandafter=\csname @pgfshading#2!\endcsname% + \expandafter\let\csname @pgfshading#1!\endcsname=\pgf@temp% + \expandafter\let\expandafter\pgf@temp\expandafter=\csname pgf@deps@pgfshading#2!\endcsname% + \expandafter\let\csname pgf@deps@pgfshading#1!\endcsname=\pgf@temp% + \expandafter\let\expandafter\pgf@temp\expandafter=\csname pgf@func@pgfshading#2!\endcsname% + \expandafter\let\csname pgf@func@pgfshading#1!\endcsname=\pgf@temp% + \expandafter\let\expandafter\pgf@temp\expandafter=\csname pgf@args@pgfshading#2!\endcsname% + \expandafter\let\csname pgf@args@pgfshading#1!\endcsname=\pgf@temp% +} + + + + +% Shades the current path, but does not discard it. +% +% #1 - a shading (see below) +% #2 - an angle +% +% Description: +% +% \pgfshadepath ``tries'' to fill the +% current path with a shading. The shading's original size should +% completely cover the area between (0,0) and (100bp,100bp). The +% shading will be rotated by #2 and then rescaled so that it +% completely covers the path. Then the path will be used (locally) for +% clipping and the shading is drawn. +% +% After all this, the path can still be used for the normal +% stroking/clipping operations. +% +% The shading is rotated around its middle. If no rotation occurs, the +% lower left corner of the path will lie on (25bp, 25bp), the upper +% right corner on (75bp, 75bp). +% +% Example: +% +% \pgfdeclareverticalshading{myshading}{100bp}{color(0pt)=(red); color(100bp)=(green)} +% +% \pgfpathmoveto{\pgforigin} +% \pgfpathlineto{\pgfxy(1,0)} +% \pgfpathlineto{\pgfxy(1,1)} +% \pgfshadepath{myshading}{0} +% \pgfusepath{stroke} + +\def\pgfshadepath#1#2{% + \ifdim\pgf@pathminx=16000pt% + \PackageWarning{pgfshade}{No path specified that can be filled}% + \else% + \begingroup% + \pgfsys@beginscope% + % Calculate center: + \pgf@xb=.5\pgf@pathmaxx% + \advance\pgf@xb by.5\pgf@pathminx% + \pgf@yb=.5\pgf@pathmaxy% + \advance\pgf@yb by.5\pgf@pathminy% + % Calculate scaling: + \pgf@xc=\pgf@pathmaxx% + \advance\pgf@xc by-\pgf@pathminx% + \pgf@yc=\pgf@pathmaxy% + \advance\pgf@yc by-\pgf@pathminy% + \pgf@xc=.02\pgf@xc% + \pgf@yc=.02\pgf@yc% + \pgfsyssoftpath@invokecurrentpath% + \pgfsys@clipnext% + \pgfsys@discardpath% + % Compute new transformation matrix: + \pgf@process{\pgfsincos{#2}}% + \pgf@xa=-\pgf@x% + \pgfsys@transformcm{1}{0}{0}{1}{\pgf@xb}{\pgf@yb}% + \pgfsys@transformcm% + {\pgf@sys@tonumber{\pgf@xc}}{0}% + {0}{\pgf@sys@tonumber{\pgf@yc}}{0pt}{0pt}% + \pgfsys@transformcm% + {\pgf@sys@tonumber{\pgf@y}}{\pgf@sys@tonumber{\pgf@x}}% + {\pgf@sys@tonumber{\pgf@xa}}{\pgf@sys@tonumber{\pgf@y}}{0pt}{0pt}% + \pgfuseshading{#1}% + \pgfsys@endscope% + \endgroup% + \fi% +} + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex new file mode 100644 index 00000000000..b9c1e51cff0 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex @@ -0,0 +1,540 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoretransformations.code.tex,v 1.1.1.1 2005/06/29 12:14:04 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + +% Position transformations + +\newdimen\pgf@pt@x +\newdimen\pgf@pt@y + +\newdimen\pgf@pt@temp + +\newif\ifpgf@pt@identity +\pgf@pt@identitytrue + +\def\pgf@pt@aa{1.0} \def\pgf@pt@ab{0.0} +\def\pgf@pt@ba{0.0} \def\pgf@pt@bb{1.0} + + + +% Store the current transformation matrix in a macro. +% +% #1 = macro name +% +% Example: +% +% \pgfgettransform\mytransform + +\def\pgfgettransform#1{% + \edef#1{{\pgf@pt@aa}{\pgf@pt@ab}{\pgf@pt@ba}{\pgf@pt@bb}{\the\pgf@pt@x}{\the\pgf@pt@y}} +} + + +% Restore the current transformation matrix from a macro. +% +% #1 = macro name, previously used with \pgfgettransform +% +% Example: +% +% \pgfsettransform\mytransform + +\def\pgfsettransform#1{% + \edef\pgf@temp{#1}% + \expandafter\pgf@settransform\pgf@temp% +} +\def\pgf@settransform#1#2#3#4#5#6{% + \def\pgf@pt@aa{#1}% + \def\pgf@pt@ab{#2}% + \def\pgf@pt@ba{#3}% + \def\pgf@pt@bb{#4}% + \pgf@pt@x=#5% + \pgf@pt@y=#6% + \edef\pgf@idtest{#1,#2,#3,#4}% + \ifx\pgf@idtest\pgf@idmatrixtext% + \pgf@pt@identitytrue% + \else% + \pgf@pt@identityfalse% + \fi% +} + +\def\pgf@idmatrixtext{1.0,0.0,0.0,1.0} + + +% Transformation command +% +% #1 = x dimension +% #2 = y dimension +% +% Description: +% +% Applies the pgfs transformation matrix to the point (#1,#2). The +% result is once more stored in the point. +% +% +% Example: +% +% \pgf@pos@transform{\pgf@x}{\pgf@y} + +\def\pgf@pos@transform#1#2{% + \ifpgf@pt@identity% + \else% + \pgf@pt@temp=#1% + #1=\pgf@pt@aa#1% + \advance#1 by\pgf@pt@ba#2% + #2=\pgf@pt@bb#2% + \advance#2 by\pgf@pt@ab\pgf@pt@temp% + \fi% + \advance#1 by\pgf@pt@x% + \advance#2 by\pgf@pt@y% +} + + +% Invert the current transformation matrix +% +% Description: +% +% This command replaces the current transformation matrix by its +% inverse. The inversion is not very exact if the matrix is nearly +% singular. +% +% Example: +% +% \pgftransforminvert + +\def\pgftransforminvert{% + % First, invert the shift. That's easy + \pgf@pt@x=-\pgf@pt@x + \pgf@pt@y=-\pgf@pt@y + \ifpgf@pt@identity% + \else% + % Sigh. Have to calculate the inverse of the matrix. + % Start with determinant + % Matrix = (aa ab + % ba bb) + {% + \@tempdima=\pgf@pt@aa pt% + \@tempdima=\pgf@pt@bb\@tempdima% aa * bb + \@tempdimb=\pgf@pt@ba pt% + \@tempdimb=\pgf@pt@ab\@tempdimb% ba * ab + \advance\@tempdima by -\@tempdimb% aa*bb - ba*ab + % Invert + \@tempdima=.125\@tempdima% + \c@pgf@counta=\@tempdima\relax% 8192*determinant + \@tempdima=8192pt% + \divide\@tempdima by\c@pgf@counta% + \pgf@x=\pgf@pt@bb\@tempdima% bb/(det A) + \xdef\pgf@new@pt@aa{\pgf@sys@tonumber{\pgf@x}}% + \pgf@x=\pgf@pt@aa\@tempdima% aa/(det A) + \xdef\pgf@new@pt@bb{\pgf@sys@tonumber{\pgf@x}}% + \@tempdima=-\@tempdima% + \pgf@x=\pgf@pt@ba\@tempdima% -ba/(det A) + \xdef\pgf@new@pt@ba{\pgf@sys@tonumber{\pgf@x}}% + \pgf@x=\pgf@pt@ab\@tempdima% -ab/(det A) + \xdef\pgf@new@pt@ab{\pgf@sys@tonumber{\pgf@x}}% + }% + \expandafter\def\expandafter\pgf@pt@aa\expandafter{\pgf@new@pt@aa}% + \expandafter\def\expandafter\pgf@pt@ab\expandafter{\pgf@new@pt@ab}% + \expandafter\def\expandafter\pgf@pt@ba\expandafter{\pgf@new@pt@ba}% + \expandafter\def\expandafter\pgf@pt@bb\expandafter{\pgf@new@pt@bb}% + \pgf@pt@temp=\pgf@pt@x% + \pgf@pt@x=\pgf@pt@aa\pgf@pt@x% + \advance\pgf@pt@x by\pgf@pt@ba\pgf@pt@y% + \pgf@pt@y=\pgf@pt@bb\pgf@pt@y% + \advance\pgf@pt@y by\pgf@pt@ab\pgf@pt@temp% + \fi% +} + + + + +% PGF-Level concatenation of the transformation matrix with a given +% matrix. +% +% #1 - #5 = a concatenation matrix (see pdf spec). Entry #5 is a +% translation point. +% +% Description: +% +% All coordinates given to subsequent path construction commands will +% be transformed additionally by the given transformation matrix. If +% the command is followed by a 6th argument, the transformation is +% only applied to this argument. +% +% +% Example: +% +% \pgftransformcm{1}{0}{0}{1}{\pgfpoint{100pt}{0pt}} % 100pt to the right. +% +% \pgftransformcm{2}{0}{0}{2}{\pgfpointorigin} % double in in size +% \pgfpathmoveto{\pgfpoint{0cm}{0cm}} +% \pgfpathlineto{\pgflineto{1cm}{1cm}} % actually 2cm/2cm + +\def\pgftransformcm#1#2#3#4#5{% + \edef\pgf@marshal{\noexpand\pgf@transformcm{#1}{#2}{#3}{#4}}% + \pgf@marshal{#5}% +} +\def\pgf@transformcm#1#2#3#4#5{% + {% + \pgf@process{#5}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + % + \pgf@x=#1pt% + \pgf@y=#2pt% + % + \pgf@xa=\pgf@pt@aa\pgf@x% + \advance\pgf@xa by \pgf@pt@ba\pgf@y% + % + \pgf@ya=\pgf@pt@ab\pgf@x% + \advance\pgf@ya by \pgf@pt@bb\pgf@y% + % + \pgf@x=#3pt% + \pgf@y=#4pt% + % + \pgf@xb=\pgf@pt@aa\pgf@x% + \advance\pgf@xb by \pgf@pt@ba\pgf@y% + % + \pgf@yb=\pgf@pt@ab\pgf@x% + \advance\pgf@yb by \pgf@pt@bb\pgf@y% + % + \pgf@x=\pgf@pt@aa\pgf@xc% + \advance\pgf@x by\pgf@pt@ba\pgf@yc% + \advance\pgf@x by\pgf@pt@x% + % + \pgf@y=\pgf@pt@ab\pgf@xc% + \advance\pgf@y by\pgf@pt@bb\pgf@yc% + \advance\pgf@y by\pgf@pt@y% + % + \global\pgf@x=\pgf@x% + \global\pgf@y=\pgf@y% + \xdef\pgf@tempaa{\pgf@sys@tonumber{\pgf@xa}}% + \xdef\pgf@tempab{\pgf@sys@tonumber{\pgf@ya}}% + \xdef\pgf@tempba{\pgf@sys@tonumber{\pgf@xb}}% + \xdef\pgf@tempbb{\pgf@sys@tonumber{\pgf@yb}}% + }% + \pgf@pt@x=\pgf@x% + \pgf@pt@y=\pgf@y% + \let\pgf@pt@aa=\pgf@tempaa% + \let\pgf@pt@ba=\pgf@tempba% + \let\pgf@pt@ab=\pgf@tempab% + \let\pgf@pt@bb=\pgf@tempbb% + \def\pgf@trans@idtest{#1,#2,#3,#4}% + \ifx\pgf@trans@idtest\pgf@trans@idtext% + \else% + \pgf@pt@identityfalse% + \fi% +} +\def\pgf@trans@idtext{1.0,0,0,1.0} + + + + + + +% Undo all transformations +% +% Example: +% +% \pgftansformreset + +\def\pgftransformreset{% + \pgf@pt@x=0pt% + \pgf@pt@y=0pt% + \def\pgf@pt@aa{1.0}% + \def\pgf@pt@ba{0.0}% + \def\pgf@pt@ab{0.0}% + \def\pgf@pt@bb{1.0}% + \pgf@pt@identitytrue% +} + + +% Undo all slanting/rotation, but not translations +% +% Example: +% +% \pgftansformreset + +\def\pgftransformresetnontranslations{% + \def\pgf@pt@aa{1.0}% + \def\pgf@pt@ba{0.0}% + \def\pgf@pt@ab{0.0}% + \def\pgf@pt@bb{1.0}% + \pgf@pt@identitytrue% +} + + + + +% Shifting command and environment +% +% #1 = vector by which all subsequent points should be moved. +% +% Example: +% +% \pgftansformshift{\pgfpoint{1cm}{1cm}} + +\def\pgftransformshift#1{\pgftransformcm{1.0}{0}{0}{1.0}{#1}} +\def\pgftransformxshift#1{\pgftransformcm{1.0}{0}{0}{1.0}{\pgfpoint{#1}{0pt}}} +\def\pgftransformyshift#1{\pgftransformcm{1.0}{0}{0}{1.0}{\pgfpoint{0pt}{#1}}} + + + + +% Scaling commands +% +% #1 = scaling for all subsequent points. +% +% Example: +% +% \pgftransformscale{2} +% \pgftransformxscale{2} +% \pgftransformyscale{2} + +\def\pgftransformscale#1{\pgftransformcm{#1}{0}{0}{#1}{\pgfpointorigin}} +\def\pgftransformxscale#1{\pgftransformcm{#1}{0}{0}{1.0}{\pgfpointorigin}} +\def\pgftransformyscale#1{\pgftransformcm{1.0}{0}{0}{#1}{\pgfpointorigin}} + + + +% Slanting commands +% +% #1 = slanting in x-direction. 1 means 45 degrees. +% +% Example: +% +% \pgftransformxslant{2} +% \pgftransformyslant{2} + +\def\pgftransformxslant#1{\pgftransformcm{1.0}{0}{#1}{1.0}{\pgfpointorigin}} +\def\pgftransformyslant#1{\pgftransformcm{1.0}{#1}{0}{1.0}{\pgfpointorigin}} + + + +% Rotation commands +% +% #1 = degrees for the rotation +% +% Example: +% +% \pgftransformrotate{30} + +\def\pgftransformrotate#1{% + \pgfsincos{#1}% + \pgf@xa=-\pgf@x% + \pgftransformcm% + {\pgf@sys@tonumber{\pgf@y}}{\pgf@sys@tonumber{\pgf@x}}% + {\pgf@sys@tonumber{\pgf@xa}}{\pgf@sys@tonumber{\pgf@y}}{\pgfpointorigin}% +} + + + +% The following two if's have the following effect: +% +% \ifpgfslopedattime decides whether the coordinate system of an +% xxxattime transformation command should be rotated such that text +% drawn on the line should be tangent to the line +% +% \ifpgfresetnontranslationattime decides whether the coordinate +% system of an xxxattime transformation command should be reset +% (concerning the non-translations) before a possible rotation is +% applied. This is useful, for example, if the main coordinate system +% is scaled by, say, a factor of 2 and you do not want that to apply +% to the text, but you do want the rotation to applyu. + +\newif\ifpgfslopedattime +\newif\ifpgfresetnontranslationattime + + +% Transform to the coordinate system of a point on a line +% +% #1 = a time fraction of line where to put the label, where 0 means start, +% 1 means end, and for example 0.5 means the middle. +% #2 = start of line +% #3 = end of line +% +% Example: +% +% { +% \pgftransformlineattime{.5}{\pgfxy(0,0)}{\pgfxy(3,2)} +% \pgftext{Hi!} +% } +% +% { +% \pgftransformlineattime{.75}{\pgfxy(0,0)}{\pgfxy(3,2)} +% \pgftransformresetnontranslations +% \pgftext{Hi!} +% } +% +\def\pgftransformlineattime#1#2#3{% + \pgftransformshift{\pgfpointlineattime{#1}{#2}{#3}}% + \ifpgfresetnontranslationattime% + \pgftransformresetnontranslations% + \fi% + \ifpgfslopedattime% + \pgf@process{#2}% + \pgf@xa=\pgf@x% xb/yb = start point + \pgf@ya=\pgf@y% + \pgf@process{#3}% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \ifdim\pgf@x<0pt% + \pgf@x=-\pgf@x% + \pgf@y=-\pgf@y% + \fi% + \pgfpointnormalised{}% x/y = normalised vector + \pgf@ya=-\pgf@y% + \pgftransformcm% + {\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}% + {\pgf@sys@tonumber{\pgf@ya}}{\pgf@sys@tonumber{\pgf@x}}{\pgfpointorigin}% + \fi% +} + + + + +% Transform to the coordinate system of a point on a curve +% +% #1 = a time fraction of line where to put the label, where 0 means start, +% 1 means end, and for example 0.5 means the middle. +% #2 = start of line +% #3 = first control +% #4 = second control +% #5 = end of line +% +% Example: +% +% { +% \pgftransformlabel{.5}{\pgfxy(0,0)}{\pgfxy(3,2)} +% \pgftext{Hi!} +% } +% +% { +% \pgftransformlabel{.75}{\pgfxy(0,0)}{\pgfxy(3,2)} +% \pgftransformresetnontranslations +% \pgftext{Hi!} +% } +% +\def\pgftransformcurveattime#1#2#3#4#5{% + \pgfpointcurveattime{#1}{#2}{#3}{#4}{#5}% + \pgftransformshift{\pgfpoint{\pgf@x}{\pgf@y}}% + \ifpgfresetnontranslationattime% + \pgftransformresetnontranslations% + \fi% + \ifpgfslopedattime% + \pgf@x=\pgf@xb% + \pgf@y=\pgf@yb% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \ifdim\pgf@x<0pt% + \pgf@x=-\pgf@x% + \pgf@y=-\pgf@y% + \fi% + \pgfpointnormalised{}% x/y = normalised vector + \pgf@ya=-\pgf@y% + \pgftransformcm% + {\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}% + {\pgf@sys@tonumber{\pgf@ya}}{\pgf@sys@tonumber{\pgf@x}}{\pgfpointorigin}% + \fi% +} + + + + + +% Transform to the coordinate system of an arrow at the end of the +% line going from point #1 to point #2 with the correct rotation. +% +% #1 = a start point an (invisible) line +% #2 = an end point an (invisible) line +% +% Example: +% +% \pgftransformarrow{\pgfpointorigin}{\pgfpoint{1cm}{0cm}} + +\def\pgftransformarrow#1#2{% + \pgftransformshift{#2}% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#1}% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + \pgf@x=\pgf@xa% + \pgf@y=\pgf@ya% + \pgfpointnormalised{}% + \pgf@ya=-\pgf@y% + \pgftransformcm% + {\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}% + {\pgf@sys@tonumber{\pgf@ya}}{\pgf@sys@tonumber{\pgf@x}}{\pgfpoint{0pt}{0pt}}% +} + + + +% Low-level transformations + +% Causes the current high-level transformation command to be applied +% to the low-level. +% +% Description: +% +% All subsequent drawing will be transformed additionally by the +% current high-level transformation. Thus, the high-level +% transformation becomes the low-level transformation. The high-level +% transformation is reset at this point. + +\def\pgflowlevelsynccm{% + \pgfsys@transformcm% + {\pgf@pt@aa}{\pgf@pt@ab}% + {\pgf@pt@ba}{\pgf@pt@bb}% + {\pgf@pt@x}{\pgf@pt@y}% + \pgftransformreset% + \pgf@relevantforpicturesizefalse% +} + + + +% Causes a transformation command to be applied to the ``lowlevel'' +% transformation matrix. +% +% #1 - a high-level transformation command +% +% Description: +% +% All subsequent drawing will be transformed additionally by the given +% transformation matrix. Note that PGF will no longer be able to +% ``keep track'' of the coordinates. Also, transformations are applied +% to *everything*, including line thickness and line endings. Most +% often, this is not desirable. +% +% Example: +% +% \pgflowlevel{\pgftransformcm{1}{0}{0}{1}{\pgfpoint{100pt}{0pt}}} % 100bp to the right. +% +% \begin{pgflowlevelscope}{\pgftransformcm{2}{0}{0}{2}{\pgfpointorigin}} % double in in size +% \pgfmoveto{\pgfpoint{0cm}{0cm}} +% \pgflineto{\pgflineto{1cm}{1cm}} % actually 2cm/2cm +% \end{pgflowlevelscope} + +\def\pgflowlevel#1{% + {% + \pgftransformreset% + #1% + \pgflowlevelsynccm% + }% + \pgf@relevantforpicturesizefalse% +} + +\def\pgflowlevelscope#1{\pgfscope\pgflowlevel{#1}} +\def\endpgflowlevelscope{\endpgfscope} + +\long\def\pgflowlevelobj#1#2{\pgfscope{\pgflowlevel{#1}#2}\endpgfscope} + + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz.code.tex new file mode 100644 index 00000000000..0002a30507b --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz.code.tex @@ -0,0 +1,2677 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/frontendlayer/tikz.code.tex,v 1.32 2005/10/18 08:03:44 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +\newdimen\tikz@lastx +\newdimen\tikz@lasty +\newdimen\tikz@lastxsaved +\newdimen\tikz@lastysaved + +\newdimen\tikzleveldistance +\newdimen\tikzsiblingdistance + +\newbox\tikz@figbox +\newbox\tikz@tempbox + +\newcount\tikztreelevel +\newcount\tikznumberofchildren +\newcount\tikznumberofcurrentchild + +\newcount\tikz@fig@count + +\newif\iftikz@node@is@a@label +\newif\iftikz@snaked + +\let\tikz@options=\@empty +\let\tikz@transform=\relax +\def\tikz@addoption#1{\expandafter\def\expandafter\tikz@options\expandafter{\tikz@options#1}} +\def\tikz@addmode#1{\expandafter\def\expandafter\tikz@mode\expandafter{\tikz@mode#1}} +\def\tikz@addtransform#1{% + \ifx\tikz@transform\relax% + #1% + \else% + \expandafter\def\expandafter\tikz@transform\expandafter{\tikz@transform#1}% + \fi% +} + + + +% Baseline options +\define@key{tikz}{baseline}[0pt]{\pgfsetbaseline{#1}}% + +% Draw options +\define@key{tikz}{line width}{\tikz@semiaddlinewidth{#1}}% + +\def\tikz@semiaddlinewidth#1{\tikz@addoption{\pgfsetlinewidth{#1}}\setlength\pgflinewidth{#1}} + +\define@key{tikz}{cap}{\tikz@addoption{\csname pgfset#1cap\endcsname}} +\define@key{tikz}{join}{\tikz@addoption{\csname pgfset#1join\endcsname}} +\define@key{tikz}{miter limit}{\tikz@addoption{\pgfsetmiterlimit{#1}}} + +\define@key{tikz}{dash pattern}{% syntax: on 2pt off 3pt on 4pt ... + \def\tikz@temp{#1}% + \ifx\tikz@temp\@empty% + \def\tikz@dashpattern{}% + \tikz@addoption{\pgfsetdash{}{0pt}}% + \else% + \def\tikz@dashpattern{}% + \expandafter\tikz@scandashon\@gobble#1o\@nil% + \edef\tikz@temp{{\tikz@dashpattern}{\noexpand\tikz@dashphase}}% + \expandafter\tikz@addoption\expandafter{\expandafter\pgfsetdash\tikz@temp}% + \fi} +\define@key{tikz}{dash phase}{% + \def\tikz@dashphase{#1}% + \edef\tikz@temp{{\tikz@dashpattern}{\noexpand\tikz@dashphase}}% + \expandafter\tikz@addoption\expandafter{\expandafter\pgfsetdash\tikz@temp}% +}% +\def\tikz@dashphase{0pt} + +\def\tikz@scandashon n#1o{% + \expandafter\def\expandafter\tikz@dashpattern\expandafter{\tikz@dashpattern{#1}}% + \@ifnextchar\@nil{\@gobble}{\tikz@scandashoff}} +\def\tikz@scandashoff ff#1o{% + \expandafter\def\expandafter\tikz@dashpattern\expandafter{\tikz@dashpattern{#1}}% + \@ifnextchar\@nil{\@gobble}{\tikz@scandashon}} + +\define@key{tikz}{draw opacity}{\tikz@addoption{\pgfsetstrokeopacity{#1}}} + +% Double draw options +\define@key{tikz}{double}[]{% + \def\tikz@temp{#1}% + \ifx\tikz@temp\@empty% + \else% + \def\tikz@double@color{#1}% + \fi% + \tikz@addmode{\tikz@mode@doubletrue}} +\define@key{tikz}{double distance}{% + \setlength{\pgf@x}{#1}% + \edef\tikz@double@width@distance{\the\pgf@x}% + \tikz@addmode{\tikz@mode@doubletrue}} + +\def\tikz@double@width@distance{0.6pt} +\def\tikz@double@color{white} + +% Fill options + +\define@key{tikz}{even odd rule}[]{\tikz@addoption{\pgfseteorule}} +\define@key{tikz}{nonzero rule}[]{\tikz@addoption{\pgfsetnonzerorule}} + +\define@key{tikz}{fill opacity}{\tikz@addoption{\pgfsetfillopacity{#1}}} + + +% Joined fill/draw options + +\define@key{tikz}{opacity}{\tikz@addoption{\pgfsetstrokeopacity{#1}\pgfsetfillopacity{#1}}} + + +% Main color options +\define@key{tikz}{color}{% + \tikz@addoption{% + \ifx\tikz@fillcolor\@empty% + \ifx\tikz@strokecolor\@empty% + \else% + \pgfsys@color@reset@inorderfalse% + \let\tikz@strokecolor\@empty% + \let\tikz@fillcolor\@empty% + \fi% + \else% + \pgfsys@color@reset@inorderfalse% + \let\tikz@strokecolor\@empty% + \let\tikz@fillcolor\@empty% + \fi% + \colorlet{tikz@color}{#1}% + \color{tikz@color}% + \pgfsys@color@reset@inordertrue% + }% + \def\tikz@textcolor{#1}} + + +% Rounding options +\define@key{tikz}{rounded corners}[4pt]{\pgfsetcornersarced{\pgfpoint{#1}{#1}}} +\define@key{tikz}{sharp corners}[]{\pgfsetcornersarced{\pgfpointorigin}} + + + +% Coordinate options +\define@key{tikz}{x}{\tikz@handle@vec{\pgfsetxvec}{\tikz@handle@x}#1\relax} +\define@key{tikz}{y}{\tikz@handle@vec{\pgfsetyvec}{\tikz@handle@y}#1\relax} +\define@key{tikz}{z}{\tikz@handle@vec{\pgfsetzvec}{\tikz@handle@z}#1\relax} + +\def\tikz@handle@vec#1#2{\@ifnextchar({\tikz@handle@coordinate#1}{\tikz@handle@single#2}} +\def\tikz@handle@coordinate#1{\tikz@scan@one@point#1} +\def\tikz@handle@single#1#2\relax{#1{#2}} +\def\tikz@handle@x#1{\pgfsetxvec{\pgfpoint{#1}{0pt}}} +\def\tikz@handle@y#1{\pgfsetyvec{\pgfpoint{0pt}{#1}}} +\def\tikz@handle@z#1{\pgfsetzvec{\pgfpoint{#1}{#1}}} + + +% Transformation options +\define@key{tikz}{scale}{\tikz@addtransform{\pgftransformscale{#1}}} +\define@key{tikz}{xscale}{\tikz@addtransform{\pgftransformxscale{#1}}} +\define@key{tikz}{xslant}{\tikz@addtransform{\pgftransformxslant{#1}}} +\define@key{tikz}{yscale}{\tikz@addtransform{\pgftransformyscale{#1}}} +\define@key{tikz}{yslant}{\tikz@addtransform{\pgftransformyslant{#1}}} +\define@key{tikz}{rotate}{\tikz@addtransform{\pgftransformrotate{#1}}} +\define@key{tikz}{rotate around}{\tikz@addtransform{\tikz@rotatearound{#1}}} +\def\tikz@rotatearound#1{% + \edef\tikz@temp{#1}% get rid of active stuff + \expandafter\tikz@rotateparseA\tikz@temp% +}% +\def\tikz@rotateparseA#1:{% + \def\tikz@temp@rot{#1}% + \tikz@scan@one@point\tikz@rotateparseB% +} +\def\tikz@rotateparseB#1{% + \pgf@process{#1}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgftransformshift{\pgfpoint{\pgf@xc}{\pgf@yc}}% + \pgftransformrotate{\tikz@temp@rot}% + \pgftransformshift{\pgfpoint{-\pgf@xc}{-\pgf@yc}}% +} + +\define@key{tikz}{shift}{\tikz@addtransform{\tikz@scan@one@point\pgftransformshift#1\relax}} +\define@key{tikz}{xshift}{\tikz@addtransform{\pgftransformxshift{#1}}} +\define@key{tikz}{yshift}{\tikz@addtransform{\pgftransformyshift{#1}}} +\define@key{tikz}{cm}{\tikz@addtransform{\tikz@parse@cm#1\relax}} +\define@key{tikz}{reset cm}{\tikz@addtransform{\pgftransformreset}} + +\def\tikz@parse@cm#1,#2,#3,#4,{% + \def\tikz@p@cm{{#1}{#2}{#3}{#4}}% + \tikz@scan@one@point\tikz@parse@cmA} +\def\tikz@parse@cmA#1{% + \expandafter\pgftransformcm\tikz@p@cm{#1}% +} + + + +% Grid options +\define@key{tikz}{xstep}{\def\tikz@grid@x{#1}} +\define@key{tikz}{ystep}{\def\tikz@grid@y{#1}} +\define@key{tikz}{step}{\def\tikz@grid@x{#1}\def\tikz@grid@y{#1}} + +\def\tikz@grid@x{1cm} +\def\tikz@grid@y{1cm} + + +% Path usage options +\newif\iftikz@mode@double +\newif\iftikz@mode@fill +\newif\iftikz@mode@draw +\newif\iftikz@mode@clip +\newif\iftikz@mode@boundary +\newif\iftikz@mode@shade +\let\tikz@mode=\@empty + +\def\tikz@nonetext{none} + +\define@key{tikz}{path only}[]{\let\tikz@mode=\@empty} +\define@key{tikz}{shade}[]{\tikz@addmode{\tikz@mode@shadetrue}} +\define@key{tikz}{fill}[]{% + \def\tikz@temp{#1}% + \ifx\tikz@temp\tikz@nonetext% + \tikz@addmode{\tikz@mode@fillfalse}% + \else% + \ifx\tikz@temp\@empty% + \else% + \tikz@addoption{\pgfsetfillcolor{#1}}% + \def\tikz@fillcolor{#1}% + \fi% + \tikz@addmode{\tikz@mode@filltrue}% + \fi% +} +\define@key{tikz}{draw}[]{% + \def\tikz@temp{#1}% + \ifx\tikz@temp\tikz@nonetext% + \tikz@addmode{\tikz@mode@drawfalse}% + \else% + \ifx\tikz@temp\@empty% + \else% + \tikz@addoption{\pgfsetstrokecolor{#1}}% + \def\tikz@strokecolor{#1}% + \fi% + \tikz@addmode{\tikz@mode@drawtrue}% + \fi% +} +\define@key{tikz}{clip}[]{\tikz@addmode{\tikz@mode@cliptrue}} +\define@key{tikz}{use as bounding box}[]{\tikz@addmode{\tikz@mode@boundarytrue}} + +\define@key{tikz}{save path}{\tikz@addmode{\pgfsyssoftpath@getcurrentpath#1\global\let#1=#1}} + +\let\tikz@fillcolor=\@empty +\let\tikz@strokecolor=\@empty + + +% Shading options +\define@key{tikz}{shading}{\def\tikz@shading{#1}\tikz@addmode{\tikz@mode@shadetrue}} +\define@key{tikz}{shading angle}{\def\tikz@shade@angle{#1}\tikz@addmode{\tikz@mode@shadetrue}} +\define@key{tikz}{top color}{% + \colorlet{tikz@axis@top}{#1}% + \colorlet{tikz@axis@middle}{tikz@axis@top!50!tikz@axis@bottom}% + \def\tikz@shading{axis}\def\tikz@shade@angle{0}\tikz@addmode{\tikz@mode@shadetrue}} +\define@key{tikz}{bottom color}{% + \colorlet{tikz@axis@bottom}{#1}% + \colorlet{tikz@axis@middle}{tikz@axis@top!50!tikz@axis@bottom}% + \def\tikz@shading{axis}\def\tikz@shade@angle{0}\tikz@addmode{\tikz@mode@shadetrue}} +\define@key{tikz}{middle color}{% + \colorlet{tikz@axis@middle}{#1}% + \def\tikz@shading{axis}\tikz@addmode{\tikz@mode@shadetrue}} +\define@key{tikz}{left color}{% + \colorlet{tikz@axis@top}{#1}% + \colorlet{tikz@axis@middle}{tikz@axis@top!50!tikz@axis@bottom}% + \def\tikz@shading{axis}\def\tikz@shade@angle{90}\tikz@addmode{\tikz@mode@shadetrue}} +\define@key{tikz}{right color}{% + \colorlet{tikz@axis@bottom}{#1}% + \colorlet{tikz@axis@middle}{tikz@axis@top!50!tikz@axis@bottom}% + \def\tikz@shading{axis}\def\tikz@shade@angle{90}\tikz@addmode{\tikz@mode@shadetrue}} +\define@key{tikz}{ball color}{\colorlet{tikz@ball}{#1}\def\tikz@shading{ball}\tikz@addmode{\tikz@mode@shadetrue}} +\define@key{tikz}{inner color}{\colorlet{tikz@radial@inner}{#1}\def\tikz@shading{radial}\tikz@addmode{\tikz@mode@shadetrue}} +\define@key{tikz}{outer color}{\colorlet{tikz@radial@outer}{#1}\def\tikz@shading{radial}\tikz@addmode{\tikz@mode@shadetrue}} + +\def\tikz@shading{axis} +\def\tikz@shade@angle{0} + +\pgfdeclareverticalshading[tikz@axis@top,tikz@axis@middle,tikz@axis@bottom]{axis}{100bp}{% + color(0bp)=(tikz@axis@bottom); + color(25bp)=(tikz@axis@bottom); + color(50bp)=(tikz@axis@middle); + color(75bp)=(tikz@axis@top); + color(100bp)=(tikz@axis@top)} + +\colorlet{tikz@axis@top}{gray} +\colorlet{tikz@axis@middle}{gray!50!white} +\colorlet{tikz@axis@bottom}{white} + +\pgfdeclareradialshading[tikz@ball]{ball}{\pgfpoint{-10bp}{10bp}}{% + color(0bp)=(tikz@ball!15!white); + color(9bp)=(tikz@ball!75!white); + color(18bp)=(tikz@ball!70!black); + color(25bp)=(tikz@ball!50!black); + color(50bp)=(black)} + +\colorlet{tikz@ball}{blue} + +\pgfdeclareradialshading[tikz@radial@inner,tikz@radial@outer]{radial}{\pgfpointorigin}{% + color(0bp)=(tikz@radial@inner); + color(25bp)=(tikz@radial@outer); + color(50bp)=(tikz@radial@outer)} + +\colorlet{tikz@radial@inner}{gray} +\colorlet{tikz@radial@outer}{white} + + + + + +% General shape options +\define@key{tikz}{name}{\edef\tikz@fig@name{#1}} + +\define@key{tikz}{shape}{\edef\tikz@shape{#1}} + +\define@key{tikz}{inner sep}{\def\pgfshapeinnerxsep{#1}\def\pgfshapeinnerysep{#1}} +\define@key{tikz}{inner xsep}{\def\pgfshapeinnerxsep{#1}} +\define@key{tikz}{inner ysep}{\def\pgfshapeinnerysep{#1}} + +\define@key{tikz}{outer sep}{\def\pgfshapeouterxsep{#1}\def\pgfshapeouterysep{#1}} +\define@key{tikz}{outer xsep}{\def\pgfshapeouterxsep{#1}} +\define@key{tikz}{outer ysep}{\def\pgfshapeouterysep{#1}} + +\define@key{tikz}{minimum width}{\def\pgfshapeminwidth{#1}} +\define@key{tikz}{minimum height}{\def\pgfshapeminheight{#1}} +\define@key{tikz}{minimum size}{\def\pgfshapeminwidth{#1}\def\pgfshapeminheight{#1}} + +\define@key{tikz}{anchor}{\def\tikz@anchor{#1}} + +\define@key{tikz}{left}[]{\def\tikz@anchor{east}\tikz@possibly@transform{x}{-}{#1}} +\define@key{tikz}{right}[]{\def\tikz@anchor{west}\tikz@possibly@transform{x}{}{#1}} +\define@key{tikz}{above}[]{\def\tikz@anchor{south}\tikz@possibly@transform{y}{}{#1}} +\define@key{tikz}{below}[]{\def\tikz@anchor{north}\tikz@possibly@transform{y}{-}{#1}} +\define@key{tikz}{above left}[]% + {\def\tikz@anchor{south east}% + \tikz@possibly@transform{x}{-}{#1}\tikz@possibly@transform{y}{}{#1}} +\define@key{tikz}{above right}[]% + {\def\tikz@anchor{south west}% + \tikz@possibly@transform{x}{}{#1}\tikz@possibly@transform{y}{}{#1}} +\define@key{tikz}{below left}[]% + {\def\tikz@anchor{north east}% + \tikz@possibly@transform{x}{-}{#1}\tikz@possibly@transform{y}{-}{#1}} +\define@key{tikz}{below right}[]% + {\def\tikz@anchor{north west}% + \tikz@possibly@transform{x}{}{#1}\tikz@possibly@transform{y}{-}{#1}} + +\define@key{tikz}{transform shape}[true]{% + \csname tikz@fullytransformed#1\endcsname% + \iftikz@fullytransformed% + \pgfresetnontranslationattimefalse% + \else% + \pgfresetnontranslationattimetrue% + \fi% +} + +\newif\iftikz@fullytransformed +\pgfresetnontranslationattimetrue% + +\def\tikz@anchor{center}% +\def\tikz@shape{rectangle}% + +\def\tikz@possibly@transform#1#2#3{% + \def\tikz@test{#3}% + \ifx\tikz@test\@empty% + \else% + \pgf@x=#3\relax% + \pgf@x=#2\pgf@x\relax% + \edef\tikz@marshal{\noexpand\tikz@addtransform{% + \expandafter\noexpand\csname pgftransform#1shift\endcsname{\the\pgf@x}}}% + \tikz@marshal% + \fi% +} + + +% Line/curve label placement options +\define@key{tikz}{sloped}[true]{\csname pgfslopedattime#1\endcsname} + +\define@key{tikz}{pos}{\edef\tikz@time{#1}} + +\def\tikz@time{.5} + + + +% Text options +\define@key{tikz}{text}{\def\tikz@textcolor{#1}} +\define@key{tikz}{font}{\def\tikz@textfont{#1}} +\define@key{tikz}{text width}{\def\tikz@text@width{#1}} +\define@key{tikz}{text ragged}[]% +{\def\tikz@text@action{\raggedright\rightskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax}} +\define@key{tikz}{text badly ragged}[]{\def\tikz@text@action{\raggedright\relax}} +\define@key{tikz}{text ragged left}[]% +{\def\tikz@text@action{\raggedleft\leftskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax}} +\define@key{tikz}{text badly ragged left}[]{\def\tikz@text@action{\raggedleft\relax}} +\define@key{tikz}{text justified}[]{\def\tikz@text@action{\leftskip\z@\rightskip\z@\relax}} +\define@key{tikz}{text centered}[]{\def\tikz@text@action{% + \leftskip\z@ plus2em% + \rightskip\z@ plus2em% + \spaceskip.3333em \xspaceskip.5em% + \parfillskip=0pt% + \let\\=\@centercr% for latex + \relax}} +\define@key{tikz}{text badly centered}[]% +{\def\tikz@text@action{% + \let\\=\@centercr% for latex + \parfillskip=0pt% + \rightskip\@flushglue% + \leftskip\@flushglue\relax}} + +\let\tikz@text@width=\@empty +\let\tikz@textcolor=\@empty +\let\tikz@textfont=\@empty + +\def\tikz@text@action{\raggedright\rightskip\z@ plus2em \spaceskip.3333em \xspaceskip.5em\relax} + + + + + +% Arrow options +\define@key{tikz}{arrows}{\tikz@processarrows{#1}} + +\define@key{tikz}{>}{% + \tikz@set@pointed{\csname pgf@arrows@invert#1\endcsname}{#1}% + \expandafter\tikz@processarrows\expandafter{\tikz@current@arrows}% +} + +\define@key{tikz}{shorten <}{\pgfsetshortenstart{#1}} +\define@key{tikz}{shorten >}{\pgfsetshortenend{#1}} + +\def\tikz@set@pointed#1#2{% + \@ifundefined{pgf@arrow@code@tikze@>@#2} + {% + \pgfarrowsdeclarealias{tikzs@<@#2}{tikze@>@#2}{#1}{#2}% + \pgfarrowsdeclarereversed{tikzs@>@#2}{tikze@<@#2}{#1}{#2}% + \pgfarrowsdeclarecombine*{tikz@|<@#2}{tikz@>|@#2}{#1}{#2}{|}{|}% + \pgfarrowsdeclaredouble[\pgflinewidth]{tikzs@<<@#2}{tikze@>>@#2}{#1}{#2}% + \pgfarrowsdeclarereversed{tikzs@>>@#2}{tikze@<<@#2}{tikzs@<<@#2}{tikze@>>@#2}% + }{}% + \@namedef{tikz@special@arrow@start<}{tikzs@<@#2}% + \@namedef{tikz@special@arrow@end>}{tikze@>@#2}% + \@namedef{tikz@special@arrow@start>}{tikzs@>@#2}% + \@namedef{tikz@special@arrow@end<}{tikze@<@#2}% + \@namedef{tikz@special@arrow@start|<}{tikz@|<@#2}% + \@namedef{tikz@special@arrow@end>|}{tikz@>|@#2}% + \@namedef{tikz@special@arrow@start<<}{tikzs@<<@#2}% + \@namedef{tikz@special@arrow@end>>}{tikze@>>@#2}% + \@namedef{tikz@special@arrow@start>>}{tikzs@<<@#2}% + \@namedef{tikz@special@arrow@end<<}{tikze@>>@#2}% +} + +\def\tikz@processarrows#1{% + \def\tikz@current@arrows{#1}% + \def\tikz@temp{#1}% + \ifx\tikz@temp\@empty% + \else% + \tikz@@processarrows#1\@nil + \fi% +} +\def\tikz@@processarrows#1-#2\@nil{% + \expandafter\ifx\csname tikz@special@arrow@start#1\endcsname\relax% + \pgfsetarrowsstart{#1} + \else% + \pgfsetarrowsstart{\csname tikz@special@arrow@start#1\endcsname}% + \fi% + \expandafter\ifx\csname tikz@special@arrow@end#2\endcsname\relax% + \pgfsetarrowsend{#2} + \else% + \pgfsetarrowsend{\csname tikz@special@arrow@end#2\endcsname}% + \fi% +} + +\tikz@set@pointed{\pgf@arrows@invertto}{to} +\def\tikz@current@arrows{-} + +% Parabola options +\define@key{tikz}{bend}{\tikz@scan@one@point\tikz@set@parabola@bend#1\relax}% +\define@key{tikz}{bend pos}{\def\tikz@parabola@bend@factor{#1}} +\define@key{tikz}{parabola height}{% + \def\tikz@parabola@bend@factor{.5}% + \def\tikz@parabola@bend{\pgfpointadd{\pgfpoint{0pt}{#1}}{\tikz@last@position@saved}}} + +\def\tikz@parabola@bend{\tikz@last@position@saved} +\def\tikz@parabola@bend@factor{0} + +\def\tikz@set@parabola@bend#1{\def\tikz@parabola@bend{#1}} + +% Axis options +\define@key{tikz}{domain}{\def\tikz@plot@domain{#1}} +\define@key{tikz}{range}{\def\tikz@plot@range{#1}} + +% Plot options +\define@key{tikz}{smooth}[]{\let\tikz@plot@handler=\pgfplothandlercurveto} +\define@key{tikz}{smooth cycle}[]{\let\tikz@plot@handler=\pgfplothandlerclosedcurve} +\define@key{tikz}{sharp plot}[]{\let\tikz@plot@handler\pgfplothandlerlineto} + +\define@key{tikz}{tension}{\pgfsetplottension{#1}} + +\define@key{tikz}{xcomb}[]{\let\tikz@plot@handler=\pgfplothandlerxcomb} +\define@key{tikz}{ycomb}[]{\let\tikz@plot@handler=\pgfplothandlerycomb} +\define@key{tikz}{polar comb}[]{\let\tikz@plot@handler=\pgfplothandlerpolarcomb} + +\define@key{tikz}{raw gnuplot}[true]{\csname tikz@plot@raw@gnuplot#1\endcsname} +\define@key{tikz}{prefix}{\def\tikz@plot@prefix{#1}} +\define@key{tikz}{id}{\def\tikz@plot@id{#1}} + +\define@key{tikz}{samples}{\def\tikz@plot@sampels{#1}} +\define@key{tikz}{parametric}[true]{\csname tikz@plot@parametric#1\endcsname} + +\define@key{tikz}{only marks}[]{\let\tikz@plot@handler\pgfplothandlerdiscard} + +\define@key{tikz}{mark}{\def\tikz@plot@mark{#1}} +\define@key{tikz}{mark options}{\def\tikz@plot@mark@options{#1}} +\define@key{tikz}{mark size}{\pgfsetplotmarksize{#1}} + +\let\tikz@plot@mark@options=\@empty + +\let\tikz@plot@handler=\pgfplothandlerlineto +\let\tikz@plot@mark=\@empty + +\def\tikz@plot@sampels{25} +\def\tikz@plot@domain{-5:5} + +\def\tikz@plot@prefix{\jobname.} +\def\tikz@plot@id{pgf-plot} + +\newif\iftikz@plot@parametric +\newif\iftikz@plot@raw@gnuplot + + +% Tree options +\define@key{tikz}{edge from parent path}{\def\tikz@edge@to@parent@path{#1}} + +\define@key{tikz}{parent anchor}{\def\tikzparentanchor{.#1}\ifx\tikzparentanchor\tikz@border@text\let\tikzparentanchor\@empty\fi} +\define@key{tikz}{child anchor}{\def\tikzchildanchor{.#1}\ifx\tikzchildanchor\tikz@border@text\let\tikzchildanchor\@empty\fi} + +\define@key{tikz}{level distance}{\setlength\tikzleveldistance{#1}} +\define@key{tikz}{sibling distance}{\setlength\tikzsiblingdistance{#1}} + +\define@key{tikz}{growth function}{\let\tikz@grow=#1} +\define@key{tikz}{grow}{\tikz@set@growth{#1}\edef\tikz@special@level{\the\tikztreelevel}}% +\define@key{tikz}{grow'}{\tikz@set@growth{#1}\tikz@swap@growth\edef\tikz@special@level{\the\tikztreelevel}}% + + +\def\tikz@special@level{-1}% never + +\def\tikz@swap@growth{% + % Swap left and right + \let\tikz@temp=\tikz@angle@grow@right% + \let\tikz@angle@grow@right=\tikz@angle@grow@left% + \let\tikz@angle@grow@left=\tikz@temp% +}% + +\def\tikz@set@growth#1{% + \let\tikz@grow=\tikz@grow@direction% + \expandafter\ifx\csname tikz@grow@direction@#1\endcsname\relax% + \c@pgf@counta=#1\relax% + \else% + \c@pgf@counta=\csname tikz@grow@direction@#1\endcsname% + \fi% + \edef\tikz@angle@grow{\the\c@pgf@counta}% + \advance\c@pgf@counta by-90\relax% + \edef\tikz@angle@grow@left{\the\c@pgf@counta}% + \advance\c@pgf@counta by180\relax% + \edef\tikz@angle@grow@right{\the\c@pgf@counta}% +} + +\def\tikz@border@text{.border} +\let\tikzparentanchor=\@empty +\let\tikzchildanchor=\@empty +\def\tikz@edge@to@parent@path{(\tikzparentnode\tikzparentanchor) -- (\tikzchildnode\tikzchildanchor)} + +\tikzleveldistance=15mm +\tikzsiblingdistance=15mm + +\def\tikz@grow@direction@down{-90} +\def\tikz@grow@direction@up{90} +\def\tikz@grow@direction@left{180} +\def\tikz@grow@direction@right{0} + +\def\tikz@grow@direction@south{-90} +\def\tikz@grow@direction@north{90} +\def\tikz@grow@direction@west{180} +\def\tikz@grow@direction@east{0} + +\expandafter\def\csname tikz@grow@direction@north east\endcsname{45} +\expandafter\def\csname tikz@grow@direction@north west\endcsname{135} +\expandafter\def\csname tikz@grow@direction@south east\endcsname{-45} +\expandafter\def\csname tikz@grow@direction@south west\endcsname{-135} + +\def\tikz@grow@direction{% + \pgftransformshift{\pgfpointpolar{\tikz@angle@grow}{\tikzleveldistance}}% + \ifnum\tikztreelevel=\tikz@special@level% + \else% + \pgf@xc=.5\tikzsiblingdistance% + \c@pgf@counta=\tikznumberofchildren% + \advance\c@pgf@counta by1\relax% + \@tempdima=\c@pgf@counta\pgf@xc% + \pgftransformshift{\pgfpointpolar{\tikz@angle@grow@left}{\@tempdima}}% + \pgftransformshift{\pgfpointpolar{\tikz@angle@grow@right}{\tikznumberofcurrentchild\tikzsiblingdistance}}% + \fi% +} + +\setkeys{tikz}{grow=down} + + + + +% Snake options +\define@key{tikz}{snake}[]{% + \def\tikz@@snake{#1}% + \ifx\tikz@@snake\@empty% + \tikz@snakedtrue% + \else% + \ifx\tikz@@snake\tikz@nonetext% + \tikz@snakedfalse% + \else% + \tikz@snakedtrue% + \let\tikz@snake=\tikz@@snake% + \fi% + \fi} + +\define@key{tikz}{segment amplitude}{\setlength{\pgfsnakesegmentamplitude}{#1}} +\define@key{tikz}{segment length}{\setlength{\pgfsnakesegmentlength}{#1}} +\define@key{tikz}{segment angle}{\def\pgfsnakesegmentangle{#1}} +\define@key{tikz}{segment aspect}{\def\pgfsnakesegmentaspect{#1}} + +\define@key{tikz}{segment object length}{\def\pgfsnakesegmentobjectlength{#1}} + +\define@key{tikz}{raise snake}{\def\pgf@snake@raise{\pgftransformyshift{#1}}} +\define@key{tikz}{mirror snake}[true]{% + \csname if#1\endcsname + \def\pgf@snake@mirror{\pgftransformyscale{-1}}% + \else% + \let\pgf@snake@mirror=\@empty% + \fi +} + +\define@key{tikz}{gap before snake}{\def\tikz@presnake{{moveto}{#1}}} +\define@key{tikz}{line before snake}{\def\tikz@presnake{{lineto}{#1}}} + +\define@key{tikz}{gap after snake}{\def\tikz@postsnake{{moveto}{#1}}\def\tikz@mainsnakelength{\pgfsnakeremainingdistance-#1}} +\define@key{tikz}{line after snake}{\def\tikz@postsnake{{lineto}{#1}}\def\tikz@mainsnakelength{\pgfsnakeremainingdistance-#1}} + +\define@key{tikz}{gap around snake}{% + \def\tikz@presnake{{moveto}{#1}}% + \def\tikz@postsnake{{moveto}{#1}}% + \def\tikz@mainsnakelength{\pgfsnakeremainingdistance-#1}% +} +\define@key{tikz}{line around snake}{% + \def\tikz@presnake{{lineto}{#1}}% + \def\tikz@postsnake{{lineto}{#1}}% + \def\tikz@mainsnakelength{\pgfsnakeremainingdistance-#1}% +} +\let\pgf@snake@mirror=\@empty +\let\pgf@snake@raise=\@empty + +\pgfsetsnakesegmenttransformation{\pgf@snake@mirror\pgf@snake@raise} + +\def\tikz@snake{zigzag} + +\let\tikz@presnake=\@empty +\let\tikz@postsnake=\@empty +\def\tikz@mainsnakelength{\pgfsnakeremainingdistance} + + + +% Execute option + +\define@key{tikz}{execute at begin picture}{\expandafter\def\expandafter\tikz@atbegin@picture\expandafter{\tikz@atbegin@picture#1}} +\define@key{tikz}{execute at end picture}{\expandafter\def\expandafter\tikz@atend@picture\expandafter{\tikz@atend@picture#1}} +\define@key{tikz}{execute at begin scope}{\expandafter\def\expandafter\tikz@atbegin@scope\expandafter{\tikz@atbegin@scope#1}} +\define@key{tikz}{execute at end scope}{\expandafter\def\expandafter\tikz@atend@scope\expandafter{\tikz@atend@scope#1}} + +\let\tikz@atbegin@picture=\@empty +\let\tikz@atend@picture=\@empty +\let\tikz@atbegin@scope=\@empty +\let\tikz@atend@scope=\@empty + + + + +% Styles +\define@key{tikz}{set style}{\tikzstyle#1} + +% Handled in a special way. +\def\tikzstyle#1=#2[#3]{% #2 is dummy + \in@+{#1}% + \ifin@% + \tikz@style#1{#3}% + \else% + \expandafter\def\csname tikz@st@#1\endcsname{#3}% + \fi} +\def\tikz@style#1+#2{% + \edef\tikz@marshal{\def\expandafter\noexpand\csname tikz@st@#1\endcsname}% + \expandafter\expandafter\expandafter\tikz@marshal\expandafter\expandafter\expandafter{\csname tikz@st@#1\endcsname,#2}} + +\def\iftikzstyleempty#1#2#3{% + \expandafter\ifx\csname tikz@st@#1\endcsname\@empty% + \let\pgf@next=\@firstoftwo% + \else% + \expandafter\ifx\csname tikz@st@#1\endcsname\relax% + \let\pgf@next=\@firstoftwo% + \else + \let\pgf@next=\@secondoftwo% + \fi% + \fi% + \pgf@next{#2}{#3}} + + + +% +% +% Predefined styles +% +% + +\tikzstyle{help lines}= [color=gray,line width=0.2pt] + +\tikzstyle{every picture}= [] +\tikzstyle{every path}= [] +\tikzstyle{every scope}= [] +\tikzstyle{every plot}= [] +\tikzstyle{every node}= [] +\tikzstyle{every child}= [] +\tikzstyle{every child node}= [] + +\tikzstyle{ultra thin}= [line width=0.1pt] +\tikzstyle{very thin}= [line width=0.2pt] +\tikzstyle{thin}= [line width=0.4pt] +\tikzstyle{semithick}= [line width=0.6pt] +\tikzstyle{thick}= [line width=0.8pt] +\tikzstyle{very thick}= [line width=1.2pt] +\tikzstyle{ultra thick}= [line width=1.6pt] + +\tikzstyle{solid}= [dash pattern=] +\tikzstyle{dotted}= [dash pattern=on \pgflinewidth off 2pt] +\tikzstyle{densely dotted}= [dash pattern=on \pgflinewidth off 1pt] +\tikzstyle{loosely dotted}= [dash pattern=on \pgflinewidth off 4pt] +\tikzstyle{dashed}= [dash pattern=on 3pt off 3pt] +\tikzstyle{densely dashed}= [dash pattern=on 3pt off 2pt] +\tikzstyle{loosely dashed}= [dash pattern=on 3pt off 6pt] + +\tikzstyle{transparent}= [opacity=0] +\tikzstyle{ultra nearly transparent}=[opacity=0.05] +\tikzstyle{very nearly transparent}= [opacity=0.1] +\tikzstyle{nearly transparent}= [opacity=0.25] +\tikzstyle{semitransparent}= [opacity=0.5] +\tikzstyle{nearly opaque}= [opacity=0.75] +\tikzstyle{very nearly opaque}= [opacity=0.9] +\tikzstyle{ultra nearly opaque}= [opacity=0.95] +\tikzstyle{opaque}= [opacity=1] + +\tikzstyle{at start}= [pos=0] +\tikzstyle{very near start}= [pos=0.125] +\tikzstyle{near start}= [pos=0.25] +\tikzstyle{midway}= [pos=0.5] +\tikzstyle{near end}= [pos=0.75] +\tikzstyle{very near end}= [pos=0.875] +\tikzstyle{at end}= [pos=1] + +\tikzstyle{bend at start}= [bend pos=0,bend={+(0,0)}] +\tikzstyle{bend at end}= [bend pos=1,bend={+(0,0)}] + +\tikzstyle{edge from parent}= [draw] + +\tikzstyle{snake triangles 45}= [snake=triangles,segment object length=2.41421356\pgfsnakesegmentamplitude] +\tikzstyle{snake triangles 60}= [snake=triangles,segment object length=1.73205081\pgfsnakesegmentamplitude] +\tikzstyle{snake triangles 90}= [snake=triangles,segment object length=\pgfsnakesegmentamplitude] + + +% +% Setting keys +% + +\let\tikz@late@keys=\@empty% + +\def\tikz@set@one@key#1{% + \setkeys*{tikz}{#1}% + \ifx\XKV@rm\@empty% + % fine + \else% + \expandafter\in@\expandafter!\expandafter{\XKV@rm}% + \ifin@% + % this is a color! + \expandafter\tikz@addoption\expandafter{\expandafter\color\expandafter{\XKV@rm}}% + \edef\tikz@textcolor{\XKV@rm}% + \else% + \expandafter\ifx\csname\string\color@\XKV@rm\endcsname\relax% + % Ok, second chance: This might be an arrow specification: + \expandafter\in@\expandafter-\expandafter{\XKV@rm} + \ifin@% + % Ah, an arrow spec! + \expandafter\tikz@processarrows\expandafter{\XKV@rm}% + \else% + % Ok, third chance: A shape! + \expandafter\ifx\csname pgf@sh@s@\XKV@rm\endcsname\relax% + \PackageError{tikz}{I do not know what to do with the option ``\XKV@rm''}{} + \else% + \edef\tikz@shape{\XKV@rm}% + \fi% + \fi% + \else% + \expandafter\tikz@addoption\expandafter{\expandafter\color\expandafter{\XKV@rm}}% + \edef\tikz@textcolor{\XKV@rm}% + \fi% + \fi% + \fi% +} + +\def\tikz@setkeys#1{\tikz@@setkeys#1,\pgf@stop} + +\def\tikz@@setkeys#1,#2\pgf@stop{% + \def\tikz@key@test{#1}% + \def\tikz@key@rest{#2}% + \ifx\tikz@key@test\@empty% + \else% + \@ifnextchar s{\tikz@parse@key}{\tikz@parse@key}#1==\pgf@stop% + \fi% + \ifx\tikz@key@rest\@empty% + \else% + \expandafter\expandafter\expandafter\tikz@@setkeys\expandafter\tikz@key@rest\expandafter\pgf@stop% + \fi% +} + +\def\tikz@style@text{style} + +\def\tikz@parse@key#1=#2=#3\pgf@stop{ + \def\tikz@key@test{#1}% + \ifx\tikz@key@test\tikz@style@text% + % Ok, style! + \@ifundefined{tikz@st@#2}% + {\PackageError{tikz}{Unknown style ``#2}''{}} + {% + \expandafter\let\expandafter\tikz@temp\expandafter=\csname tikz@st@#2\endcsname% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter\tikz@key@rest + \expandafter\expandafter\expandafter{\expandafter\tikz@temp\expandafter,\tikz@key@rest}% + }% + \else% + \expandafter\ifx\csname tikz@st@#1\endcsname\relax% + % Ok, normal! + \def\tikz@test{#3}% + \ifx\tikz@test\@empty% + \tikz@set@one@key{#1}% + \else% + \tikz@set@one@key{#1={#2}}% + \fi% + \else% + % Ok, style! + \expandafter\let\expandafter\tikz@temp\expandafter=\csname tikz@st@#1\endcsname% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter\tikz@key@rest + \expandafter\expandafter\expandafter{\expandafter\tikz@temp\expandafter,\tikz@key@rest}% + \fi% + \fi% +} + +\def\tikz@every@style#1{% + \expandafter\ifx\csname tikz@st@#1\endcsname\relax% + \else% + \expandafter\expandafter\expandafter\tikz@setkeys + \expandafter\expandafter\expandafter{\csname tikz@st@#1\endcsname}% + \fi% +} + + + + + +% +% Main TikZ Environment +% + +\def\tikzpicture{\@ifnextchar[\tikz@picture{\tikz@picture[]}}%} +\def\tikz@picture[#1]{% + \pgfpicture% + \let\tikz@atbegin@picture=\@empty% + \let\tikz@atend@picture=\@empty% + \tikz@installcommands\scope[style=every picture,#1]% + \tikz@atbegin@picture% +} +\def\endtikzpicture{% + \tikz@atend@picture% + \global\let\pgf@shift@baseline=\pgf@baseline% + \endscope% + \let\pgf@baseline=\pgf@shift@baseline% + \endpgfpicture} + + + +% Inlined picture +% +% #1 - some code to be put in a tikzpicture environment. +% +% If the command is not followed by braces, everything up to the next +% semicolon is used as argument. +% +% Example: +% +% The rectangle \tikz{\draw (0,0) rectangle (1em,1ex)} has width 1em and +% height 1ex. + +\def\tikz{\@ifnextchar[{\tikz@opt}{\tikz@opt[]}} +\def\tikz@opt[#1]{\@ifnextchar\bgroup{\tikz@[#1]}{\tikz@@[#1]}} +\def\tikz@[#1]#2{\tikzpicture[#1]#2\endtikzpicture} +\def\tikz@@{% + \let\tikz@next=\tikz@collectnormalsemicolon% + \ifnum\the\catcode`\;=\active\relax% + \let\tikz@next=\tikz@collectactivesemicolon% + \fi% + \tikz@next} +\def\tikz@collectnormalsemicolon[#1]#2;{\tikzpicture[#1]#2;\endtikzpicture} +{ + \catcode`\;=\active + \gdef\tikz@collectactivesemicolon[#1]#2;{\tikzpicture[#1]#2;\endtikzpicture} +} + + + +% +% Environment for scoping graphic state settings +% +\def\tikz@scope@env{\@ifnextchar[\tikz@@scope@env{\tikz@@scope@env[]}} +\def\tikz@@scope@env[#1]{% + \pgfscope% + \begingroup% + \let\tikz@atbegin@scope=\@empty% + \let\tikz@atend@scope=\@empty% + \let\tikz@options=\@empty% + \let\tikz@mode=\@empty% + \tikz@every@style{every scope}% + \tikz@setkeys{#1}% + \tikz@options% + \tikz@atbegin@scope% +} +\def\endtikz@scope@env{% + \tikz@atend@scope% + \endgroup% + \endpgfscope% +} + + +% +% Install the abbreviated commands +% +\def\tikz@installcommands{% + \ifnum\the\catcode`\;=\active\relax\expandafter\let\expandafter\tikz@origsemi\expandafter=\tikz@activesemicolon\fi% + \ifnum\the\catcode`\:=\active\relax\expandafter\let\expandafter\tikz@origcolon\expandafter=\tikz@activecolon\fi% + \ifnum\the\catcode`\|=\active\relax\expandafter\let\expandafter\tikz@origbar\expandafter=\tikz@activebar\fi% + \let\tikz@origscope=\scope% + \let\tikz@origendscope=\endscope% + \let\tikz@origpath=\path% + \let\tikz@origagainpath=\againpath% + \let\tikz@origdraw=\draw% + \let\tikz@origfill=\fill% + \let\tikz@origfilldraw=\filldraw% + \let\tikz@origshade=\shade% + \let\tikz@origshadedraw=\shadedraw% + \let\tikz@origclip=\clip% + \let\tikz@origuseasboundingbox=\useasboundingbox% + \let\tikz@orignode=\node% + \let\tikz@orignode=\coordiante% + % + \tikz@deactivatthings% + % + \let\scope=\tikz@scope@env% + \let\endscope=\endtikz@scope@env% + \let\path=\tikz@command@path% + \let\againpath=\tikz@command@againpath% + % + \def\draw{\path[draw]} + \def\fill{\path[fill]} + \def\filldraw{\path[fill,draw]} + \def\shade{\path[shade]} + \def\shadedraw{\path[shade,draw]} + \def\clip{\path[clip]} + \def\useasboundingbox{\path[use as bounding box]} + \def\node{\path node} + \def\coordinate{\path coordinate} +} + +\def\tikz@uninstallcommands{% + \ifnum\the\catcode`\;=\active\relax\expandafter\let\tikz@activesemicolon=\tikz@origsemi\fi% + \ifnum\the\catcode`\:=\active\relax\expandafter\let\tikz@activecolon=\tikz@origcolon\fi% + \ifnum\the\catcode`\|=\active\relax\expandafter\let\tikz@activebar=\tikz@origbar\fi% + \let\scope=\tikz@origscope% + \let\endscope=\tikz@origendscope% + \let\path=\tikz@origpath% + \let\againpath=\tikz@origagainpath% + \let\draw=\tikz@origdraw% + \let\fill=\tikz@origfill% + \let\filldraw=\tikz@origfilldraw% + \let\shade=\tikz@origshade% + \let\shadedraw=\tikz@origshadedraw% + \let\clip=\tikz@origclip% + \let\useasboundingbox=\tikz@origuseasboundingbox% + \let\node=\tikz@orignode% +} + + +{ + \catcode`\;=12 + \gdef\tikz@nonactivesemicolon{;} + \catcode`\:=12 + \gdef\tikz@nonactivecolon{:} + \catcode`\|=12 + \gdef\tikz@nonactivebar{|} + \catcode`\;=\active + \catcode`\:=\active + \catcode`\|=\active + \catcode`\"=\active + \gdef\tikz@activesemicolon{;}% + \gdef\tikz@activecolon{:}% + \gdef\tikz@activebar{|}% + \gdef\tikz@activequotes{"}% + \gdef\tikz@deactivatthings{% + \def;{\tikz@nonactivesemicolon} + \def:{\tikz@nonactivecolon} + \def|{\tikz@nonactivebar} + } +} + + + + + +% Constructs a path and draws/fills them according to the current +% settings. + +\def\tikz@command@path{% + \@ifnextchar[{\tikz@check@earg}%] + {\@ifnextchar<{\tikz@doopt}{\tikz@@command@path}}} +\def\tikz@check@earg[#1]{% + \@ifnextchar<{\tikz@swap@args[#1]}{\tikz@@command@path[#1]}} +\def\tikz@swap@args[#1]<#2>{\tikz@command@path<#2>[#1]} + +\def\tikz@doopt{% + \let\tikz@next=\tikz@eargnormalsemicolon% + \ifnum\the\catcode`\;=\active\relax% + \let\tikz@next=\tikz@eargactivesemicolon% + \fi% + \tikz@next} +\long\def\tikz@eargnormalsemicolon<#1>#2;{\only<#1>{\tikz@@command@path#2;}} +{ + \catcode`\;=\active + \long\global\def\tikz@eargactivesemicolon<#1>#2;{\only<#1>{\tikz@@command@path#2;}} +} + +\def\tikz@@command@path{% + \edef\tikzscope@linewidth{\the\pgflinewidth}% + \begingroup% + \let\tikz@options=\@empty% + \let\tikz@mode=\@empty% + \let\tikz@moveto@waiting=\relax% + \let\tikz@timer=\relax% + \let\tikz@collected@onpath=\@empty% + \tikz@snakedfalse% + \tikz@node@is@a@labelfalse% + \tikz@expandcount=1000\relax% + \tikz@lastx=0pt% + \tikz@lasty=0pt% + \tikz@lastxsaved=0pt% + \tikz@lastysaved=0pt% + \tikz@every@style{every path}% + \tikz@scan@next@command% +} +\def\tikz@scan@next@command{% + \ifx\tikz@collected@onpath\@empty% + \else% + \tikz@invoke@collected@onpath% + \fi% + \afterassignment\tikz@handle\let\@let@token=% +} +\newcount\tikz@expandcount + +% Central dispatcher for commands +\def\tikz@handle{% + \let\@next=\tikz@expand% + \ifx\@let@token(%) + \let\@next=\tikz@movetoabs% + \else% + \ifx\@let@token+% + \let\@next=\tikz@movetorel% + \else% + \ifx\@let@token-% + \let\@next=\tikz@lineto% + \else% + \ifx\@let@token.% + \let\@next=\tikz@dot% + \else% + \ifx\@let@token r% + \let\@next=\tikz@rect% + \else% + \ifx\@let@token a% + \let\@next=\tikz@arcA% + \else% + \ifx\@let@token[%] + \let\@next=\tikz@parse@options% + \else% + \ifx\@let@token n% + \let\@next=\tikz@fig% + \else% + \ifx\@let@token\bgroup% + \let\@next=\tikz@beginscope% + \else% + \ifx\@let@token\egroup% + \let\@next=\tikz@endscope% + \else% + \ifx\@let@token;% + \let\@next=\tikz@finish% + \else% + \ifx\@let@token c% + \let\@next=\tikz@cchar% + \else% + \ifx\@let@token e% + \let\@next=\tikz@e@char% + \else% + \ifx\@let@token g% + \let\@next=\tikz@grid% + \else% + \ifx\@let@token s% + \let\@next=\tikz@sine% + \else% + \ifx\@let@token |% + \let\@next=\tikz@vh@lineto% + \else% + \ifx\@let@token p% + \let\@next=\tikz@pchar% + \pgfsetmovetofirstplotpoint% + \else% + \ifx\@let@token\pgfextra% + \let\@next=\tikz@extra% + \else% + \ifx\@let@token\foreach% + \let\@next=\tikz@foreach% + \else% + \ifx\@let@token\pgf@stop% + \let\@next=\relax% + \else% + \ifx\@let@token\par% + \let\@next=\tikz@scan@next@command% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + \@next% +} + +\def\tikz@pchar{\@ifnextchar l{\tikz@plot}{\tikz@parabola}} +\def\tikz@cchar{% + \@ifnextchar i{\tikz@circle}% + {\@ifnextchar h{\tikz@children}{\tikz@cochar}}}% +\def\tikz@cochar o{% + \@ifnextchar o{\tikz@coordinate}{\tikz@cosine}} +\def\tikz@e@char{% + \@ifnextchar l{\tikz@ellipse}{\tikz@edgetoparent}} + + +\def\tikz@finish{% + \tikz@mode@fillfalse% + \tikz@mode@drawfalse% + \tikz@mode@doublefalse% + \tikz@mode@clipfalse% + \tikz@mode@boundaryfalse% + \edef\tikz@pathextend{% + {\noexpand\pgfpoint{\the\pgf@pathminx}{\the\pgf@pathminy}}% + {\noexpand\pgfpoint{\the\pgf@pathmaxx}{\the\pgf@pathmaxy}}% + }% + \tikz@mode% installs the mode settings + % Rendering pipeline: + % + % Step 1: Setup options + % + \ifx\tikz@options\@empty% + \else% + \pgfsys@beginscope% + \begingroup% + \tikz@options% + \fi% + % + % Step 2: Do a fill if shade follows. + % + \iftikz@mode@fill% + \iftikz@mode@shade% + \pgfprocessround{\pgfsyssoftpath@currentpath}{\pgfsyssoftpath@currentpath}% change the current path + \pgfsyssoftpath@invokecurrentpath% + \pgfsys@fill% + \tikz@mode@fillfalse% no more filling... + \fi% + \fi% + % + % Step 3: Do a shade if necessary. + % + \iftikz@mode@shade% + \pgfprocessround{\pgfsyssoftpath@currentpath}{\pgfsyssoftpath@currentpath}% change the current path + \pgfshadepath{\tikz@shading}{\tikz@shade@angle}% + \tikz@mode@shadefalse% no more shading... + \fi% + % + % Step 4: Double stroke, if necessary + % + \iftikz@mode@draw% + \iftikz@mode@double% + % Change line width + \begingroup% + \pgfsys@beginscope% + \pgf@x=2\pgflinewidth% + \advance\pgf@x by\tikz@double@width@distance% + \pgflinewidth=\pgf@x% + \pgfsetlinewidth{\the\pgflinewidth}% + \fi% + \fi% + % + % Step 5: Do stroke/fill/clip as needed + % + \edef\tikz@temp{\noexpand\pgfusepath{% + \iftikz@mode@fill fill,\fi% + \iftikz@mode@draw draw,\fi% + \iftikz@mode@clip clip,\fi% + }}% + \tikz@temp% + \tikz@mode@fillfalse% no more filling + % + % Step 6: Double stroke, if necessary + % + \iftikz@mode@draw% + \iftikz@mode@double% + \pgfsyssoftpath@setcurrentpath\pgf@last@used@path% reinstall + \pgf@x=\tikz@double@width@distance% + \pgfsetlinewidth{\the\pgf@x}% + \pgfsetstrokecolor{\tikz@double@color}% + \pgfsyssoftpath@flushcurrentpath% + \pgfsys@stroke% + \pgfsys@endscope% + \pgf@add@arrows@as@needed + \endgroup% + \fi% + \fi% + \tikz@mode@drawfalse% no more stroking + % + % Step 7: Add labels and nodes + % + \copy\tikz@figbox% + \setbox\tikz@figbox=\box\voidb@x% + % + % Step 8: Close option brace + % + \ifx\tikz@options\@empty% + \else% + \endgroup% + \pgfsys@endscope% + \iftikz@mode@clip% + \PackageError{tikz}{Extra options not allowed for clipping path command.}{}% + \fi% + \fi% + \iftikz@mode@clip% + \aftergroup\pgf@relevantforpicturesizefalse% + \fi% + \iftikz@mode@boundary% + \aftergroup\pgf@relevantforpicturesizefalse% + \fi% + \endgroup% + \global\pgflinewidth=\tikzscope@linewidth% +} + + + + +\def\tikz@skip#1{\tikz@scan@next@command#1} +\def\tikz@expand{% + \advance\tikz@expandcount by -1% + \ifnum\tikz@expandcount<0\relax% + \PackageError{tikz}{Giving up on this path}{}% + \let\@next=\tikz@finish% + \else% + \let\@next=\tikz@@expand + \fi% + \@next} + +\def\tikz@@expand{% + \expandafter\tikz@scan@next@command\@let@token} + + + +% Syntax for scopes: +% {scoped path commands} + +\def\tikz@beginscope{\begingroup\tikz@scan@next@command} +\def\tikz@endscope{% + \global\setbox\tikz@tempbox=\copy\tikz@figbox% + \endgroup% + \setbox\tikz@figbox=\box\tikz@tempbox% + \tikz@scan@next@command} + + +% Syntax for pgfextra: +% \pgfextra {normal tex text} + +\long\def\tikz@extra#1{#1\tikz@scan@next@command} +\def\pgfextra{pgfextra} + + +% Syntax for \foreach: +% \foreach \var in {list} {path text} +% +% Example: +% +% \draw (0,0) \foreach \x in {1,2,3} {-- (\x,0) circle (1cm)} -- (5,5); + +\def\tikz@foreach{% + \def\pgffor@beginhook{\setbox\tikz@figbox=\box\tikz@tempbox\expandafter\tikz@scan@next@command\@firstofone}% + \def\pgffor@endhook{\pgfextra{\global\setbox\tikz@tempbox=\copy\tikz@figbox\@gobble}}% + \def\pgffor@afterhook{\setbox\tikz@figbox=\box\tikz@tempbox\tikz@scan@next@command}% + \global\setbox\tikz@tempbox=\copy\tikz@figbox% + \foreach} + +% Syntax for againpath: +% \againpath \somepathname + +\def\tikz@command@againpath#1{% + \pgfextra{% + \pgfsyssoftpath@getcurrentpath\tikz@temp% + \expandafter\g@addto@macro\expandafter\tikz@temp\expandafter{#1}% + \pgfsyssoftpath@setcurrentpath\tikz@temp% + } +} + + + + +% +% When this if is set, a just-scanned point is a shape and its border +% position still needs to be determined, depending on subsequent +% commands. +% + +\newif\iftikz@shapeborder + + +% Syntax for moveto: +% +\def\tikz@movetoabs{\tikz@moveto(} +\def\tikz@movetorel{\tikz@moveto+} +\def\tikz@moveto{% + \tikz@scan@one@point{\tikz@@moveto}} +\def\tikz@@moveto#1{% + \tikz@make@last@position{#1}% + \iftikz@shapeborder% + % ok, the moveto will have to wait. flag that we have a moveto in + % wainting: + \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% + \else% + \pgfpathmoveto{\tikz@last@position}% + \let\tikz@moveto@waiting=\relax% + \fi% + \tikz@scan@next@command% +} + +\let\tikz@moveto@waiting=\relax % normally, nothing is waiting... + +\def\tikz@flush@moveto{% + \ifx\tikz@moveto@waiting\relax% + \else% + \pgfpathmoveto{\tikz@last@position}% + \fi% + \let\tikz@moveto@waiting=\relax% +} + + +\def\tikz@flush@moveto@toward#1#2#3{% + % #1 = a point towards which the last moveto should be corrected + % #2 = a dimension to which the corrected x-coordinate should be stored + % #3 = a dimension for the corrected y-coordinate + \ifx\tikz@moveto@waiting\relax% + % do nothing + \else% + \pgf@process{\pgfpointshapeborder{\tikz@moveto@waiting}{#1}}% + #2=\pgf@x% + #3=\pgf@y% + \edef\tikz@timer@start{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + \pgfpathmoveto{\pgfpoint{\pgf@x}{\pgf@y}}% + \fi% + \let\tikz@moveto@waiting=\relax% +} + + +% +% Collecting labels on the path +% + +\def\tikz@collect@coordinate@onpath#1coordinate{% + \@ifnextchar[{\tikz@@collect@coordinate@opt#1}{\tikz@@collect@coordinate@opt#1[]}}%} +\def\tikz@@collect@coordinate@opt#1[#2]{% + \@ifnextchar({\tikz@@collect@coordinate#1[#2]}{% + \tikz@collect@label@onpath#1node[shape=coordinate,#2]{}}}%} +\def\tikz@@collect@coordinate#1[#2](#3){% + \tikz@collect@label@onpath#1node[shape=coordinate,#2](#3){}} + +\def\tikz@collect@label@onpath#1node{% + \expandafter\def\expandafter\tikz@collected@onpath\expandafter{\tikz@collected@onpath node}% + \tikz@collect@label@scan#1} + +\def\tikz@collect@label@scan#1{% + \@ifnextchar({\tikz@collect@paran#1}% + {\@ifnextchar[{\tikz@collect@options#1}% + {\@ifnextchar\bgroup{\tikz@collect@arg#1}% + {#1}}}% +}%}} + +\def\tikz@collect@paran#1(#2){% + \expandafter\def\expandafter\tikz@collected@onpath\expandafter{\tikz@collected@onpath(#2)}% + \tikz@collect@label@scan#1% +} +\def\tikz@collect@options#1[#2]{% + \expandafter\def\expandafter\tikz@collected@onpath\expandafter{\tikz@collected@onpath[#2]}% + \tikz@collect@label@scan#1% +} +\def\tikz@collect@arg#1#2{% + \expandafter\def\expandafter\tikz@collected@onpath\expandafter{\tikz@collected@onpath{#2}}% + #1% +} + + +\def\tikz@invoke@collected@onpath{% + \tikz@node@is@a@labeltrue% + \let\tikz@temp=\tikz@collected@onpath% + \let\tikz@collected@onpath=\@empty% + \expandafter\tikz@scan@next@command\tikz@temp\pgf@stop% + \tikz@node@is@a@labelfalse% +} + + + + +% Syntax for lineto: +% -- + +\def\tikz@lineto{% + \@ifnextchar |% + {\expandafter\tikz@hv@lineto\@gobble}% + {\expandafter\@ifnextchar\tikz@activebar{\expandafter\tikz@hv@lineto\@gobble}% + {\expandafter\tikz@lineto@mid\@gobble}}} +\def\tikz@lineto@mid{% + \@ifnextchar n{\tikz@collect@label@onpath\tikz@lineto@mid}% + {% + \@ifnextchar c{\tikz@close}{% + \@ifnextchar p{\pgfsetlinetofirstplotpoint\expandafter\tikz@plot\@gobble}% + {\tikz@scan@one@point{\tikz@@lineto}}}}} +\def\tikz@@lineto#1{% + % Record the starting point for later labels on the path: + \edef\tikz@timer@start{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}} + \iftikz@shapeborder% + % ok, target is a shape. recalculate end + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\tikz@last@position}}% + \tikz@make@last@position{\pgfpoint{\pgf@x}{\pgf@y}}% + \tikz@flush@moveto@toward{\tikz@last@position}\pgf@x\pgf@y% + \tikz@path@lineto{\tikz@last@position}% + \edef\tikz@timer@end{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \tikz@make@last@position{#1}% + \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% + \else% + % target is a reasonable point... + % Record the starting point for later labels on the path: + \tikz@make@last@position{#1}% + \tikz@flush@moveto@toward{\tikz@last@position}\pgf@x\pgf@y% + \tikz@path@lineto{\tikz@last@position}% + \edef\tikz@timer@end{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi% + \let\tikz@timer=\tikz@timer@line% + \tikz@scan@next@command% +} + +% snake or lineto? +\def\tikz@path@lineto#1{% + \iftikz@snaked% + \pgfpathsnakesto{\tikz@presnake,{\tikz@snake}{\tikz@mainsnakelength},\tikz@postsnake}{#1}% + \else% + \pgfpathlineto{#1}% + \fi% +} + + +% Syntax for lineto horizontal/vertical: +% -| + +\def\tikz@hv@lineto{% + \@ifnextchar n + {\tikz@collect@label@onpath\tikz@hv@lineto} + {\@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@hv@lineto}% + {\tikz@scan@one@point{\tikz@@hv@lineto}}}} +\def\tikz@@hv@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@yc=\tikz@lasty% + \tikz@make@last@position{#1}% + \tikz@flush@moveto@toward{\pgfpoint{\tikz@lastx}{\pgf@yc}}\pgf@x\pgf@yc% + \iftikz@shapeborder% + % ok, target is a shape. have to work now: + {% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfpoint{\tikz@lastx}{\pgf@yc}}}% + \tikz@make@last@position{\pgfpoint{\pgf@x}{\pgf@y}}% + \tikz@path@lineto{\pgfpoint{\tikz@lastx}{\pgf@yc}}% + \tikz@path@lineto{\tikz@last@position}% + \xdef\tikz@timer@end@temp{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% move out of group + }% + \let\tikz@timer@end=\tikz@timer@end@temp% + \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% + \else% + \tikz@path@lineto{\pgfpoint{\tikz@lastx}{\pgf@yc}}% + \tikz@path@lineto{\tikz@last@position}% + \edef\tikz@timer@end{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% move out of group + \fi% + \let\tikz@timer=\tikz@timer@hvline% + \tikz@scan@next@command% +} + +% Syntax for lineto vertical/horizontal: +% |- + +\def\tikz@vh@lineto-{\tikz@vh@lineto@next} +\def\tikz@vh@lineto@next{% + \@ifnextchar n + {\tikz@collect@label@onpath\tikz@vh@lineto@next} + {\@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@vh@lineto@next}% + {\tikz@scan@one@point\tikz@@vh@lineto}}} +\def\tikz@@vh@lineto#1{% + \edef\tikz@timer@start{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgf@xc=\tikz@lastx% + \tikz@make@last@position{#1}% + \tikz@flush@moveto@toward{\pgfpoint{\pgf@xc}{\tikz@lasty}}\pgf@xc\pgf@y% + \iftikz@shapeborder% + % ok, target is a shape. have to work now: + {% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\pgfpoint{\pgf@xc}{\tikz@lasty}}}% + \tikz@make@last@position{\pgfpoint{\pgf@x}{\pgf@y}}% + \tikz@path@lineto{\pgfpoint{\pgf@xc}{\tikz@lasty}}% + \tikz@path@lineto{\tikz@last@position}% + \xdef\tikz@timer@end@temp{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% move out of group + }% + \let\tikz@timer@end=\tikz@timer@end@temp% + \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% + \else% + \tikz@path@lineto{\pgfpoint{\pgf@xc}{\tikz@lasty}}% + \tikz@path@lineto{\tikz@last@position}% + \edef\tikz@timer@end{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \fi% + \let\tikz@timer=\tikz@timer@vhline% + \tikz@scan@next@command% +} + +% Syntax for cycle: +% -- cycle +\def\tikz@close c{% + \@ifnextchar o{\tikz@collect@coordinate@onpath\tikz@lineto@mid c}% oops, a coordinate + {\tikz@@close c}}% +\def\tikz@@close cycle{% + \tikz@flush@moveto% + \pgfpathclose% + \def\pgfstrokehook{}% + \let\tikz@timer=\@undefined% + \tikz@scan@next@command% +} + + +% Syntax for options: +% [options] +\def\tikz@parse@options#1]{% + \tikz@setkeys{#1}% + \tikz@scan@next@command% +} + + + +% Syntax for edge from parent: +% edge from parent [options] +\def\tikz@edgetoparent dge from parent{\@ifnextchar[\tikz@@edgetoparent{\tikz@@edgetoparent[]}}%} +\def\tikz@@edgetoparent[#1]{% + \let\tikz@edge@to@parent@needed=\@empty% + \tikz@node@is@a@labeltrue% + \tikz@scan@next@command [style=edge from parent,#1] \tikz@edge@to@parent@path% +} + + +% Syntax for bezier curves +% .. controls(point) and (point) .. (target) +% .. controls(point) .. (target) +% .. (target) % currently not supported + +\def\tikz@dot.{\tikz@@dot}% +\def\tikz@@dot{% + \@ifnextchar n% + {\tikz@collect@label@onpath\tikz@@dot}% + {\@ifnextchar c{\tikz@curveto@double}{\tikz@curveto@auto}}} + +\def\tikz@curveto@double co{% + \@ifnextchar o{\tikz@collect@coordinate@onpath\tikz@@dot co} + {\tikz@cureveto@@double}} +\def\tikz@cureveto@@double ntrols#1{% + \tikz@scan@one@point\tikz@curveA#1% +} +\def\tikz@curveA#1{% + \edef\tikz@timer@start{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + {% + \tikz@make@last@position{#1}% + \xdef\tikz@curve@first{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + }% + \@ifnextchar a + {\tikz@curveBand}% + {\let\tikz@curve@second\tikz@curve@first\tikz@curveCdots}% +} +\def\tikz@curveBand and{% + \tikz@scan@one@point\tikz@curveB% +} +\def\tikz@curveB#1{% + \def\tikz@curve@second{#1}% + \tikz@curveCdots} +\def\tikz@curveCdots{% + \afterassignment\tikz@curveCdot\let\@next=} +\def\tikz@curveCdot.{% + \ifx\@next.% + \else% + \PackageError{tikz}{Dot expected}{}% + \fi% + \tikz@updatecurrenttrue% + \tikz@curveCcheck% +} +\def\tikz@curveCcheck{% + \@ifnextchar n% + {\tikz@collect@label@onpath\tikz@curveCcheck} + {\@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@curveCcheck} + {\tikz@scan@one@point\tikz@curveC}}% +} +\def\tikz@curveC#1{% + \tikz@make@last@position{#1}% + \edef\tikz@curve@third{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + {% + \tikz@lastxsaved=\tikz@lastx% + \tikz@lastysaved=\tikz@lasty% + \tikz@make@last@position{\tikz@curve@second}% + \xdef\tikz@curve@second{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + }% + % + % Start recalculating things in case start and end are shapes. + % + % First, the start: + \ifx\tikz@moveto@waiting\relax% + \else% + \pgf@process{\pgfpointshapeborder{\tikz@moveto@waiting}{\tikz@curve@first}}% + \edef\tikz@timer@start{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + \pgfpathmoveto{\pgfpoint{\pgf@x}{\pgf@y}}% + \fi% + \let\tikz@timer@cont@one=\tikz@curve@first% + \let\tikz@timer@cont@two=\tikz@curve@second% + % Second, the end: + \iftikz@shapeborder% + % ok, target is a shape. recalculate third + {% + \pgf@process{\pgfpointshapeborder{\tikz@shapeborder@name}{\tikz@curve@second}}% + \tikz@make@last@position{\pgfpoint{\pgf@x}{\pgf@y}}% + \edef\tikz@curve@third{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \pgfpathcurveto{\tikz@curve@first}{\tikz@curve@second}{\tikz@curve@third}% + \global\let\tikz@timer@end@temp=\tikz@curve@third% move out of group + }% + \let\tikz@timer@end=\tikz@timer@end@temp% + \edef\tikz@moveto@waiting{\tikz@shapeborder@name}% + \else% + \pgfpathcurveto{\tikz@curve@first}{\tikz@curve@second}{\tikz@curve@third}% + \let\tikz@timer@end=\tikz@curve@third + \let\tikz@moveto@waiting=\relax% + \fi% + \let\tikz@timer=\tikz@timer@curve% + \tikz@scan@next@command% +} + + +% Syntax for rectangles: +% rectangle +\def\tikz@rect ectangle{% + \tikz@flush@moveto% + \edef\tikz@timer@start{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \tikz@@rect}% +\def\tikz@@rect{% + \@ifnextchar n + {\tikz@collect@label@onpath\tikz@@rect} + {\@ifnextchar c{\tikz@collect@coordinate@onpath\tikz@@rect}% + { + \pgf@xa=\tikz@lastx\relax% + \pgf@ya=\tikz@lasty\relax% + \tikz@scan@one@point\tikz@rectB}}} +\def\tikz@rectB#1{% + \tikz@make@last@position{#1}% + \edef\tikz@timer@end{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \let\tikz@timer=\tikz@timer@line% + \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}% + \tikz@path@lineto{\pgfpoint{\pgf@xa}{\tikz@lasty}}% + \tikz@path@lineto{\pgfpoint{\tikz@lastx}{\tikz@lasty}}% + \tikz@path@lineto{\pgfpoint{\tikz@lastx}{\pgf@ya}}% + \tikz@path@lineto{\pgfpoint{\pgf@xa}{\pgf@ya}}% + \pgfpathclose% + \pgfpathmoveto{\pgfpoint{\tikz@lastx}{\tikz@lasty}}% + \def\pgfstrokehook{}% + \tikz@scan@next@command% +} + + + +% Syntax for grids: +% grid +\def\tikz@grid rid{% + \tikz@flush@moveto% + \pgf@xa=\tikz@lastx\relax% + \pgf@ya=\tikz@lasty\relax% + \tikz@scan@one@point\tikz@gridB}% +\def\tikz@gridB#1{% + \tikz@make@last@position{#1}% + \pgfpathgrid[stepx=\tikz@grid@x,stepy=\tikz@grid@y]% + {\pgfpoint{\pgf@xa}{\pgf@ya}}{\pgfpoint{\tikz@lastx}{\tikz@lasty}}% + \tikz@scan@next@command% +} + + + +% Syntax for plot: +% plot [local options] ... % starts with a moveto +% -- plot [local options] ... % starts with a lineto +\def\tikz@plot lot{% + \tikz@flush@moveto% + \@ifnextchar[{\tikz@@plot}{\tikz@@plot[]}}%} +\def\tikz@@plot[#1]{% + \begingroup% + \let\tikz@options=\@empty% + \tikz@every@style{every plot}% + \tikz@setkeys{#1}% + \@ifnextchar f{\tikz@plot@f}% + {\@ifnextchar c{\tikz@plot@scan@points}% + {\PackageError{tikz}{Cannot parse this plotting data}{}% + \endgroup}}} +\def\tikz@plot@f f{\@ifnextchar i{\tikz@plot@file}{\tikz@plot@function}} + +\def\tikz@plot@file ile#1{\def\tikz@plot@data{\pgfplotxyfile{#1}}\tikz@@@plot}% +\def\tikz@plot@scan@points coordinates#1{% + \pgfplothandlerrecord\tikz@plot@data% + \pgfplotstreamstart% + \@ifnextchar\pgf@stop{\pgfplotstreamend\expandafter\tikz@@@plot\@gobble} + {\tikz@scan@one@point\tikz@plot@next@point}% + #1\pgf@stop% +} +\def\tikz@plot@next@point#1{% + \pgfplotstreampoint{#1}% + \@ifnextchar\pgf@stop{\pgfplotstreamend\expandafter\tikz@@@plot\@gobble}% + {\tikz@scan@one@point\tikz@plot@next@point}% +} +\def\tikz@plot@function unction#1{% + \def\tikz@plot@filename{\tikz@plot@prefix\tikz@plot@id}% + \iftikz@plot@raw@gnuplot% + \def\tikz@plot@data{\pgfplotgnuplot[\tikz@plot@filename]{#1}}% + \else% + \iftikz@plot@parametric% + \def\tikz@plot@data{\pgfplotgnuplot[\tikz@plot@filename]{% + set samples \tikz@plot@sampels; + set parametric; + plot [t=\tikz@plot@domain] #1}}% + \else% + \def\tikz@plot@data{\pgfplotgnuplot[\tikz@plot@filename]{% + set samples \tikz@plot@sampels; + plot [x=\tikz@plot@domain] #1}}% + \fi% + \fi% + \tikz@@@plot% +} + +\def\tikz@plot@no@resample{% + \IfFileExists{\tikz@plot@filename.table}% + {\def\tikz@plot@data{\pgfplotxyfile{\tikz@plot@filename.table}}}% + {}% +} + + +\def\tikz@@@plot{% + \def\pgfplotlastpoint{\pgfpointorigin}% + \tikz@plot@handler% + \tikz@plot@data% + \global\let\tikz@@@temp=\pgfplotlastpoint% + \ifx\tikz@plot@mark\@empty% + \else% + % Marks are drawn after the path. + \setbox\tikz@figbox=\hbox{% + \unhbox\tikz@figbox% + \hbox{{% + \pgfinterruptpath% + \pgfscope% + \let\tikz@options=\@empty% + \let\tikz@transform=\@empty% + \expandafter\tikz@setkeys\expandafter{\tikz@plot@mark@options}% + \tikz@options% + \pgfplothandlermark{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}% + \tikz@plot@data% + \endpgfscope + \endpgfinterruptpath% + }}% + }% + \fi% + \global\setbox\tikz@tempbox=\copy\tikz@figbox% + \endgroup% + \setbox\tikz@figbox=\box\tikz@tempbox% + \tikz@make@last@position{\tikz@@@temp}% + \tikz@scan@next@command% +} + + +\pgfdeclareplotmark{ball} +{% + \def\tikz@shading{ball}% + \shade (0,0) circle (\pgfplotmarksize);% +} + + + + +% Syntax for cosine curves: +% cos +\def\tikz@cosine s{\tikz@scan@one@point\tikz@@cosine} +\def\tikz@@cosine#1{% + \tikz@flush@moveto% + \pgf@process{#1}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xc by-\tikz@lastx% + \advance\pgf@yc by-\tikz@lasty% + \advance\tikz@lastx by\pgf@xc% + \advance\tikz@lasty by\pgf@yc% + \tikz@lastxsaved=\tikz@lastx% + \tikz@lastysaved=\tikz@lasty% + \tikz@updatecurrenttrue% + \pgfpathcosine{\pgfpoint{\pgf@xc}{\pgf@yc}}% + \tikz@scan@next@command% +} + +% Syntax for sine curves: +% sin +\def\tikz@sine in{\tikz@scan@one@point\tikz@@sine} +\def\tikz@@sine#1{% + \tikz@flush@moveto% + \pgf@process{#1}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xc by-\tikz@lastx% + \advance\pgf@yc by-\tikz@lasty% + \advance\tikz@lastx by\pgf@xc% + \advance\tikz@lasty by\pgf@yc% + \tikz@lastxsaved=\tikz@lastx% + \tikz@lastysaved=\tikz@lasty% + \tikz@updatecurrenttrue% + \pgfpathsine{\pgfpoint{\pgf@xc}{\pgf@yc}}% + \tikz@scan@next@command% +} + +% Syntax for parabolas: +% parabola[options] bend +\def\tikz@parabola arabola{% + \@ifnextchar[{\tikz@parabola@options}{\tikz@parabola@options[]}}%} + +\def\tikz@parabola@options[#1]{% + \def\tikz@parabola@option{#1}% + \@ifnextchar b{\tikz@parabola@scan@bend}{\tikz@scan@one@point\tikz@parabola@semifinal}} +\def\tikz@parabola@scan@bend bend{\tikz@scan@one@point\tikz@parabola@scan@bendB} +\def\tikz@parabola@scan@bendB#1{% + \def\tikz@parabola@bend{#1}% + \tikz@scan@one@point\tikz@parabola@semifinal% +} +\def\tikz@parabola@semifinal#1{% + % Save original start: + \pgf@xb=\tikz@lastx% + \pgf@yb=\tikz@lasty% + \tikz@make@last@position{#1}% + \pgf@xc=\tikz@lastx% + \pgf@yc=\tikz@lasty% + \begingroup% now calculate bend: + \expandafter\tikz@setkeys\expandafter{\tikz@parabola@option}% + \tikz@lastxsaved=\tikz@parabola@bend@factor\tikz@lastx% + \tikz@lastysaved=\tikz@parabola@bend@factor\tikz@lasty% + \advance\tikz@lastxsaved by\pgf@xb% + \advance\tikz@lastysaved by\pgf@yb% + \advance\tikz@lastxsaved by-\tikz@parabola@bend@factor\pgf@xb% + \advance\tikz@lastysaved by-\tikz@parabola@bend@factor\pgf@yb% + \expandafter\tikz@make@last@position\expandafter{\tikz@parabola@bend}% + % Calculate delta from bend + \advance\pgf@xc by-\tikz@lastx% + \advance\pgf@yc by-\tikz@lasty% + % Ok, now calculate delta to bend + \advance\tikz@lastx by-\pgf@xb% + \advance\tikz@lasty by-\pgf@yb% + \xdef\tikz@parabola@b{{\noexpand\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}{\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}}% + \endgroup% + \expandafter\pgfpathparabola\tikz@parabola@b% + \tikz@scan@next@command% +} + + +% Syntax for circles: +% circle (radius) +% +% Syntax for ellipses: +% ellipse (x-radius/y-radius) +\def\tikz@circle ircle{\tikz@@circle} +\def\tikz@ellipse llipse{\tikz@@circle} +\def\tikz@@circle{% + \tikz@flush@moveto% + \@ifnextchar(\tikz@@@circle{%) + \advance\tikz@expandcount by -1% + \ifnum\tikz@expandcount<0\relax% + \let\@next=\tikz@@circle@scangiveup% + \else% + \let\@next=\tikz@@circle@scanexpand% + \fi% + \@next% + }% +} +\def\tikz@@circle@scanexpand{\expandafter\tikz@@circle} +\def\tikz@@circle@scangiveup#1{\PackageError{tikz}{Cannot parse this radius}{}#1{\tikz@scan@next@command}} +\def\tikz@@@circle(#1){% + \in@{ and }{#1}% + \ifin@% + \tikz@@ellipseB(#1)% + \else% + \tikz@@ellipseB(#1 and #1)% + \fi% + \tikz@scan@next@command% +} +\def\tikz@@ellipseB(#1 and #2){% + \pgfpathellipse{\tikz@last@position}{\pgfpoint{#1}{0pt}}{\pgfpoint{0pt}{#2}}% +} + +% Syntax 1 for arcs: +% arc (start angle:end angle:radius) +% +% Syntax 2 for arcs: +% arc (start angle:end angle:x-radius/y-radius) +\def\tikz@arcA rc{% + \tikz@flush@moveto% + \@ifnextchar({\tikz@@arcto}{\expandafter\tikz@arcA\expandafter r\expandafter c}} + +\def\tikz@@arcto(#1){% + \edef\tikz@temp{(#1)}% + \expandafter\tikz@@@arcto@and\tikz@temp% +} + +\def\tikz@@@arcto@and(#1:#2:#3){% + \in@{ and }{#3}% + \ifin@% + \tikz@parse@arc@and(#1:#2:#3)% + \else% + \tikz@@@arcto(#1:#2:#3)% + \fi% +} + +\def\tikz@parse@arc@and(#1:#2:#3 and #4){% + \tikz@@@arcto(#1:#2:#3/#4)% +} + +\def\tikz@@@arcto(#1:#2:#3){% + \pgfpatharc{#1}{#2}{#3}% + \pgf@process{\pgfpointpolar{#1}{#3}}% + \advance\tikz@lastx by-\pgf@x% + \advance\tikz@lasty by-\pgf@y% + \pgf@process{\pgfpointpolar{#2}{#3}}% + \advance\tikz@lastx by\pgf@x% + \advance\tikz@lasty by\pgf@y% + \tikz@lastxsaved=\tikz@lastx% + \tikz@lastysaved=\tikz@lasty% + \tikz@scan@next@command% +} + + +% Syntax for coordinates: +% coordinate (coordinate name) at (point) +% where ``at (point)'' is optional +\def\tikz@coordinate ordinate{% + \@ifnextchar({\tikz@@coordinate} + {\tikz@fig ode[shape=coordinate]{}}}%} +\def\tikz@@coordinate(#1){% + \@ifnextchar a{\tikz@@coordinate@at(#1)} + {\tikz@fig ode[shape=coordinate](#1){}}} +\def\tikz@@coordinate@at(#1)at#2(#3){% + \tikz@fig ode[shape=coordinate](#1)at(#3){}} + + + +% Syntax for nodes: +% node[options] (node name) {label text} +% +% all of [options], (node name) and {label text} are optional. There +% can be multiple options before the label text as in +% node[draw] (a) [rotate=10] {text} +% +% A label text always ``ends'' the node. +\def\tikz@fig ode{% + \begingroup% + \let\tikz@fig@name=\@empty% + \begingroup% + \let\nodepart=\tikz@nodepart% + \let\tikz@options=\@empty% + \let\tikz@transform=\@empty% + \let\tikz@mode=\@empty% + \def\tikz@node@at{\pgfpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + \iftikz@node@is@a@label% + \else% + \let\tikz@time=\@empty% + \fi% + \tikz@every@style{every node}% + \tikz@@scan@fig}% +\def\tikz@@scan@fig{% + \@ifnextchar a{\tikz@fig@scan@at} + {\@ifnextchar({\tikz@fig@scan@name} + {\@ifnextchar[{\tikz@fig@scan@options}% + {\@ifnextchar\bgroup{\tikz@fig@main}% + {\PackageError{tikz}{A node must have a (possibly empty) label text}{}% + \tikz@fig@main{}}}}}}%}} +\def\tikz@fig@scan@at at{% + \tikz@scan@one@point\tikz@@fig@scan@at} +\def\tikz@@fig@scan@at#1{% + \def\tikz@node@at{#1}\tikz@@scan@fig}% +\def\tikz@fig@scan@name(#1){\edef\tikz@fig@name{#1}\tikz@@scan@fig}% +\def\tikz@fig@scan@options[#1]{\tikz@setkeys{#1}\tikz@@scan@fig}% +\def\tikz@fig@main{\afterassignment\tikz@@fig@main\let\next=} +\def\tikz@@fig@main{% + \@ifundefined{pgf@sh@s@\tikz@shape}% + {\PackageError{tikz}% + {Unknown shape ``\tikz@shape.'' Using ``rectangle'' instead}{}% + \def\tikz@shape{rectangle}}% + {}% + \tikz@every@style{every \tikz@shape\space node}% + \setbox\pgfnodeparttextbox=\hbox% + \bgroup% + \tikz@every@style{every text node part}% + \pgfinterruptpicture% + \ifx\tikz@text@width\@empty% + \else% + \begingroup% + \minipage[t]{\tikz@text@width}% + \tikz@text@action% + \fi% + \bgroup% + \aftergroup\unskip% + \ifx\tikz@textcolor\@empty% + \color{.}% + \else% + \color{\tikz@textcolor}% + \fi% + \tikz@textfont% + \setbox\tikz@figbox=\box\voidb@x% + \tikz@uninstallcommands% + \aftergroup\tikz@fig@collectresetcolor% + \ignorespaces% +} +\def\tikz@fig@collectresetcolor{% + \@ifnextchar\reset@color% + {\reset@color\afterassignment\tikz@fig@collectresetcolor\let\tikz@temp=}% + {\tikz@fig@boxdone}% +} +\def\tikz@fig@boxdone{% + \ifx\tikz@text@width\@empty% + \else% + \endminipage% + \endgroup% + \fi% + \endpgfinterruptpicture% + \egroup% + \@ifnextchar c{\tikz@fig@withchildren}{\@ifnextchar[{\tikz@fig@withchildren}{\tikz@fig@continue}}}%} +\def\tikz@fig@withchildren{% + \ifx\tikz@fig@name\@empty% + % Assign a dummy name + \global\advance\tikz@fig@count by1\relax + \edef\tikz@fig@name{tikz@f@\the\tikz@fig@count}% + \fi% + \tikz@fig@continue% +} +\def\tikz@fig@continue{% + \ifx\tikz@text@width\@empty% + \else% + \setlength{\pgf@x}{\tikz@text@width}% + \wd\pgfnodeparttextbox=\pgf@x% + \fi% + % Possibly, we are ``online'' + \ifx\tikz@time\@empty% + \pgftransformshift{\tikz@node@at}% + \iftikz@fullytransformed% + \else% + \pgftransformresetnontranslations + \fi% + \else% + \tikz@timer% + \fi% + % Invoke local transformations + \tikz@transform% + \setbox\tikz@figbox=\hbox{% + \setbox\@tempboxa=\copy\tikz@figbox% + \unhbox\@tempboxa% + \hbox{{% + \pgfinterruptpath% + \pgfscope% + \tikz@options% + \setbox\tikz@figbox=\box\voidb@x% + \pgfmultipartnode{\tikz@shape}{\tikz@anchor}{\tikz@fig@name}{% + \@tempdima=\pgflinewidth% + {\begingroup\tikz@finish}% + \global\pgflinewidth=\@tempdima% + }% + \endpgfscope + \endpgfinterruptpath% + }}% + }% + % shift box outside group + \global\setbox\tikz@tempbox=\copy\tikz@figbox% + \global\let\tikz@last@fig@name=\tikz@fig@name% + \endgroup\endgroup% + \setbox\tikz@figbox=\box\tikz@tempbox% + \tikz@scan@next@command% +} +\let\tikz@fig@continue@orig=\tikz@fig@continue + + +% Syntax for parts of nodes: +% node ... {... \nodepart{name} ... \nodepart{name} ...} + +\def\tikz@nodepart#1{% + \unskip% + \gdef\tikz@nodepart@name{#1}% + \global\let\tikz@fig@continue=\tikz@nodepart@continue% + \@ifnextchar x{\egroup\relax}{\egroup\relax}% gobble spaces +} +\def\tikz@nodepart@continue{% + \global\let\tikz@fig@continue=\tikz@fig@continue@orig% + % Now start new box: + \expandafter\setbox\csname pgfnodepart\tikz@nodepart@name box\endcsname=\hbox% + \bgroup% + \tikz@every@style{every \tikz@nodepart@name\space node part}% + \pgfinterruptpicture% + \ifx\tikz@text@width\@empty% + \else% + \begingroup% + \minipage[t]{\tikz@text@width}% + \tikz@text@action% + \fi% + \bgroup% + \aftergroup\unskip% + \ifx\tikz@textcolor\@empty% + \color{.}% + \else% + \color{\tikz@textcolor}% + \fi% + \tikz@textfont% + \setbox\tikz@figbox=\box\voidb@x% + \tikz@uninstallcommands% + \aftergroup\tikz@fig@collectresetcolor% + \ignorespaces% +} + + + +% Syntax for trees: +% node {...} child [options] {...} child [options] {...} ... +% node {...} children [options] \var in {list} [options] {...} ... + +\def\tikz@children{% + % Start collecting the children: + \let\tikz@children@list=\@empty% + \tikznumberofchildren=0\relax% + \tikz@collect@children c} + +\def\tikz@collect@children{\@ifnextchar c{\tikz@collect@children@cchar}{\tikz@children@collected}} +\def\tikz@collect@children@cchar c{\@ifnextchar h{\tikz@collect@child}{\tikz@children@collected c}} +\def\tikz@collect@child hild{\@ifnextchar[{\tikz@collect@childA}{\tikz@collect@childA[]}}%} +\def\tikz@collect@childA[#1]{\@ifnextchar f{\tikz@collect@children@foreach[#1]}{\tikz@collect@childB[#1]}} +\def\tikz@collect@childB[#1]{% + \advance\tikznumberofchildren by1\relax + \expandafter\def\expandafter\tikz@children@list\expandafter{\tikz@children@list \tikz@childnode[#1]}% + \@ifnextchar\bgroup{\tikz@collect@child@code}{\tikz@collect@child@code{}}} +\def\tikz@collect@child@code#1{% + \expandafter\def\expandafter\tikz@children@list\expandafter{\tikz@children@list{#1}}% + \tikz@collect@children% +} +\def\tikz@collect@children@foreach[#1]foreach#2in#3{% + \@ifnextchar\bgroup{\tikz@collect@children@foreachA{#1}{#2}{#3}}{\tikz@collect@children@foreachA{#1}{#2}{#3}{}}} +\def\tikz@collect@children@foreachA#1#2#3#4{% + \expandafter\def\expandafter\tikz@children@list\expandafter + {\tikz@children@list\tikz@childrennodes[#1]{#2}{#3}{#4}}% + \c@pgf@counta=\tikznumberofchildren% + \foreach#2in{#3}% + {% + \global\advance\c@pgf@counta by1\relax% + }% + \tikznumberofchildren=\c@pgf@counta% + \tikz@collect@children% +} +\long\def\tikz@children@collected{% + \begingroup% + \advance\tikztreelevel by 1\relax% + \let\tikz@options=\@empty% + \let\tikz@transform=\@empty% + \tikz@every@style{level \the\tikztreelevel}% + \tikz@options% + \tikz@transform% + \let\tikzparentnode=\tikz@last@fig@name% + % Transform to center of node + \pgftransformshift{\pgfpointanchor{\tikzparentnode}{center}}% + \tikznumberofcurrentchild=0\relax% + \tikz@children@list% + \global\setbox\tikz@tempbox=\copy\tikz@figbox% + \endgroup% + \setbox\tikz@figbox=\box\tikz@tempbox% + \tikz@scan@next@command% +} + + +% Syntax for children: +% +% children [all children options] \var in {values} [child options] {...} +\def\tikz@childrennodes[#1]#2#3#4{% + \c@pgf@counta=\tikznumberofcurrentchild\relax% + \setbox\tikz@tempbox=\box\tikz@figbox% + \foreach#2in{#3}{% + \tikznumberofcurrentchild=\c@pgf@counta\relax% + \setbox\tikz@figbox=\box\tikz@tempbox% + \tikz@childnode[#1]{#4}% + % we must now make the current child number and the figbox survive + % the group + \global\c@pgf@counta=\tikznumberofcurrentchild\relax% + \global\setbox\tikz@tempbox=\box\tikz@figbox% + }% + \tikznumberofcurrentchild=\c@pgf@counta\relax% + \setbox\tikz@figbox=\box\tikz@tempbox% +} + + +% Syntax for child: +% +% child +% +% child[options] +% +% child[options] {node (name) {child node text} ... +% edge from parent[options] node {label text} node {label text}} + +\def\tikz@childnode[#1]#2{% + \advance\tikznumberofcurrentchild by1\relax% + \setbox\tikz@figbox=\hbox\bgroup% + \unhbox\tikz@figbox% + \hbox\bgroup\bgroup% + \pgfinterruptpath% + \pgfscope% + \let\tikz@options=\@empty% + \let\tikz@transform=\@empty% + \tikz@every@style{every child}% + \tikz@setkeys{#1}% + \tikz@options% + \tikz@transform% + \tikz@grow% + % Typeset node: + \edef\tikz@parent@node@name{[name=\tikzparentnode-\the\tikznumberofcurrentchild,style=every child node]}% + \def\tikz@child@node@text{[shape=coordinate]{}} + \tikz@parse@child@node#2\pgf@stop% + \expandafter\expandafter\expandafter\node + \expandafter\tikz@parent@node@name + \tikz@child@node@text + \pgfextra{\global\let\tikz@childnode@name=\tikz@last@fig@name};% + \let\tikzchildnode=\tikz@childnode@name% + {% + \def\tikz@edge@to@parent@needed{edge from parent} + \ifx\tikz@child@node@rest\@empty% + \path edge from parent;% + \else% + \path (0,0) \tikz@child@node@rest \tikz@edge@to@parent@needed;% + \fi% + }% + \endpgfscope% + \endpgfinterruptpath% + \egroup\egroup% + \egroup% +} + +\def\tikz@parse@child@node{% + \@ifnextchar n{\tikz@parse@child@node@n}% + {\@ifnextchar c{\tikz@parse@child@node@c}% + {\tikz@parse@child@node@rest}}} +\def\tikz@parse@child@node@rest#1\pgf@stop{\def\tikz@child@node@rest{#1}} +\def\tikz@parse@child@node@c c{\@ifnextchar o{\tikz@parse@child@node@co}{\tikz@parse@child@node@rest c}} +\def\tikz@parse@child@node@co o{\@ifnextchar o{\tikz@parse@child@node@coordinate}{\tikz@parse@child@node@rest co}} +\def\tikz@parse@child@node@coordinate ordinate{% + \@ifnextchar ({\tikz@@parse@child@node@coordinate}{% + \def\tikz@child@node@text{[shape=coordinate]{}}% + \tikz@parse@child@node@rest}}%} +\def\tikz@@parse@child@node@coordinate(#1){% + \@ifnextchar a{\tikz@p@c@n@c@at(#1)}{% + \def\tikz@child@node@text{[shape=coordinate,name=#1]{}}% + \tikz@parse@child@node@rest}} +\def\tikz@p@c@n@c@at(#1)at#2(#3){% + \def\tikz@child@node@text{[shape=coordinate,name=#1]at(#3){}}% + \tikz@parse@child@node@rest}% +\def\tikz@parse@child@node@n node{% + \let\tikz@child@node@text=\@empty% + \tikz@p@c@s}% +\def\tikz@p@c@s{% + \@ifnextchar a{\tikz@p@c@s@at} + {\@ifnextchar ({\tikz@p@c@s@paran} + {\@ifnextchar [{\tikz@p@c@s@bra} + {\@ifnextchar \bgroup{\tikz@p@c@s@group} + {\PackageError{tikz}{Cannot parse this node}{}}}}}}%}} +\def\tikz@p@c@s@at at#1(#2){% + \expandafter\def\expandafter\tikz@child@node@text\expandafter{\tikz@child@node@text at(#2)} + \tikz@p@c@s} +\def\tikz@p@c@s@paran(#1){% + \expandafter\def\expandafter\tikz@child@node@text\expandafter{\tikz@child@node@text(#1)} + \tikz@p@c@s} +\def\tikz@p@c@s@bra[#1]{% + \expandafter\def\expandafter\tikz@child@node@text\expandafter{\tikz@child@node@text[#1]} + \tikz@p@c@s} +\def\tikz@p@c@s@group#1{% + \expandafter\def\expandafter\tikz@child@node@text\expandafter{\tikz@child@node@text{#1}} + \tikz@parse@child@node@rest} + + +% +% Timers +% + +\def\tikz@timer@line{% + \pgftransformlineattime{\tikz@time}{\tikz@timer@start}{\tikz@timer@end}% +} + +\def\tikz@timer@vhline{% + \ifdim\tikz@time pt<0.5pt% first half + \pgf@process{\tikz@timer@start}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\tikz@timer@end}% + \pgf@xb=\tikz@time pt% + \pgf@xb=2\pgf@xb% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% + \noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@y}}}% + \tikz@marshal% + \else% second half + \pgf@process{\tikz@timer@start}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\tikz@timer@end}% + \pgf@xb=\tikz@time pt% + \pgf@xb=2\pgf@xb% + \advance\pgf@xb by-1pt% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@y}}{\noexpand\tikz@timer@end}}% + \tikz@marshal% + \fi% +} + +\def\tikz@timer@hvline{% + \ifdim\tikz@time pt<0.5pt% first half + \pgf@process{\tikz@timer@start}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\tikz@timer@end}% + \pgf@xb=\tikz@time pt% + \pgf@xb=2\pgf@xb% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}{\noexpand\tikz@timer@start}{% + \noexpand\pgfpoint{\the\pgf@x}{\the\pgf@ya}}}% + \tikz@marshal% + \else% second half + \pgf@process{\tikz@timer@start}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\tikz@timer@end}% + \pgf@xb=\tikz@time pt% + \pgf@xb=2\pgf@xb% + \advance\pgf@xb by-1pt% + \edef\tikz@marshal{\noexpand\pgftransformlineattime{\pgf@sys@tonumber{\pgf@xb}}% + {\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@ya}}{\noexpand\tikz@timer@end}}% + \tikz@marshal% + \fi% +} + +\def\tikz@timer@curve{% + \pgftransformcurveattime{\tikz@time}{\tikz@timer@start}{\tikz@timer@cont@one}{\tikz@timer@cont@two}{\tikz@timer@end}% +} + + + + +% +% Coordinate management +% + + +% Last position visited +\def\tikz@last@position{\pgfpoint{\tikz@lastx}{\tikz@lasty}} +\def\tikz@last@position@saved{\pgfpoint{\tikz@lastxsaved}{\tikz@lastysaved}} + +% Make given point the last position visited +\def\tikz@make@last@position#1{% + \pgf@process{#1}% + \tikz@lastx=\pgf@x\relax% + \tikz@lasty=\pgf@y\relax% + \iftikz@updatecurrent% + \tikz@lastxsaved=\pgf@x\relax% + \tikz@lastysaved=\pgf@y\relax% + \fi% + \tikz@updatecurrenttrue% +} + +\newif\iftikz@updatecurrent +\tikz@updatecurrenttrue + + + +% Scanner: Scans a point or a relative point. +% It then calls the first parameter with the argument set to an +% appropriate pgf command representing that point. + +\def\tikz@scan@one@point#1{% + \tikz@shapeborderfalse% + \@ifnextchar+{\tikz@scan@relative#1}{\tikz@scan@absolute#1}} +\def\tikz@scan@absolute#1{% + \@ifnextchar({\tikz@scan@@absolute#1}%) + {% + \advance\tikz@expandcount by -1% + \ifnum\tikz@expandcount<0\relax% + \let\@next=\tikz@@scangiveup% + \else% + \let\@next=\tikz@@scanexpand + \fi% + \@next{#1}% + }% +} +\def\tikz@@scanexpand#1{\expandafter\tikz@scan@one@point\expandafter#1} +\def\tikz@@scangiveup#1{\PackageError{tikz}{Cannot parse this coordinate}{}#1{\pgfpointorigin}} +\def\tikz@scan@@absolute#1(#2){% + \edef\tikz@temp{(#2)}% + \expandafter\tikz@@scan@@absolute\expandafter#1\tikz@temp% +} +\def\tikz@@scan@@absolute#1({% + \@ifnextchar[% uhoh... options! + {\def\tikz@scan@point@recall{#1}\tikz@scan@options}% + {\tikz@@@scan@@absolute#1(}% +} + +\def\tikz@scan@options[#1]#2{% + \def\tikz@scan@point@options{#1}% + \tikz@@@scan@@absolute\tikz@scan@handle@options(#2% +} + +\def\tikz@scan@handle@options#1{% + {% + % Ok, compute point with options set and zero transformation + % matrix: + \pgftransformreset% + \let\tikz@transform=\@empty% + \expandafter\tikz@setkeys\expandafter{\tikz@scan@point@options}% + \tikz@transform% + \pgf@process{\pgfpointtransformed{#1}}% + \xdef\tikz@marshal{\expandafter\noexpand\tikz@scan@point@recall{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}% + }% + \tikz@marshal% +} + +\def\tikz@@@scan@@absolute#1(#2){% + \in@{intersection of}{#2}% + \ifin@% + \let\@next\tikz@parse@intersection% + \else% + \in@|{#2}% + \ifin@ + \in@{-|}{#2}% + \ifin@ + \let\@next\tikz@parse@hv% + \else% + \let\@next\tikz@parse@vh% + \fi% + \else% + \in@:{#2}% + \ifin@ + \let\@next\tikz@parse@polar% + \else% + \in@,{#2}% + \ifin@% + \let\@next\tikz@parse@regular% + \else% + \let\@next\tikz@parse@node% + \fi% + \fi% + \fi% + \fi% + \@next#1(#2)% +} + +\newif\iftikz@isdimension +\def\tikz@checkunit#1{% + \@tempdima\z@% + \afterassignment\tikz@@checkunit% + \@tempdima#1\@tempdima\tikz@unique% +} +\def\tikz@@checkunit{\@ifnextchar\tikz@unique{\tikz@checkunit@number}{\tikz@checkunit@dimension}} +\def\tikz@checkunit@number\tikz@unique{\tikz@isdimensionfalse} +\def\tikz@checkunit@dimension#1\tikz@unique{\tikz@isdimensiontrue} + +\def\tikz@parse@polar#1(#2:#3){% + \@ifundefined{tikz@polar@dir@#2} + {#1{\pgfpointpolar{#2}{#3}}} + {% + \edef\tikz@marshal{\noexpand#1{\noexpand\pgfpointpolar{\csname tikz@polar@dir@#2\endcsname}{#3}}}% + \tikz@marshal% + }% +} +\def\tikz@polar@dir@up{90} +\def\tikz@polar@dir@down{-90} +\def\tikz@polar@dir@left{180} +\def\tikz@polar@dir@right{0} +\def\tikz@polar@dir@north{90} +\def\tikz@polar@dir@south{-90} +\def\tikz@polar@dir@east{0} +\def\tikz@polar@dir@west{180} +\expandafter\def\csname tikz@polar@dir@north east\endcsname{45} +\expandafter\def\csname tikz@polar@dir@north west\endcsname{135} +\expandafter\def\csname tikz@polar@dir@south east\endcsname{-45} +\expandafter\def\csname tikz@polar@dir@south west\endcsname{-135} + +\def\tikz@parse@regular#1(#2,#3){% + \in@,{#3}% + \ifin@% + \tikz@parse@splitxyz{#1}{#2}#3,% + \else% + \tikz@checkunit{#2}% + \iftikz@isdimension% + \def\@next{#1{\pgfpoint{#2}{#3}}}% + \else% + \def\@next{#1{\pgfpointxy{#2}{#3}}}% + \fi% + \fi% + \@next% +} + +\def\tikz@parse@splitxyz#1#2#3,#4,{% + \def\@next{#1{\pgfpointxyz{#2}{#3}{#4}}}% +} + +\def\tikz@coordinate@text{coordinate} + +\def\tikz@parse@node#1(#2){% + \in@.{#2}% Ok, flag this + \ifin@ + \tikz@calc@anchor#2\tikz@stop% + \else% + \tikz@calc@anchor#2.center\tikz@stop% to be on the save side, in + % case iftikz@shapeborder is ignored... + \expandafter\ifx\csname pgf@sh@ns@#2\endcsname\tikz@coordinate@text% + \else + \tikz@shapebordertrue% + \def\tikz@shapeborder@name{#2}% + \fi% + \fi% + \edef\tikz@marshal{\noexpand#1{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}% + \tikz@marshal% +} + +\def\tikz@calc@anchor#1.#2\tikz@stop{% + \pgfpointanchor{#1}{#2}% +} + + +\def\tikz@parse@hv#1(#2){% + \in@{ -| }{#2}% + \ifin@% + \let\tikz@next=\tikz@parse@hvboth% + \else% + \in@{ -|}{#2}% + \ifin@% + \let\tikz@next=\tikz@parse@hvleft% + \else% + \in@{-| }{#2}% + \ifin@% + \let\tikz@next=\tikz@parse@hvright% + \else% + \let\tikz@next=\tikz@parse@hvdone% + \fi% + \fi% + \fi% + \tikz@next#1(#2)} +\def\tikz@parse@hvboth#1(#2 -| #3){\tikz@parse@vhdone#1(#3|-#2)} +\def\tikz@parse@hvleft#1(#2 -|#3){\tikz@parse@vhdone#1(#3|-#2)} +\def\tikz@parse@hvright#1(#2-| #3){\tikz@parse@vhdone#1(#3|-#2)} +\def\tikz@parse@hvdone#1(#2-|#3){\tikz@parse@vhdone#1(#3|-#2)} + +\def\tikz@parse@vh#1(#2){% + \in@{ |- }{#2}% + \ifin@% + \let\tikz@next=\tikz@parse@vhboth% + \else% + \in@{ |-}{#2}% + \ifin@% + \let\tikz@next=\tikz@parse@vhleft% + \else% + \in@{|- }{#2}% + \ifin@% + \let\tikz@next=\tikz@parse@vhright% + \else% + \let\tikz@next=\tikz@parse@vhdone% + \fi% + \fi% + \fi% + \tikz@next#1(#2)} +\def\tikz@parse@vhboth#1(#2 |- #3){\tikz@parse@vhdone#1(#2|-#3)} +\def\tikz@parse@vhleft#1(#2 |-#3){\tikz@parse@vhdone#1(#2|-#3)} +\def\tikz@parse@vhright#1(#2|- #3){\tikz@parse@vhdone#1(#2|-#3)} +\def\tikz@parse@vhdone#1(#2|-#3){% + {% + \tikz@@@scan@@absolute\tikz@parse@vh@mid(#2)% + \tikz@@@scan@@absolute\tikz@parse@vh@end(#3)% + \xdef\tikz@marshal{\noexpand#1{\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}}% + }% + \tikz@shapeborderfalse% + \tikz@marshal% +} +\def\tikz@parse@vh@mid#1{\pgf@process{#1}\pgf@xa=\pgf@x} +\def\tikz@parse@vh@end#1{\pgf@process{#1}\pgf@ya=\pgf@y} + +\def\tikz@parse@intersection#1(intersection of #2--#3 and #4--#5){% + {% + \tikz@@@scan@@absolute\tikz@parse@intersection@a(#2)% + \tikz@@@scan@@absolute\tikz@parse@intersection@b(#3)% + \tikz@@@scan@@absolute\tikz@parse@intersection@c(#4)% + \tikz@@@scan@@absolute\tikz@parse@intersection@d(#5)% + \xdef\tikz@marshal{\noexpand#1{\noexpand\pgfpointintersectionoflines% + {\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}% + {\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}}% + {\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}}}% + }% + \tikz@shapeborderfalse% + \tikz@marshal% +} + +\def\tikz@parse@intersection@a#1{\pgf@process{#1}\pgf@xa=\pgf@x\pgf@ya=\pgf@y} +\def\tikz@parse@intersection@b#1{\pgf@process{#1}\pgf@xb=\pgf@x\pgf@yb=\pgf@y} +\def\tikz@parse@intersection@c#1{\pgf@process{#1}\pgf@xc=\pgf@x\pgf@yc=\pgf@y} +\def\tikz@parse@intersection@d#1{\pgf@process{#1}} + +\def\tikz@scan@relative#1+{% + \@ifnextchar+{\tikz@scan@plusplus#1}{\tikz@scan@oneplus#1}} + +\def\tikz@scan@plusplus#1+{% + \def\tikz@doafter{#1}% + \tikz@scan@absolute\tikz@add% +} +\def\tikz@add#1{% + \tikz@doafter{\pgfpointadd{#1}{\tikz@last@position@saved}}% +} +\def\tikz@scan@oneplus#1{% + \def\tikz@doafter{#1}% + \tikz@updatecurrentfalse% + \tikz@scan@absolute\tikz@add% +} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex new file mode 100644 index 00000000000..e953e2d28b1 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.code.tex @@ -0,0 +1,806 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryarrows.code.tex,v 1.2 2005/07/06 15:58:57 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +% A square bracket shaped arrow + +\pgfarrowsdeclare{[}{]} +{ + \@tempdima=1pt% + \advance\@tempdima by1.25\pgflinewidth% + \pgfarrowsleftextend{-\@tempdima} + \pgfarrowsrightextend{.5\pgflinewidth} +} +{ + \@tempdima=2pt% + \advance\@tempdima by1.5\pgflinewidth% + \@tempdimb=\@tempdima% + \advance\@tempdimb by\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetmiterjoin + \pgfsetbuttcap + \pgfpathmoveto{\pgfpoint{-.5\@tempdimb}{-\@tempdima}} + \pgfpathlineto{\pgfpoint{0pt}{-\@tempdima}} + \pgfpathlineto{\pgfpoint{0pt}{\@tempdima}} + \pgfpathlineto{\pgfpoint{-.5\@tempdimb}{\@tempdima}} + \pgfusepathqstroke +} + +\pgfarrowsdeclarereversed{]}{[}{[}{]} + + +% A round bracket shaped arrow + +\pgfarrowsdeclare{(}{)} +{ + \@tempdima=2pt% + \advance\@tempdima by1.5\pgflinewidth% + \@tempdimb=0.0625\@tempdima\advance\@tempdimb by.5\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} + \@tempdimb=0.5\@tempdima\advance\@tempdimb by.5\pgflinewidth% + \pgfarrowsleftextend{-\@tempdimb} +} +{ + \@tempdima=2pt% + \advance\@tempdima by1.5\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfpathmoveto{\pgfpoint{-.5\@tempdima}{-\@tempdima}} + \pgfpathcurveto + {\pgfpoint{.25\@tempdima}{-.5\@tempdima}} + {\pgfpoint{.25\@tempdima}{.5\@tempdima}} + {\pgfpoint{-.5\@tempdima}{\@tempdima}} + \pgfusepathqstroke +} + +\pgfarrowsdeclarereversed{)}{(}{(}{)} + + + + +% A pointed bracket shaped arrow + +\pgfarrowsdeclare{angle 90}{angle 90} +{ + \@tempdima=0.3pt% + \advance\@tempdima by.25\pgflinewidth% + \@tempdimb=5.5\@tempdima\advance\@tempdimb by.5\pgflinewidth% + \pgfarrowsleftextend{-\@tempdimb} + \@tempdimb=.5\@tempdima\advance\@tempdimb by0.707\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.3pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfsetmiterjoin + \pgfpathmoveto{\pgfpoint{-5.5\@tempdima}{-6\@tempdima}} + \pgfpathlineto{\pgfpoint{0.5\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpoint{-5.5\@tempdima}{6\@tempdima}} + \pgfusepathqstroke +} + +\pgfarrowsdeclarereversed{angle 90 reversed}{angle 90 reversed}{angle 90}{angle 90} + + +\pgfarrowsdeclare{angle 60}{angle 60} +{ + \@tempdima=0.3pt% + \advance\@tempdima by.25\pgflinewidth% + \@tempdimb=7.29\@tempdima\advance\@tempdimb by.5\pgflinewidth% + \pgfarrowsleftextend{-\@tempdimb} + \@tempdimb=.5\@tempdima\advance\@tempdimb by\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.3pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfsetmiterjoin + \pgfpathmoveto{\pgfpointadd{\pgfpoint{0.5\@tempdima}{0pt}}{\pgfpointpolar{150}{9\@tempdima}}} + \pgfpathlineto{\pgfpoint{0.5\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{0.5\@tempdima}{0pt}}{\pgfpointpolar{-150}{9\@tempdima}}} + \pgfusepathqstroke +} + +\pgfarrowsdeclarereversed{angle 60 reversed}{angle 60 reversed}{angle 60}{angle 60} + + + +\pgfarrowsdeclare{angle 45}{angle 45} +{ + \@tempdima=0.3pt% + \advance\@tempdima by.25\pgflinewidth% + \@tempdimb=8.705\@tempdima\advance\@tempdimb by.5\pgflinewidth% + \pgfarrowsleftextend{-\@tempdimb} + \@tempdimb=.5\@tempdima\advance\@tempdimb by1.28\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.3pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfsetmiterjoin + \pgfpathmoveto{\pgfpointadd{\pgfpoint{0.5\@tempdima}{0pt}}{\pgfpointpolar{157}{10\@tempdima}}} + \pgfpathlineto{\pgfpoint{0.5\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{0.5\@tempdima}{0pt}}{\pgfpointpolar{-157}{10\@tempdima}}} + \pgfusepathqstroke +} + +\pgfarrowsdeclarereversed{angle 45 reversed}{angle 45 reversed}{angle 45}{angle 45} + + + +% A dot shaped arrow + +\pgfarrowsdeclare{*}{*} +{ + \@tempdima=0.4pt% + \advance\@tempdima by.2\pgflinewidth% + \@tempdimb=5.5\@tempdima\advance\@tempdimb by\pgflinewidth + \pgfarrowsleftextend{-\@tempdimb} + \@tempdimb=1.5\@tempdima\advance\@tempdimb by.5\pgflinewidth + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.4pt% + \advance\@tempdima by.2\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfpathcircle{\pgfpoint{-3\@tempdima}{0pt}}{4.5\@tempdima} + \pgfusepathqfillstroke +} + + +% An open dot shaped arrow + +\pgfarrowsdeclare{o}{o} +{ + \pgfarrowsleftextend{-.5\pgflinewidth} + \@tempdima=0.4pt% + \advance\@tempdima by.2\pgflinewidth% + \@tempdimb=9\@tempdima\advance\@tempdimb by.5\pgflinewidth + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.4pt% + \advance\@tempdima by.2\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfpathcircle{\pgfpoint{4.5\@tempdima}{0bp}}{4.5\@tempdima} + \pgfusepathqstroke +} + + + +% A diamond shaped arrow + +\pgfarrowsdeclare{diamond}{diamond} +{ + \@tempdima=0.4pt% + \advance\@tempdima by.275\pgflinewidth% + \@tempdimb=13\@tempdima\advance\@tempdimb by.5\pgflinewidth + \pgfarrowsleftextend{-\@tempdimb} + \@tempdimb=1\@tempdima\advance\@tempdimb by.5\pgflinewidth + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.4pt% + \advance\@tempdima by.275\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetroundjoin + \pgfpathmoveto{\pgfpoint{1\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpoint{-6\@tempdima}{4\@tempdima}} + \pgfpathlineto{\pgfpoint{-13\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpoint{-6\@tempdima}{-4\@tempdima}} + \pgfpathclose + \pgfusepathqfillstroke +} + +\pgfarrowsdeclare{open diamond}{open diamond}%{{-.5bp}{14.5bp}} +{ + \@tempdima=0.4pt% + \advance\@tempdima by.275\pgflinewidth% + \pgfarrowsleftextend{-.5\pgflinewidth} + \@tempdimb=14\@tempdima\advance\@tempdimb by.5\pgflinewidth + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.4pt% + \advance\@tempdima by.275\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetroundjoin + \pgfpathmoveto{\pgfpoint{14\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpoint{7\@tempdima}{4\@tempdima}} + \pgfpathlineto{\pgfpoint{0\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpoint{7\@tempdima}{-4\@tempdima}} + \pgfpathclose + \pgfusepathqstroke +} + + + +% A triangle shaped arrow + +\pgfarrowsdeclare{triangle 90}{triangle 90} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \@tempdimb=5.5\@tempdima\advance\@tempdimb by.5\pgflinewidth% + \pgfarrowsleftextend{-\@tempdimb} + \@tempdimb=.5\@tempdima\advance\@tempdimb by0.707\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetmiterjoin + \pgfpathmoveto{\pgfpoint{-5.5\@tempdima}{-6\@tempdima}} + \pgfpathlineto{\pgfpoint{0.5\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpoint{-5.5\@tempdima}{6\@tempdima}} + \pgfpathclose + \pgfusepathqfillstroke +} + +\pgfarrowsdeclarereversed{triangle 90 reversed}{triangle 90 reversed}{triangle 90}{triangle 90} + + +\pgfarrowsdeclare{triangle 60}{triangle 60} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \@tempdimb=7.29\@tempdima\advance\@tempdimb by.5\pgflinewidth% + \pgfarrowsleftextend{-\@tempdimb} + \@tempdimb=.5\@tempdima\advance\@tempdimb by\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetmiterjoin + \pgfpathmoveto{\pgfpointadd{\pgfpoint{0.5\@tempdima}{0pt}}{\pgfpointpolar{150}{9\@tempdima}}} + \pgfpathlineto{\pgfpoint{0.5\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{0.5\@tempdima}{0pt}}{\pgfpointpolar{-150}{9\@tempdima}}} + \pgfpathclose + \pgfusepathqfillstroke +} + +\pgfarrowsdeclarereversed{triangle 60 reversed}{triangle 60 reversed}{triangle 60}{triangle 60} + + + + +\pgfarrowsdeclare{triangle 45}{triangle 45} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \@tempdimb=8.705\@tempdima\advance\@tempdimb by.5\pgflinewidth% + \pgfarrowsleftextend{-\@tempdimb} + \@tempdimb=.5\@tempdima\advance\@tempdimb by1.28\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetmiterjoin + \pgfpathmoveto{\pgfpointadd{\pgfpoint{0.5\@tempdima}{0pt}}{\pgfpointpolar{157}{10\@tempdima}}} + \pgfpathlineto{\pgfpoint{0.5\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{0.5\@tempdima}{0pt}}{\pgfpointpolar{-157}{10\@tempdima}}} + \pgfpathclose + \pgfusepathqfillstroke +} + +\pgfarrowsdeclarereversed{triangle 45 reversed}{triangle 45 reversed}{triangle 45}{triangle 45} + + + + +\pgfarrowsdeclare{open triangle 90}{open triangle 90} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfarrowsleftextend{-.5\pgflinewidth} + \@tempdimb=6\@tempdima\advance\@tempdimb by0.707\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetmiterjoin + \pgfpathmoveto{\pgfpoint{0\@tempdima}{-6\@tempdima}} + \pgfpathlineto{\pgfpoint{6\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpoint{0\@tempdima}{6\@tempdima}} + \pgfpathclose + \pgfusepathqstroke +} + +\pgfarrowsdeclare{open triangle 90 reversed}{open triangle 90 reversed} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfarrowsleftextend{-.707\pgflinewidth} + \@tempdimb=6\@tempdima\advance\@tempdimb by0.5\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetmiterjoin + \pgfpathmoveto{\pgfpoint{6\@tempdima}{-6\@tempdima}} + \pgfpathlineto{\pgfpoint{0\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpoint{6\@tempdima}{6\@tempdima}} + \pgfpathclose + \pgfusepathqstroke +} + + + +\pgfarrowsdeclare{open triangle 60}{open triangle 60} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfarrowsleftextend{-.5\pgflinewidth} + \@tempdimb=7.794\@tempdima\advance\@tempdimb by\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetmiterjoin + \pgfpathmoveto{\pgfpointadd{\pgfpoint{7.794\@tempdima}{0pt}}{\pgfpointpolar{150}{9\@tempdima}}} + \pgfpathlineto{\pgfpoint{7.794\@tempdima}{0pt}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{7.794\@tempdima}{0pt}}{\pgfpointpolar{-150}{9\@tempdima}}} + \pgfpathclose + \pgfusepathqstroke +} + + + +\pgfarrowsdeclare{open triangle 60 reversed}{open triangle 60 reversed} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfarrowsleftextend{-\pgflinewidth} + \@tempdimb=7.794\@tempdima\advance\@tempdimb by0.5\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetmiterjoin + \pgfpathmoveto{\pgfpointpolar{30}{9\@tempdima}} + \pgfpathlineto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{-30}{9\@tempdima}} + \pgfpathclose + \pgfusepathqstroke +} + + + +\pgfarrowsdeclare{open triangle 45}{open triangle 45} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfarrowsleftextend{-.5\pgflinewidth} + \@tempdimb=9.205\@tempdima\advance\@tempdimb by1.28\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetmiterjoin + \pgfpathmoveto{\pgfpointadd{\pgfpoint{9.205\@tempdima}{0pt}}{\pgfpointpolar{157}{10\@tempdima}}} + \pgfpathlineto{\pgfpoint{9.205\@tempdima}{0pt}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{9.205\@tempdima}{0pt}}{\pgfpointpolar{-157}{10\@tempdima}}} + \pgfpathclose + \pgfusepathqstroke +} + + + +\pgfarrowsdeclare{open triangle 45 reversed}{open triangle 45 reversed} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfarrowsleftextend{-1.28\pgflinewidth} + \@tempdimb=9.205\@tempdima\advance\@tempdimb by0.5\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.5pt% + \advance\@tempdima by.25\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetmiterjoin + \pgfpathmoveto{\pgfpointpolar{23}{10\@tempdima}} + \pgfpathlineto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{-23}{10\@tempdima}} + \pgfpathclose + \pgfusepathqstroke +} + + + +% A less fleshy variant of LaTeX's orginal arrow type + +\pgfarrowsdeclare{latex'}{latex'} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfarrowsleftextend{-4\@tempdima} + \pgfarrowsrightextend{6\@tempdima} +} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfpathmoveto{\pgfpoint{6\@tempdima}{0\@tempdima}} + \pgfpathcurveto + {\pgfpoint{3.5\@tempdima}{.5\@tempdima}} + {\pgfpoint{-1\@tempdima}{1.5\@tempdima}} + {\pgfpoint{-4\@tempdima}{3.75\@tempdima}} + \pgfpathcurveto + {\pgfpoint{-1.5\@tempdima}{1\@tempdima}} + {\pgfpoint{-1.5\@tempdima}{-1\@tempdima}} + {\pgfpoint{-4\@tempdima}{-3.75\@tempdima}} + \pgfpathcurveto + {\pgfpoint{-1\@tempdima}{-1.5\@tempdima}} + {\pgfpoint{3.5\@tempdima}{-.5\@tempdima}} + {\pgfpoint{6\@tempdima}{0\@tempdima}} + \pgfusepathqfill +} + +\pgfarrowsdeclarereversed{latex' reversed}{latex' reversed}{latex'}{latex'} + + +% A rounded variant of the stealth arrow + +\pgfarrowsdeclare{stealth'}{stealth'} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \@tempdimb=6\@tempdima\advance\@tempdimb by.5\pgflinewidth% + \pgfarrowsleftextend{-\@tempdimb} + \@tempdimb=2\@tempdima\advance\@tempdimb by0.5\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetroundjoin + \pgfpathmoveto{\pgfpoint{2\@tempdima}{0\@tempdima}} + \pgfpathcurveto + {\pgfpoint{-.5\@tempdima}{.5\@tempdima}} + {\pgfpoint{-3\@tempdima}{1.5\@tempdima}} + {\pgfpoint{-6\@tempdima}{3.25\@tempdima}} + \pgfpathcurveto + {\pgfpoint{-3\@tempdima}{1\@tempdima}} + {\pgfpoint{-3\@tempdima}{-1\@tempdima}} + {\pgfpoint{-6\@tempdima}{-3.25\@tempdima}} + \pgfpathcurveto + {\pgfpoint{-3\@tempdima}{-1.5\@tempdima}} + {\pgfpoint{-.5\@tempdima}{-.5\@tempdima}} + {\pgfpoint{2\@tempdima}{0\@tempdima}} + \pgfpathclose + \pgfusepathqfillstroke +} + +\pgfarrowsdeclarereversed{stealth' reversed}{stealth' reversed}{stealth'}{stealth'} + + + +% The two half of the $\to$ arrow + +\pgfarrowsdeclare{left to}{left to} +{ + \@tempdima=-0.84pt% + \advance\@tempdima by-1.3\pgflinewidth% + \@tempdimb=0.21pt% + \advance\@tempdimb by.625\pgflinewidth% + \pgfarrowsleftextend{\@tempdima} + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfsetlinewidth{0.8\pgflinewidth} + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfsetroundjoin + \pgfpathmoveto{\pgfpoint{-3\@tempdima}{4\@tempdima}} + \pgfpathcurveto + {\pgfpoint{-2.75\@tempdima}{2.5\@tempdima}} + {\pgfpoint{0pt}{0.25\@tempdima}} + {\pgfpoint{0.75\@tempdima}{0pt}} + \pgfpathcurveto + {\pgfpoint{0.55\@tempdima}{-0.125\pgflinewidth}} + {\pgfpoint{0.5\@tempdima}{-0.125\pgflinewidth}} + {\pgfpoint{0.5\@tempdima}{-0.125\pgflinewidth}} + \pgfpathlineto{\pgfpoint{0pt}{-0.125\pgflinewidth}} + \pgfusepathqstroke +} + + +\pgfarrowsdeclare{right to}{right to} +{ + \@tempdima=-0.84pt% + \advance\@tempdima by-1.3\pgflinewidth% + \@tempdimb=0.21pt% + \advance\@tempdimb by.625\pgflinewidth% + \pgfarrowsleftextend{\@tempdima} + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfsetlinewidth{0.8\pgflinewidth} + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfsetroundjoin + \pgfpathmoveto{\pgfpoint{-3\@tempdima}{-4\@tempdima}} + \pgfpathcurveto + {\pgfpoint{-2.75\@tempdima}{-2.5\@tempdima}} + {\pgfpoint{0pt}{-0.25\@tempdima}} + {\pgfpoint{0.75\@tempdima}{0pt}} + \pgfpathcurveto + {\pgfpoint{0.55\@tempdima}{0.125\pgflinewidth}} + {\pgfpoint{0.5\@tempdima}{0.125\pgflinewidth}} + {\pgfpoint{0.5\@tempdima}{0.125\pgflinewidth}} + \pgfpathlineto{\pgfpoint{0pt}{0.125\pgflinewidth}} + \pgfusepathqstroke +} + + + +% The halfs of the $\to$ arrow reversed + +\pgfarrowsdeclare{left to reversed}{left to reversed} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfarrowsleftextend{-.1\pgflinewidth} + \@tempdimb=3.75\@tempdima\advance\@tempdimb by0.9\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetroundjoin + \pgfsetbuttcap + \pgfpathmoveto{\pgfpoint{0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{-0.1\pgflinewidth}{0pt}} + \pgfusepathqstroke + \pgfsetroundcap + \pgfsetlinewidth{.8\pgflinewidth} + {\pgftransformxshift{0.625\pgflinewidth} + \pgfpathmoveto{\pgfpoint{3.75\@tempdima}{4\@tempdima}} + \pgfpathcurveto{\pgfpoint{3.5\@tempdima}{2.5\@tempdima}}{\pgfpoint{0.75\@tempdima}{0.25\@tempdima}}{\pgfpoint{0pt}{0.125\pgflinewidth}} + \pgfpathmoveto{\pgfpoint{3.75\@tempdima}{4\@tempdima}} + \pgfpathcurveto{\pgfpoint{3.5\@tempdima}{2.5\@tempdima}}{\pgfpoint{0.75\@tempdima}{0.25\@tempdima}}{\pgfpoint{0pt}{-0.125\pgflinewidth}} + } + \pgfusepathqstroke% +} + +\pgfarrowsdeclare{right to reversed}{right to reversed} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfarrowsleftextend{-.1\pgflinewidth} + \@tempdimb=3.75\@tempdima\advance\@tempdimb by0.9\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.28pt% + \advance\@tempdima by.3\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetroundjoin + \pgfsetbuttcap + \pgfpathmoveto{\pgfpoint{0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{-0.1\pgflinewidth}{0pt}} + \pgfusepathqstroke + \pgfsetroundcap + \pgfsetlinewidth{.8\pgflinewidth} + {\pgftransformxshift{0.625\pgflinewidth} + \pgfpathmoveto{\pgfpoint{3.75\@tempdima}{-4\@tempdima}} + \pgfpathcurveto{\pgfpoint{3.5\@tempdima}{-2.5\@tempdima}}{\pgfpoint{0.75\@tempdima}{-0.25\@tempdima}}{\pgfpoint{0pt}{-0.125\pgflinewidth}} + \pgfpathmoveto{\pgfpoint{3.75\@tempdima}{-4\@tempdima}} + \pgfpathcurveto{\pgfpoint{3.5\@tempdima}{-2.5\@tempdima}}{\pgfpoint{0.75\@tempdima}{-0.25\@tempdima}}{\pgfpoint{0pt}{0.125\pgflinewidth}} + } + \pgfusepathqstroke% +} + + + +% A left hook + +\pgfarrowsdeclare{left hook}{left hook} +{ + \@tempdima=0.4pt% + \advance\@tempdima by.2\pgflinewidth% + \pgfarrowsleftextend{-.5\pgflinewidth} + \@tempdimb=3.75\@tempdima\advance\@tempdimb by0.5\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.4pt% + \advance\@tempdima by.2\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfpathmoveto{\pgfpoint{0\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpoint{0.75\@tempdima}{0\@tempdima}} + \pgfpathcurveto{\pgfpoint{2.415\@tempdima}{0\@tempdima}}{\pgfpoint{3.75\@tempdima}{1.665\@tempdima}}{\pgfpoint{3.75\@tempdima}{3\@tempdima}} + \pgfpathcurveto{\pgfpoint{3.75\@tempdima}{4.665\@tempdima}}{\pgfpoint{2.415\@tempdima}{6\@tempdima}}{\pgfpoint{0.75\@tempdima}{6\@tempdima}} + \pgfusepathqstroke% +} + +\pgfarrowsdeclarereversed{left hook reversed}{left hook reversed}{left hook}{left hook} + + + +% A right hook + +\pgfarrowsdeclare{right hook}{right hook} +{ + \@tempdima=0.4pt% + \advance\@tempdima by.2\pgflinewidth% + \pgfarrowsleftextend{-.5\pgflinewidth} + \@tempdimb=3.75\@tempdima\advance\@tempdimb by0.5\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.4pt% + \advance\@tempdima by.2\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfpathmoveto{\pgfpoint{0\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpoint{0.75\@tempdima}{0\@tempdima}} + \pgfpathcurveto{\pgfpoint{2.415\@tempdima}{0\@tempdima}}{\pgfpoint{3.75\@tempdima}{-1.665\@tempdima}}{\pgfpoint{3.75\@tempdima}{-3\@tempdima}} + \pgfpathcurveto{\pgfpoint{3.75\@tempdima}{-4.665\@tempdima}}{\pgfpoint{2.415\@tempdima}{-6\@tempdima}}{\pgfpoint{0.75\@tempdima}{-6\@tempdima}} + \pgfusepathqstroke% +} + +\pgfarrowsdeclarereversed{right hook reversed}{right hook reversed}{right hook}{right hook} + + +% Hooks in both directions + +\pgfarrowsdeclare{hooks}{hooks} +{ + \@tempdima=0.4pt% + \advance\@tempdima by.2\pgflinewidth% + \pgfarrowsleftextend{-.5\pgflinewidth} + \@tempdimb=3.75\@tempdima\advance\@tempdimb by0.5\pgflinewidth% + \pgfarrowsrightextend{\@tempdimb} +} +{ + \@tempdima=0.4pt% + \advance\@tempdima by.2\pgflinewidth% + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfpathmoveto{\pgfpoint{0\@tempdima}{0\@tempdima}} + \pgfpathlineto{\pgfpoint{0.75\@tempdima}{0\@tempdima}} + \pgfpathcurveto{\pgfpoint{2.415\@tempdima}{0\@tempdima}}{\pgfpoint{3.75\@tempdima}{1.665\@tempdima}}{\pgfpoint{3.75\@tempdima}{3\@tempdima}} + \pgfpathcurveto{\pgfpoint{3.75\@tempdima}{4.665\@tempdima}}{\pgfpoint{2.415\@tempdima}{6\@tempdima}}{\pgfpoint{0.75\@tempdima}{6\@tempdima}} + \pgfpathmoveto{\pgfpoint{0.75\@tempdima}{0\@tempdima}} + \pgfpathcurveto{\pgfpoint{2.415\@tempdima}{0\@tempdima}}{\pgfpoint{3.75\@tempdima}{-1.665\@tempdima}}{\pgfpoint{3.75\@tempdima}{-3\@tempdima}} + \pgfpathcurveto{\pgfpoint{3.75\@tempdima}{-4.665\@tempdima}}{\pgfpoint{2.415\@tempdima}{-6\@tempdima}}{\pgfpoint{0.75\@tempdima}{-6\@tempdima}} + \pgfusepathqstroke% +} + +\pgfarrowsdeclarereversed{hooks reversed}{hooks reversed}{hooks}{hooks} + + + + +% Round cap + +\pgfarrowsdeclare{round cap}{round cap} +{\pgfarrowsleftextend{0pt}\pgfarrowsrightextend{\pgflinewidth}} +{ + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0.5\pgflinewidth}{0pt}} + \pgfusepathqstroke +} + + +% Butt cap + +\pgfarrowsdeclare{butt cap}{butt cap} +{\pgfarrowsleftextend{-.1\pgflinewidth}\pgfarrowsrightextend{.5\pgflinewidth}} +{ + \pgfsetdash{}{0pt} + \pgfsetbuttcap + \pgfpathmoveto{\pgfpoint{-.1\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgflinewidth}{0pt}} + \pgfusepathqstroke +} + + + +% 90 degrees cap + +\pgfarrowsdeclare{triangle 90 cap}{triangle 90 cap} +{\pgfarrowsleftextend{-.1\pgflinewidth}\pgfarrowsrightextend{1\pgflinewidth}} +{ + \pgfpathmoveto{\pgfpoint{-.1\pgflinewidth}{0.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{.5\pgflinewidth}{.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{.5\pgflinewidth}{-.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{-.1\pgflinewidth}{-0.5\pgflinewidth}} + \pgfusepathqfill +} + + +% reversed 90 degrees cap + +\pgfarrowsdeclare{triangle 90 cap reversed}{triangle 90 cap reversed} +{\pgfarrowsleftextend{-.1\pgflinewidth}\pgfarrowsrightextend{1\pgflinewidth}} +{ + \pgfpathmoveto{\pgfpoint{1\pgflinewidth}{0.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{-.1\pgflinewidth}{.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{-.1\pgflinewidth}{-.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{1\pgflinewidth}{-.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{0.5\pgflinewidth}{0\pgflinewidth}} + \pgfusepathqfill +} + + + +% fast + +\pgfarrowsdeclare{fast cap}{fast cap} +{\pgfarrowsleftextend{-.1\pgflinewidth}\pgfarrowsrightextend{2\pgflinewidth}} +{ + \pgfpathmoveto{\pgfpoint{-.1\pgflinewidth}{0.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{.5\pgflinewidth}{.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{1\pgflinewidth}{0\pgflinewidth}} + \pgfpathlineto{\pgfpoint{.5\pgflinewidth}{-.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{-.1\pgflinewidth}{-0.5\pgflinewidth}} + \pgfpathclose + \pgfpathmoveto{\pgfpoint{1\pgflinewidth}{0.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{1.5\pgflinewidth}{0.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{2\pgflinewidth}{0\pgflinewidth}} + \pgfpathlineto{\pgfpoint{1.5\pgflinewidth}{-.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{1\pgflinewidth}{-0.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{1.5\pgflinewidth}{0\pgflinewidth}} + \pgfpathclose + \pgfusepathqfill +} + + +\pgfarrowsdeclare{fast cap reversed}{fast cap reversed} +{\pgfarrowsleftextend{-.1\pgflinewidth}\pgfarrowsrightextend{2\pgflinewidth}} +{ + \pgfpathmoveto{\pgfpoint{-.1\pgflinewidth}{0.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{1\pgflinewidth}{.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{.5\pgflinewidth}{0\pgflinewidth}} + \pgfpathlineto{\pgfpoint{1\pgflinewidth}{-.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{-.1\pgflinewidth}{-0.5\pgflinewidth}} + \pgfpathclose + \pgfpathmoveto{\pgfpoint{1.5\pgflinewidth}{0.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{2\pgflinewidth}{0.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{1.5\pgflinewidth}{0\pgflinewidth}} + \pgfpathlineto{\pgfpoint{2\pgflinewidth}{-.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{1.5\pgflinewidth}{-0.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint{1\pgflinewidth}{0\pgflinewidth}} + \pgfpathclose + \pgfusepathqfill +} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryautomata.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryautomata.code.tex new file mode 100644 index 00000000000..be801d0a7df --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryautomata.code.tex @@ -0,0 +1,189 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryautomata.code.tex,v 1.1 2005/10/13 10:12:31 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + +\newbox\pgfnodepartoutputbox + + + +% +% Node for states without output. This is just an alias for a circle +% node. +% +\pgfdeclareshape{state} +{ + \inheritsavedanchors[from=circle] % this is a circle + \inheritanchorborder[from=circle] + \inheritanchor[from=circle]{north} + \inheritanchor[from=circle]{north west} + \inheritanchor[from=circle]{north east} + \inheritanchor[from=circle]{center} + \inheritanchor[from=circle]{west} + \inheritanchor[from=circle]{east} + \inheritanchor[from=circle]{mid} + \inheritanchor[from=circle]{mid west} + \inheritanchor[from=circle]{mid east} + \inheritanchor[from=circle]{base} + \inheritanchor[from=circle]{base west} + \inheritanchor[from=circle]{base east} + \inheritanchor[from=circle]{south} + \inheritanchor[from=circle]{south west} + \inheritanchor[from=circle]{south east} + \inheritbackgroundpath[from=circle] +} + + +% +% Moore state node (a state with output). +% +% This node consists of two parts: The main part is the state +% name. The second part is the (optional) state output. This output is +% shown in the lower half of the node. +% +% Parts: text (=state name), output + +\pgfdeclareshape{state with output} +{ + % + % Node parts + % + \nodeparts{text,output} + + % + % Anchors + % + \savedanchor\centerpoint{% + \pgf@x=.5\wd\pgfnodeparttextbox% + \setlength{\pgf@y}{\pgfshapeinnerysep}% + \pgf@y=-\pgf@y% + \advance\pgf@y by-\dp\pgfnodeparttextbox% + \advance\pgf@y by-.5\pgflinewidth% + }% + \savedanchor\outputanchor{% + \pgf@x=-.5\wd\pgfnodepartoutputbox% + \advance\pgf@x by.5\wd\pgfnodeparttextbox% + \setlength{\pgf@y}{\pgfshapeinnerysep}% + \pgf@y=-2\pgf@y% + \advance\pgf@y by-\ht\pgfnodepartoutputbox% + \advance\pgf@y by-.5\pgflinewidth% + \advance\pgf@y by-\dp\pgfnodeparttextbox% + \advance\pgf@y by-.5\pgflinewidth% + } + + \saveddimen\radius{% + % + % Caculate ``height radius'' + % + \pgf@ya=.5\ht\pgfnodeparttextbox% + \advance\pgf@ya by.5\dp\pgfnodeparttextbox% + \advance\pgf@ya by.5\ht\pgfnodepartoutputbox% + \advance\pgf@ya by.5\dp\pgfnodepartoutputbox% + \advance\pgf@ya by.5\pgflinewidth% + \setlength\pgf@yb{\pgfshapeinnerysep}% + \advance\pgf@ya by2\pgf@yb% + % + % Caculate ``width radius'' + % + \pgf@xa=.5\wd\pgfnodeparttextbox% + \ifdim\pgf@xa<.5\wd\pgfnodepartoutputbox% + \pgf@xa=.5\wd\pgfnodepartoutputbox% + \fi% + \setlength\pgf@xb{\pgfshapeinnerxsep}% + \advance\pgf@xa by\pgf@xb% + % + % Calculate length of radius vector: + % + \pgf@process{\pgfpointnormalised{\pgfpoint{\pgf@xa}{\pgf@ya}}}% + \ifdim\pgf@x>\pgf@y% + \c@pgf@counta=\pgf@x% + \ifnum\c@pgf@counta=0\relax% + \else% + \divide\c@pgf@counta by 255\relax% + \pgf@xa=16\pgf@xa\relax% + \divide\pgf@xa by\c@pgf@counta% + \pgf@xa=16\pgf@xa\relax% + \fi% + \else% + \c@pgf@counta=\pgf@y% + \ifnum\c@pgf@counta=0\relax% + \else% + \divide\c@pgf@counta by 255\relax% + \pgf@ya=16\pgf@ya\relax% + \divide\pgf@ya by\c@pgf@counta% + \pgf@xa=16\pgf@ya\relax% + \fi% + \fi% + \pgf@x=\pgf@xa% + % + % If necessary, adjust radius so that the size requirements are + % met: + % + \setlength{\pgf@xb}{\pgfshapeminwidth}% + \setlength{\pgf@yb}{\pgfshapeminheight}% + \ifdim\pgf@x<.5\pgf@xb% + \pgf@x=.5\pgf@xb% + \fi% + \ifdim\pgf@x<.5\pgf@yb% + \pgf@x=.5\pgf@yb% + \fi% + % + % Now, add larger of outer sepearations. + % + \setlength{\pgf@xb}{\pgfshapeouterxsep}% + \setlength{\pgf@yb}{\pgfshapeouterysep}% + \ifdim\pgf@xb<\pgf@yb% + \advance\pgf@x by\pgf@yb% + \else% + \advance\pgf@x by\pgf@xb% + \fi% + } + + % + % Anchors + % + \inheritanchorborder[from=circle] + \inheritanchor[from=circle]{north} + \inheritanchor[from=circle]{north west} + \inheritanchor[from=circle]{north east} + \inheritanchor[from=circle]{center} + \inheritanchor[from=circle]{west} + \inheritanchor[from=circle]{east} + \inheritanchor[from=circle]{mid} + \inheritanchor[from=circle]{mid west} + \inheritanchor[from=circle]{mid east} + \inheritanchor[from=circle]{base} + \inheritanchor[from=circle]{base west} + \inheritanchor[from=circle]{base east} + \inheritanchor[from=circle]{south} + \inheritanchor[from=circle]{south west} + \inheritanchor[from=circle]{south east} + \anchor{output}{\outputanchor} + + % + % Background path + % + \inheritbackgroundpath[from=circle] + \beforebackgroundpath{ + \@tempdima=\radius% + \setlength{\pgf@xb}{\pgfshapeouterxsep}% + \setlength{\pgf@yb}{\pgfshapeouterysep}% + \ifdim\pgf@xb<\pgf@yb% + \advance\@tempdima by-\pgf@yb% + \else% + \advance\@tempdima by-\pgf@xb% + \fi% + \advance\@tempdima by-.5\pgflinewidth% + \pgfsetarrows{-}% + \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfpoint{-\@tempdima}{0pt}}}% + \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfpoint{\@tempdima}{0pt}}}% + \pgfusepath{stroke}% + } +} + + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex new file mode 100644 index 00000000000..7bbaa4b24bb --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex @@ -0,0 +1,450 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.3 2005/07/06 15:58:57 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +\newif\ifpgf@plot@started + + +% This handler converts each plot stream command into a curveto +% command, except for the first, which is converted to the previously +% specified action. +% +% Example: +% +% \pgfpathmoveto{\pgfpointorigin} +% \pgfsetlinetofirstplotpoint +% \pgfplothandlercurveto +% \pgfplotxyfile{mytable} + +\def\pgfplothandlercurveto{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@curveto@handler@initial% + \global\let\pgf@plotstreamspecial=\@gobble% + \global\let\pgf@plotstreamend=\pgf@plot@curveto@handler@finish% + \global\pgf@plot@startedfalse% + }% +} + +\def\pgf@plot@curveto@handler@initial#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@plot@first@action{\pgfpoint{\pgf@xa}{\pgf@ya}}% + \xdef\pgf@plot@curveto@first{\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}% + \global\let\pgf@plot@curveto@first@support=\pgf@plot@curveto@first% + \global\let\pgf@plotstreampoint=\pgf@plot@curveto@handler@second% +} + +\def\pgf@plot@curveto@handler@second#1{% + \pgf@process{#1}% + \xdef\pgf@plot@curveto@second{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + \global\let\pgf@plotstreampoint=\pgf@plot@curveto@handler@third% + \global\pgf@plot@startedtrue% +} + +\def\pgf@plot@curveto@handler@third#1{% + \pgf@process{#1}% + \xdef\pgf@plot@curveto@current{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + % compute difference vector: + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgf@plot@curveto@first} + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + % compute support directions: + \pgf@xa=\pgf@plottension\pgf@xa% + \pgf@ya=\pgf@plottension\pgf@ya% + % first marshal: + \pgf@process{\pgf@plot@curveto@second}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \advance\pgf@xc by\pgf@xa% + \advance\pgf@yc by\pgf@ya% + \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgf@plot@curveto@first@support}% + {\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgf@plot@curveto@second}}% + {\pgf@marshal}% + % Prepare next: + \global\let\pgf@plot@curveto@first=\pgf@plot@curveto@second% + \global\let\pgf@plot@curveto@second=\pgf@plot@curveto@current% + \xdef\pgf@plot@curveto@first@support{\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}% +} + +\def\pgf@plot@curveto@handler@finish{% + \ifpgf@plot@started% + \pgfpathcurveto{\pgf@plot@curveto@first@support}{\pgf@plot@curveto@second}{\pgf@plot@curveto@second}% + \fi% +} + + +% This commands sets the tension for smoothing of plots. +% +% #1 = tension of curves. A value of 1 will yield a circle when the +% control points are at quarters of a circle. A smaller value +% will result in a tighter curve. Default is 0.5. +% +% Example: +% +% \pgfsetplottension{0.2} + +\def\pgfsetplottension#1{% + \pgf@x=#1pt\relax% + \pgf@x=0.2775\pgf@x\relax% + \edef\pgf@plottension{\pgf@sys@tonumber\pgf@x}} +\pgfsetplottension{0.5} + + +% This handler converts the plot stream command into a curveto +% command that is closed using a closepath. +% +% Example: +% +% \pgfpathmoveto{\pgfpointorigin} +% \pgfplothandlerclosedcurve +% \pgfplotxyfile{mytable} + +\def\pgfplothandlerclosedcurve{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@initial% + \global\let\pgf@plotstreamspecial=\@gobble% + \global\let\pgf@plotstreamend=\pgf@plot@closedcurve@handler@finish% + }% +} + +\def\pgf@plot@closedcurve@handler@initial#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \xdef\pgf@plot@closedcurve@initial{\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}% + \global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@second% + \global\pgf@plot@startedfalse% +} + +\def\pgf@plot@closedcurve@handler@second#1{% + \pgf@process{#1}% + \xdef\pgf@plot@closedcurve@after@initial{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + {\pgfpathmoveto{}}% + \global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@third% +} + +\def\pgf@plot@closedcurve@handler@third#1{% + \global\pgf@plot@startedtrue% + \pgf@process{#1}% + \xdef\pgf@plot@closedcurve@current{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + % compute difference vector: + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgf@plot@closedcurve@initial} + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + % compute support directions: + \pgf@xa=\pgf@plottension\pgf@xa% + \pgf@ya=\pgf@plottension\pgf@ya% + % first marshal: + \pgf@process{\pgf@plot@closedcurve@after@initial}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \advance\pgf@xc by\pgf@xa% + \advance\pgf@yc by\pgf@ya% + \global\let\pgf@plot@closedcurve@first=\pgf@plot@closedcurve@after@initial% + \global\let\pgf@plot@closedcurve@second=\pgf@plot@closedcurve@current% + \xdef\pgf@plot@closedcurve@after@initial@presupport{\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}}% + \xdef\pgf@plot@closedcurve@first@support{\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}% + \global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@fourth% +} + +\def\pgf@plot@closedcurve@handler@fourth#1{% + \pgf@process{#1}% + \xdef\pgf@plot@closedcurve@current{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + % compute difference vector: + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgf@plot@closedcurve@first} + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + % compute support directions: + \pgf@xa=\pgf@plottension\pgf@xa% + \pgf@ya=\pgf@plottension\pgf@ya% + % first marshal: + \pgf@process{\pgf@plot@closedcurve@second}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \advance\pgf@xc by\pgf@xa% + \advance\pgf@yc by\pgf@ya% + \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgf@plot@closedcurve@first@support}% + {\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgf@plot@closedcurve@second}}% + {\pgf@marshal}% + % Prepare next: + \global\let\pgf@plot@closedcurve@first=\pgf@plot@closedcurve@second% + \global\let\pgf@plot@closedcurve@second=\pgf@plot@closedcurve@current% + \xdef\pgf@plot@closedcurve@first@support{\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}% +} + +\def\pgf@plot@closedcurve@handler@finish{% + \ifpgf@plot@started + % + % first, draw line from 2nd last to last: + % + \pgf@process{\pgf@plot@closedcurve@initial}% + % compute difference vector: + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgf@plot@closedcurve@first}% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + % compute support directions: + \pgf@xa=\pgf@plottension\pgf@xa% + \pgf@ya=\pgf@plottension\pgf@ya% + % first marshal: + \pgf@process{\pgf@plot@closedcurve@second}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \advance\pgf@xc by\pgf@xa% + \advance\pgf@yc by\pgf@ya% + \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgf@plot@closedcurve@first@support}% + {\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgf@plot@closedcurve@second}}% + {\pgf@marshal}% + \xdef\pgf@plot@closedcurve@first@support{\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}% + % + % second, draw line from last point to start: + % + \pgf@process{\pgf@plot@closedcurve@after@initial}% + % compute difference vector: + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgf@plot@closedcurve@second}% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + % compute support directions: + \pgf@xa=\pgf@plottension\pgf@xa% + \pgf@ya=\pgf@plottension\pgf@ya% + % first marshal: + \pgf@process{\pgf@plot@closedcurve@initial}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \advance\pgf@xc by\pgf@xa% + \advance\pgf@yc by\pgf@ya% + \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgf@plot@closedcurve@first@support}% + {\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgf@plot@closedcurve@initial}}% + {\pgf@marshal}% + % + % third, draw line from first to second point: + % + \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgf@plot@closedcurve@after@initial@presupport}{\noexpand\pgf@plot@closedcurve@after@initial}}% + {\pgf@marshal}% + \pgfpathclose% + \fi% +} + + + + + +% This handler converts each point in a stream into a line from the +% $y$-axis to the given points coordinate, resulting in a +% ``comb.'' +% +% Example: +% +% \pgfplothandlerxcomb +% \pgfplotxyfile{mytable} + +\def\pgfplothandlerxcomb{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@xcomb@handler% + \global\let\pgf@plotstreamspecial=\@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} + +\def\pgf@plot@xcomb@handler#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@ya}}% + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@ya}}% +} + + +% This handler converts each point in a stream into a line from the +% $x$-axis straight up to the given points coordinate, resulting in a +% ``comb.'' +% +% Example: +% +% \pgfplothandlerycomb +% \pgfplotxyfile{mytable} + +\def\pgfplothandlerycomb{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@ycomb@handler% + \global\let\pgf@plotstreamspecial=\@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} + +\def\pgf@plot@ycomb@handler#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgfpathmoveto{\pgfpoint{\pgf@xa}{0pt}}% + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@ya}}% +} + + + + + + +% This handler converts each point in a stream into a line from the +% origin to the point's coordinate, resulting in a ``star''. +% +% Example: +% +% \pgfplothandlerpolarcomb +% \pgfplotxyfile{mytable} + +\def\pgfplothandlerpolarcomb{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@polarcomb@handler% + \global\let\pgf@plotstreamspecial=\@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} + +\def\pgf@plot@polarcomb@handler#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgfpathmoveto{\pgfpointorigin}% + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@ya}}% +} + + + + +% This handler draws a given mark at each point. +% +% #1 = some code to be executed at each point (with the coordinate +% system translated to that point). +% Typically, this code will be \pgfuseplotmark{whatever}. +% +% Example: +% +% \pgfplothandlermark{\pgfuseplotmark{*}} +% \pgfplotxyfile{mytable} + +\def\pgfplothandlermark#1{% + \def\pgf@plot@mark{#1}% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@mark@handler% + \global\let\pgf@plotstreamspecial=\@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} + +\def\pgf@plot@mark@handler#1{% + {\pgftransformshift{#1}\pgf@plot@mark}% +} + + +% Define a new plot mark for use with \pgfplotmark. +% +% #1 = a plot mark mnemonic +% #2 = code for drawing the mark +% +% Example: +% +% \pgfdeclareplotmark{*}{\pgfpathcircle{\pgfpointorigin}{2pt}\pgfusepathqfill} + +\def\pgfdeclareplotmark#1#2{\expandafter\def\csname pgf@plot@mark@#1\endcsname{#2}} + + +% Set the size of plot marks. For circles, this will be the radius, +% for other shapes it should be about half the width/height. +% +% Example: +% +% \pgfsetplotmarksize{1pt} + +\def\pgfsetplotmarksize#1{\setlength\pgfplotmarksize{#1}} + +\newdimen\pgfplotmarksize +\pgfplotmarksize=2pt + + +% Insert a plot mark's code at the origin. +% +% #1 = plot mark mnemonic +% +% Example: +% +% \pgfuseplotmark{*} + +\def\pgfuseplotmark#1{\csname pgf@plot@mark@#1\endcsname} + + +% A stroke-filled circle mark + +\pgfdeclareplotmark{*} +{% + \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize} + \pgfusepathqfillstroke +} + + +% A plus-sign like mark + +\pgfdeclareplotmark{+} +{% + \pgfpathmoveto{\pgfpoint{-\pgfplotmarksize}{0pt}} + \pgfpathlineto{\pgfpoint{\pgfplotmarksize}{0pt}} + \pgfpathmoveto{\pgfpoint{0pt}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgfplotmarksize}} + \pgfusepathqstroke +} + + +% An x-shaped mark + +\pgfdeclareplotmark{x} +{% + \pgfpathmoveto{\pgfpoint{-.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}} + \pgfpathmoveto{\pgfpoint{-.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}} + \pgfusepathqstroke +} + +% See pgflibraryplotmarks for more plot marks + + + + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex new file mode 100644 index 00000000000..760998738b4 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplotmarks.code.tex @@ -0,0 +1,208 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplotmarks.code.tex,v 1.2 2005/07/06 15:58:57 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +% A stroked circle mark + +\pgfdeclareplotmark{o} +{% + \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize} + \pgfusepathqstroke +} + + + +% A six-pointed star mark + +\pgfdeclareplotmark{asterisk} +{% + \pgfpathmoveto{\pgfpoint{0pt}{-\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{0pt}{\pgfplotmarksize}} + \pgfpathmoveto{\pgfpointpolar{30}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{210}{\pgfplotmarksize}} + \pgfpathmoveto{\pgfpointpolar{-30}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{-210}{\pgfplotmarksize}} + \pgfusepathqstroke +} + + +% A five-pointed star mark + +\pgfdeclareplotmark{star} +{% + \pgfpathmoveto{\pgfpointorigin}\pgfpathlineto{\pgfpoint{0pt}{\pgfplotmarksize}} + \pgfpathmoveto{\pgfpointorigin}\pgfpathlineto{\pgfpointpolar{18}{\pgfplotmarksize}} + \pgfpathmoveto{\pgfpointorigin}\pgfpathlineto{\pgfpointpolar{-54}{\pgfplotmarksize}} + \pgfpathmoveto{\pgfpointorigin}\pgfpathlineto{\pgfpointpolar{234}{\pgfplotmarksize}} + \pgfpathmoveto{\pgfpointorigin}\pgfpathlineto{\pgfpointpolar{162}{\pgfplotmarksize}} + \pgfusepathqstroke +} + + +% An \oplus mark + +\pgfdeclareplotmark{oplus} +{% + \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize} + \pgfpathmoveto{\pgfpoint{-\pgfplotmarksize}{0pt}} + \pgfpathlineto{\pgfpoint{\pgfplotmarksize}{0pt}} + \pgfpathmoveto{\pgfpoint{0pt}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgfplotmarksize}} + \pgfusepathqstroke +} + +\pgfdeclareplotmark{oplus*} +{% + \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize} + \pgfpathmoveto{\pgfpoint{-\pgfplotmarksize}{0pt}} + \pgfpathlineto{\pgfpoint{\pgfplotmarksize}{0pt}} + \pgfpathmoveto{\pgfpoint{0pt}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgfplotmarksize}} + \pgfusepathqfillstroke +} + + +% An \otimes mark + +\pgfdeclareplotmark{otimes} +{% + \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize} + \pgfpathmoveto{\pgfpoint{-.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}} + \pgfpathmoveto{\pgfpoint{-.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}} + \pgfusepathqstroke +} + +\pgfdeclareplotmark{otimes*} +{% + \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize} + \pgfpathmoveto{\pgfpoint{-.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}} + \pgfpathmoveto{\pgfpoint{-.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}} + \pgfusepathqfillstroke +} + + +% A vertical bar mark + +\pgfdeclareplotmark{|} +{% + \pgfpathmoveto{\pgfpoint{0pt}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgfplotmarksize}} + \pgfusepathqstroke +} + + + +% A horizontal bar mark + +\pgfdeclareplotmark{-} +{% + \pgfpathmoveto{\pgfpoint{\pgfplotmarksize}{0pt}} + \pgfpathlineto{\pgfpoint{-\pgfplotmarksize}{0pt}} + \pgfusepathqstroke +} + + +% A square stroked mark + +\pgfdeclareplotmark{square} +{% + \pgfpathrectangle{\pgfpoint{-\pgfplotmarksize}{-\pgfplotmarksize}}{\pgfpoint{2\pgfplotmarksize}{2\pgfplotmarksize}}% + \pgfusepathqstroke +} + +% A square stroked-filled mark + +\pgfdeclareplotmark{square*} +{% + \pgfpathrectangle{\pgfpoint{-\pgfplotmarksize}{-\pgfplotmarksize}}{\pgfpoint{2\pgfplotmarksize}{2\pgfplotmarksize}}% + \pgfusepathqfillstroke +} + + +% A triangle mark + +\pgfdeclareplotmark{triangle} +{% + \pgfpathmoveto{\pgfpoint{0pt}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{-30}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{-150}{\pgfplotmarksize}} + \pgfpathclose + \pgfusepathqstroke +} + + +% A stroke-filled triangle mark + +\pgfdeclareplotmark{triangle*} +{% + \pgfpathmoveto{\pgfpoint{0pt}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{-30}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{-150}{\pgfplotmarksize}} + \pgfpathclose + \pgfusepathqfillstroke +} + + + +% A diamond-shaped mark + +\pgfdeclareplotmark{diamond} +{% + \pgfpathmoveto{\pgfpoint{0pt}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{.75\pgfplotmarksize}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{-.75\pgfplotmarksize}{0pt}} + \pgfpathclose + \pgfusepathqstroke +} + + +% A stroke-filled diamond-shaped mark + +\pgfdeclareplotmark{diamond*} +{% + \pgfpathmoveto{\pgfpoint{0pt}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{.75\pgfplotmarksize}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgfplotmarksize}} + \pgfpathlineto{\pgfpoint{-.75\pgfplotmarksize}{0pt}} + \pgfpathclose + \pgfusepathqfillstroke +} + + + +% A pentagon-shaped mark + +\pgfdeclareplotmark{pentagon} +{% + \pgfpathmoveto{\pgfpoint{0pt}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{18}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{-54}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{234}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{162}{\pgfplotmarksize}} + \pgfpathclose + \pgfusepathqstroke +} + +% A stroke-filled pentagon-shaped mark + +\pgfdeclareplotmark{pentagon*} +{% + \pgfpathmoveto{\pgfpoint{0pt}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{18}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{-54}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{234}{\pgfplotmarksize}} + \pgfpathlineto{\pgfpointpolar{162}{\pgfplotmarksize}} + \pgfpathclose + \pgfusepathqfillstroke +} + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.code.tex new file mode 100644 index 00000000000..2c777ef5504 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryshapes.code.tex @@ -0,0 +1,289 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryshapes.code.tex,v 1.5 2005/10/13 10:12:31 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +\pgfdeclareshape{ellipse} +% +% Draws a circle around the text +% +{ + \savedanchor\centerpoint{% + \pgf@x=.5\wd\pgfnodeparttextbox% + \pgf@y=.5\ht\pgfnodeparttextbox% + \advance\pgf@y by-.5\dp\pgfnodeparttextbox% + } + \savedanchor\radius{% + % + % Caculate ``height radius'' + % + \pgf@y=.5\ht\pgfnodeparttextbox% + \advance\pgf@y by.5\dp\pgfnodeparttextbox% + \setlength\pgf@yb{\pgfshapeinnerysep}% + \advance\pgf@y by\pgf@yb% + % + % Caculate ``width radius'' + % + \pgf@x=.5\wd\pgfnodeparttextbox% + \setlength\pgf@xb{\pgfshapeinnerxsep}% + \advance\pgf@x by\pgf@xb% + % + % Adjust + % + \pgf@x=1.4142136\pgf@x% + \pgf@y=1.4142136\pgf@y% + % + % Adjust hieght, if necessary + % + \setlength\pgf@yc{\pgfshapeminheight}% + \ifdim\pgf@y<.5\pgf@yc% + \pgf@y=.5\pgf@yc% + \fi% + % + % Adjust width, if necessary + % + \setlength\pgf@xc{\pgfshapeminwidth}% + \ifdim\pgf@x<.5\pgf@xc% + \pgf@x=.5\pgf@xc% + \fi% + % + % Add outer sep + % + \setlength{\pgf@xb}{\pgfshapeouterxsep}% + \setlength{\pgf@yb}{\pgfshapeouterysep}% + \advance\pgf@x by\pgf@xb% + \advance\pgf@y by\pgf@yb% + } + + % + % Anchors + % + \anchor{center}{\centerpoint} + \anchor{mid}{\centerpoint\setlength\pgf@y{.5ex}} + \anchor{base}{\centerpoint\pgf@y=0pt} + \anchor{north} + { + \pgf@process{\radius} + \pgf@ya=\pgf@y% + \pgf@process{\centerpoint} + \advance\pgf@y by\pgf@ya + } + \anchor{south} + { + \pgf@process{\radius} + \pgf@ya=\pgf@y% + \pgf@process{\centerpoint} + \advance\pgf@y by-\pgf@ya + } + \anchor{west} + { + \pgf@process{\radius} + \pgf@xa=\pgf@x% + \pgf@process{\centerpoint} + \advance\pgf@x by-\pgf@xa + } + \anchor{mid west} + {% + \pgf@process{\radius} + \pgf@xa=\pgf@x% + \pgf@process{\centerpoint} + \advance\pgf@x by-\pgf@xa% + \setlength\pgf@y{.5ex} + } + \anchor{base west} + {% + \pgf@process{\radius} + \pgf@xa=\pgf@x% + \pgf@process{\centerpoint} + \advance\pgf@x by-\pgf@xa% + \pgf@y=0pt + } + \anchor{north west} + { + \pgf@process{\radius} + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\centerpoint} + \advance\pgf@x by-0.707107\pgf@xa + \advance\pgf@y by0.707107\pgf@ya + } + \anchor{south west} + { + \pgf@process{\radius} + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\centerpoint} + \advance\pgf@x by-0.707107\pgf@xa + \advance\pgf@y by-0.707107\pgf@ya + } + \anchor{east} + {% + \pgf@process{\radius} + \pgf@xa=\pgf@x% + \pgf@process{\centerpoint} + \advance\pgf@x by\pgf@xa + } + \anchor{mid east} + {% + \pgf@process{\radius} + \pgf@xa=\pgf@x% + \pgf@process{\centerpoint} + \advance\pgf@x by\pgf@xa% + \setlength\pgf@y{.5ex} + } + \anchor{base east} + {% + \pgf@process{\radius} + \pgf@xa=\pgf@x% + \pgf@process{\centerpoint} + \advance\pgf@x by\pgf@xa% + \pgf@y=0pt + } + \anchor{north east} + { + \pgf@process{\radius} + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\centerpoint} + \advance\pgf@x by0.707107\pgf@xa + \advance\pgf@y by0.707107\pgf@ya + } + \anchor{south east} + { + \pgf@process{\radius} + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\centerpoint} + \advance\pgf@x by0.707107\pgf@xa + \advance\pgf@y by-0.707107\pgf@ya + } + \anchorborder{ + \edef\pgf@marshal{% + \noexpand\pgfpointborderellipse + {\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}} + {\noexpand\radius}% + }% + \pgf@marshal% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \centerpoint% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + } + + % + % Background path + % + \backgroundpath + { + \pgf@process{\radius}% + \@tempdima=\pgf@x% + \@tempdimb=\pgf@y% + \setlength{\pgf@xb}{\pgfshapeouterxsep}% + \setlength{\pgf@yb}{\pgfshapeouterysep}% + \advance\@tempdima by-\pgf@xb% + \advance\@tempdimb by-\pgf@yb% + \pgfpathellipse{\centerpoint}{\pgfpoint{\@tempdima}{0pt}}{\pgfpoint{0pt}{\@tempdimb}}% + } +} + + +\pgfdeclareshape{cross out} +{ + \inheritsavedanchors[from=rectangle] % this is nearly a rectangle + \inheritanchorborder[from=rectangle] + \inheritanchor[from=rectangle]{north} + \inheritanchor[from=rectangle]{north west} + \inheritanchor[from=rectangle]{north east} + \inheritanchor[from=rectangle]{center} + \inheritanchor[from=rectangle]{west} + \inheritanchor[from=rectangle]{east} + \inheritanchor[from=rectangle]{mid} + \inheritanchor[from=rectangle]{mid west} + \inheritanchor[from=rectangle]{mid east} + \inheritanchor[from=rectangle]{base} + \inheritanchor[from=rectangle]{base west} + \inheritanchor[from=rectangle]{base east} + \inheritanchor[from=rectangle]{south} + \inheritanchor[from=rectangle]{south west} + \inheritanchor[from=rectangle]{south east} + \foregroundpath{ + % store lower right in xa/ya and upper right in xb/yb + \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y + \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y + \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}} + \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}} + \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@yb}} + \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}} + } +} + + +\pgfdeclareshape{strike out} +{ + \inheritsavedanchors[from=rectangle] % this is nearly a rectangle + \inheritanchorborder[from=rectangle] + \inheritanchor[from=rectangle]{north} + \inheritanchor[from=rectangle]{north west} + \inheritanchor[from=rectangle]{north east} + \inheritanchor[from=rectangle]{center} + \inheritanchor[from=rectangle]{west} + \inheritanchor[from=rectangle]{east} + \inheritanchor[from=rectangle]{mid} + \inheritanchor[from=rectangle]{mid west} + \inheritanchor[from=rectangle]{mid east} + \inheritanchor[from=rectangle]{base} + \inheritanchor[from=rectangle]{base west} + \inheritanchor[from=rectangle]{base east} + \inheritanchor[from=rectangle]{south} + \inheritanchor[from=rectangle]{south west} + \inheritanchor[from=rectangle]{south east} + \foregroundpath{ + \pgfpathmoveto{\southwest} + \pgfpathlineto{\northeast} + } +} + + +\pgfdeclareshape{forbidden sign} +{ + \inheritsavedanchors[from=circle] % this is nearly a circle + \inheritanchorborder[from=circle] + \inheritanchor[from=circle]{north} + \inheritanchor[from=circle]{north west} + \inheritanchor[from=circle]{north east} + \inheritanchor[from=circle]{center} + \inheritanchor[from=circle]{west} + \inheritanchor[from=circle]{east} + \inheritanchor[from=circle]{mid} + \inheritanchor[from=circle]{mid west} + \inheritanchor[from=circle]{mid east} + \inheritanchor[from=circle]{base} + \inheritanchor[from=circle]{base west} + \inheritanchor[from=circle]{base east} + \inheritanchor[from=circle]{south} + \inheritanchor[from=circle]{south west} + \inheritanchor[from=circle]{south east} + \inheritbackgroundpath[from=circle] + \foregroundpath{ + \centerpoint% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \@tempdima=\radius% + \setlength{\pgf@xb}{\pgfshapeouterxsep}% + \setlength{\pgf@yb}{\pgfshapeouterysep}% + \ifdim\pgf@xb<\pgf@yb% + \advance\@tempdima by-\pgf@yb% + \else% + \advance\@tempdima by-\pgf@xb% + \fi% + \pgfpathmoveto{\pgfpointadd{\pgfpoint{\pgf@xc}{\pgf@yc}}{\pgfpoint{-0.707107\@tempdima}{-0.707107\@tempdima}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@xc}{\pgf@yc}}{\pgfpoint{0.707107\@tempdima}{0.707107\@tempdima}}} + } +} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysnakes.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysnakes.code.tex new file mode 100644 index 00000000000..3440477499e --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarysnakes.code.tex @@ -0,0 +1,369 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibrarysnakes.code.tex,v 1.9 2005/10/13 10:12:31 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +\newdimen\pgfsnakesegmentamplitude +\newdimen\pgfsnakesegmentlength +\def\pgfsnakesegmentangle{45} +\def\pgfsnakesegmentobjectlength{\pgfsnakesegmentamplitude} +\def\pgfsnakesegmentaspect{0.5} + +\pgfsnakesegmentlength=10pt +\pgfsnakesegmentamplitude=2.5pt + + + +% snake snake +% +% This snake produces a hopefully optically pleasing squiggly snake. +% +% Parameters: \pgfsnakesegmentamplitude, \pgfsnakesegmentlength + +\pgfdeclaresnake{snake}{initial} +{ + \state{initial}[switch if less than=.625\pgfsnakesegmentlength to final, + width=.3125\pgfsnakesegmentlength, + next state=down] + { + \pgfpathcurveto + {\pgfpoint{.125\pgfsnakesegmentlength}{0pt}} + {\pgfpoint{.1875\pgfsnakesegmentlength}{\pgfsnakesegmentamplitude}} + {\pgfpoint{.3125\pgfsnakesegmentlength}{\pgfsnakesegmentamplitude}} + } + \state{down}[switch if less than=.8125\pgfsnakesegmentlength to end down, + width=.5\pgfsnakesegmentlength, + next state=up] + { + \pgfpathcosine{\pgfpoint{.25\pgfsnakesegmentlength}{-\pgfsnakesegmentamplitude}} + \pgfpathsine{\pgfpoint{.25\pgfsnakesegmentlength}{-\pgfsnakesegmentamplitude}} + } + \state{up}[switch if less than=.8125\pgfsnakesegmentlength to end up, + width=.5\pgfsnakesegmentlength, + next state=down] + { + \pgfpathcosine{\pgfpoint{.25\pgfsnakesegmentlength}{\pgfsnakesegmentamplitude}} + \pgfpathsine{\pgfpoint{.25\pgfsnakesegmentlength}{\pgfsnakesegmentamplitude}} + } + \state{end down}[width=.3125\pgfsnakesegmentlength, + next state=final] + { + \pgfpathcurveto + {\pgfpoint{.125\pgfsnakesegmentlength}{\pgfsnakesegmentamplitude}} + {\pgfpoint{.1875\pgfsnakesegmentlength}{0pt}} + {\pgfpoint{.3125\pgfsnakesegmentlength}{0pt}} + } + \state{end up}[width=.3125\pgfsnakesegmentlength, + next state=final] + { + \pgfpathcurveto + {\pgfpoint{.125\pgfsnakesegmentlength}{-\pgfsnakesegmentamplitude}} + {\pgfpoint{.1875\pgfsnakesegmentlength}{0pt}} + {\pgfpoint{.3125\pgfsnakesegmentlength}{0pt}} + } + \state{final} + { \pgfpathlineto{\pgfpoint{\pgfsnakeremainingdistance}{0pt}} } +} + + + + +% zigzag snake +% +% Parameters: \pgfsnakesegmentamplitude, \pgfsnakesegmentlength + +\pgfdeclaresnake{zigzag}{up} +{ + \state{up}[width=.5\pgfsnakesegmentlength,% + next state=down] + { + \pgfpathlineto{\pgfpoint{.25\pgfsnakesegmentlength}{\pgfsnakesegmentamplitude}} + \pgfpathlineto{\pgfpoint{.5\pgfsnakesegmentlength}{0pt}} + } + \state{down}[width=.5\pgfsnakesegmentlength,% + next state=up] + { + \pgfpathlineto{\pgfpoint{.25\pgfsnakesegmentlength}{-\pgfsnakesegmentamplitude}} + \pgfpathlineto{\pgfpoint{.5\pgfsnakesegmentlength}{0pt}} + } + \state{final} + { \pgfpathlineto{\pgfpoint{\pgfsnakeremainingdistance}{0pt}} } +} + + + +% saw snake +% +% Parameters: \pgfsnakesegmentamplitude, \pgfsnakesegmentlength + +\pgfdeclaresnake{saw}{initial} +{ + \state{initial}[width=\pgfsnakesegmentlength] + { + \pgfpathlineto{\pgfpoint{\pgfsnakesegmentlength}{\pgfsnakesegmentamplitude}} + \pgfpathlineto{\pgfpoint{\pgfsnakesegmentlength}{0pt}} + } + \state{final} + { + \pgfpathlineto{\pgfpoint{\pgfsnakeremainingdistance}{0pt}} + } +} + + +% coil snake +% +% Parameters: \pgfsnakesegmentamplitude, \pgfsnakesegmentlength, + +\pgfdeclaresnake{coil}{coil} +{ + \state{coil}[switch if less than=% + 1.5\pgfsnakesegmentlength+% + \pgfsnakesegmentaspect\pgfsnakesegmentamplitude+% + \pgfsnakesegmentaspect\pgfsnakesegmentamplitude to last, + width=\pgfsnakesegmentlength] + { + \pgfpathcurveto + {\pgfpoint@oncoil{0 }{ 0.555}{1}} + {\pgfpoint@oncoil{0.445}{ 1 }{2}} + {\pgfpoint@oncoil{1 }{ 1 }{3}} + \pgfpathcurveto + {\pgfpoint@oncoil{1.555}{ 1 }{4}} + {\pgfpoint@oncoil{2 }{ 0.555}{5}} + {\pgfpoint@oncoil{2 }{ 0 }{6}} + \pgfpathcurveto + {\pgfpoint@oncoil{2 }{-0.555}{7}} + {\pgfpoint@oncoil{1.555}{-1 }{8}} + {\pgfpoint@oncoil{1 }{-1 }{9}} + \pgfpathcurveto + {\pgfpoint@oncoil{0.445}{-1 }{10}} + {\pgfpoint@oncoil{0 }{-0.555}{11}} + {\pgfpoint@oncoil{0 }{ 0 }{12}} + } + \state{last}[width=.5\pgfsnakesegmentlength+% + \pgfsnakesegmentaspect\pgfsnakesegmentamplitude+% + \pgfsnakesegmentaspect\pgfsnakesegmentamplitude,next state=final] + { + \pgfpathcurveto + {\pgfpoint@oncoil{0 }{ 0.555}{1}} + {\pgfpoint@oncoil{0.445}{ 1 }{2}} + {\pgfpoint@oncoil{1 }{ 1 }{3}} + \pgfpathcurveto + {\pgfpoint@oncoil{1.555}{ 1 }{4}} + {\pgfpoint@oncoil{2 }{ 0.555}{5}} + {\pgfpoint@oncoil{2 }{ 0 }{6}} + } + \state{final} + { + \pgfpathlineto{\pgfpoint{\pgfsnakeremainingdistance}{0pt}} + } +} + +\def\pgfpoint@oncoil#1#2#3{% + \pgf@x=#1\pgfsnakesegmentamplitude% + \pgf@x=\pgfsnakesegmentaspect\pgf@x% + \pgf@y=#2\pgfsnakesegmentamplitude% + \pgf@xa=0.083333333333\pgfsnakesegmentlength% + \advance\pgf@x by#3\pgf@xa% +} + + +% bumps snake +% +% Parameters: \pgfsnakesegmentamplitude, \pgfsnakesegmentlength + +\pgfdeclaresnake{bumps}{initial} +{ + \state{initial}[width=.5\pgfsnakesegmentlength] + { + \pgfpathcurveto + {\pgfpoint{0pt}{.555\pgfsnakesegmentamplitude}} + {\pgfpoint{0.11125\pgfsnakesegmentlength}{\pgfsnakesegmentamplitude}} + {\pgfpoint{.25\pgfsnakesegmentlength}{\pgfsnakesegmentamplitude}} + \pgfpathcurveto + {\pgfpoint{.38875\pgfsnakesegmentlength}{\pgfsnakesegmentamplitude}} + {\pgfpoint{.5\pgfsnakesegmentlength}{.5\pgfsnakesegmentamplitude}} + {\pgfpoint{.5\pgfsnakesegmentlength}{0\pgfsnakesegmentamplitude}} + } + \state{final} + { + \pgfpathlineto{\pgfpoint{\pgfsnakeremainingdistance}{0pt}} + } +} + + + +% expanding waves snake +% +% Parameters: \pgfsnakesegmentangle, \pgfsnakesegmentlength + +\pgfdeclaresnake{expanding waves}{initial} +{ + \state{initial}[width=\pgfsnakesegmentlength,next state=wave] + {} + + \state{wave}[switch if less than=\pgfsnakesegmentlength to last, + width=\pgfsnakesegmentlength] + { + \pgfpathmoveto{ + \pgfpointadd + {\pgfpoint{-\pgfsnakecompleteddistance}{0pt}}% + {\pgfpointpolar{\pgfsnakesegmentangle}{\pgfsnakecompleteddistance}}}% + \pgfpatharc{\pgfsnakesegmentangle}{-\pgfsnakesegmentangle}{\pgfsnakecompleteddistance}% + } + \state{last}[width=0pt,next state=final] + { + \pgfpathmoveto{ + \pgfpointadd + {\pgfpoint{-\pgfsnakecompleteddistance}{0pt}}% + {\pgfpointpolar{\pgfsnakesegmentangle}{\pgfsnakecompleteddistance}}}% + \pgfpatharc{\pgfsnakesegmentangle}{-\pgfsnakesegmentangle}{\pgfsnakecompleteddistance}% + } + \state{final} + { + \pgfpathmoveto{\pgfpoint{\pgfsnakeremainingdistance}{0pt}} + } +} + + + +% waves snake +% +% Parameters: \pgfsnakesegmentangle, \pgfsnakesegmentlength + +\pgfdeclaresnake{waves}{wave} +{ + \state{wave}[width=\pgfsnakesegmentlength] + { + \pgftransformxshift{\pgfsnakesegmentlength} + \pgfpathmoveto{ + \pgfpointadd + {\pgfpoint{-\pgfsnakesegmentobjectlength}{0pt}}% + {\pgfpointpolar{\pgfsnakesegmentangle}{\pgfsnakesegmentobjectlength}}}% + \pgfpatharc{\pgfsnakesegmentangle}{-\pgfsnakesegmentangle}{\pgfsnakesegmentobjectlength}% + } + \state{final} + { + \pgfpathmoveto{\pgfpoint{\pgfsnakeremainingdistance}{0pt}} + } +} + + +% triangle snakes +% +% Parameters: \pgfsnakesegmentlength, \pgfsnakeobjectsize, \pgfsnakesegmentamplitude + +\pgfdeclaresnake{triangles}{triangle} +{ + \state{triangle}[switch if less than=\pgfsnakesegmentlength to last, + width=\pgfsnakesegmentlength] + { + \pgfpathmoveto{\pgfpoint{0pt}{\pgfsnakesegmentamplitude}} + \pgfpathlineto{\pgfpoint{\pgfsnakesegmentobjectlength}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgfsnakesegmentamplitude}} + \pgfpathclose + } + \state{last}[width=\pgfsnakesegmentobjectlength,next state=final] + { + \pgfpathmoveto{\pgfpoint{0pt}{\pgfsnakesegmentamplitude}} + \pgfpathlineto{\pgfpoint{\pgfsnakesegmentobjectlength}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgfsnakesegmentamplitude}} + \pgfpathclose + } + \state{final} + { + \pgfpathmoveto{\pgfpoint{\pgfsnakeremainingdistance}{0pt}} + } +} + + + +% ticks snakes +% +% Parameters: \pgfsnakesegmentlength, \pgfsnakesegmentamplitude + +\pgfdeclaresnake{ticks}{ticks} +{ + \state{ticks}[width=\pgfsnakesegmentlength] + { + \pgfpathmoveto{\pgfpoint{0pt}{\pgfsnakesegmentamplitude}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgfsnakesegmentamplitude}} + } + \state{final} + { + \pgfpathmoveto{\pgfpoint{0pt}{\pgfsnakesegmentamplitude}} + \pgfpathlineto{\pgfpoint{0pt}{-\pgfsnakesegmentamplitude}} + \pgfpathmoveto{\pgfpoint{\pgfsnakeremainingdistance}{0pt}} + } +} + + +% border snake +% +% Parameters: \pgfsnakesegmentlength, \pgfsnakesegmentamplitude, \pgfsnakesegmentangle + +\pgfdeclaresnake{border}{tick} +{ + \state{tick}[switch if less than=\pgfsnakesegmentlength to last, + width=\pgfsnakesegmentlength] + { + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{\pgfsnakesegmentangle}{\pgfsnakesegmentamplitude}} + } + \state{last}[width=\pgfsnakesegmentamplitude,next state=final] + { + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{\pgfsnakesegmentangle}{\pgfsnakesegmentamplitude}} + } + \state{final} + { + \pgfpathmoveto{\pgfpoint{\pgfsnakeremainingdistance}{0pt}} + } +} + + + + +% brace snakes +% +% Parameters: \pgfsnakesegmentamplitude + +\pgfdeclaresnake{brace}{brace} +{ + \state{brace}[width=\pgfsnakeremainingdistance,next state=final] + { + \pgfpathmoveto{\pgfpoint{0pt}{0pt}} + \pgfpathcurveto + {\pgfpoint{.15\pgfsnakesegmentamplitude}{.3\pgfsnakesegmentamplitude}} + {\pgfpoint{.5\pgfsnakesegmentamplitude}{.5\pgfsnakesegmentamplitude}} + {\pgfpoint{\pgfsnakesegmentamplitude}{.5\pgfsnakesegmentamplitude}} + { + \pgftransformxshift{\pgfsnakesegmentaspect\pgfsnakeremainingdistance} + \pgfpathlineto{\pgfpoint{-\pgfsnakesegmentamplitude}{.5\pgfsnakesegmentamplitude}} + \pgfpathcurveto + {\pgfpoint{-.5\pgfsnakesegmentamplitude}{.5\pgfsnakesegmentamplitude}} + {\pgfpoint{-.15\pgfsnakesegmentamplitude}{.7\pgfsnakesegmentamplitude}} + {\pgfpoint{0\pgfsnakesegmentamplitude}{1\pgfsnakesegmentamplitude}} + \pgfpathcurveto + {\pgfpoint{.15\pgfsnakesegmentamplitude}{.7\pgfsnakesegmentamplitude}} + {\pgfpoint{.5\pgfsnakesegmentamplitude}{.5\pgfsnakesegmentamplitude}} + {\pgfpoint{\pgfsnakesegmentamplitude}{.5\pgfsnakesegmentamplitude}} + } + { + \pgftransformxshift{\pgfsnakeremainingdistance} + \pgfpathlineto{\pgfpoint{-\pgfsnakesegmentamplitude}{.5\pgfsnakesegmentamplitude}} + \pgfpathcurveto + {\pgfpoint{-.5\pgfsnakesegmentamplitude}{.5\pgfsnakesegmentamplitude}} + {\pgfpoint{-.15\pgfsnakesegmentamplitude}{.3\pgfsnakesegmentamplitude}} + {\pgfpoint{0pt}{0pt}} + } + } + \state{final} + {} +} + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarytikzbackgrounds.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarytikzbackgrounds.code.tex new file mode 100644 index 00000000000..260a8f9a28a --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarytikzbackgrounds.code.tex @@ -0,0 +1,131 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibrarytikzbackgrounds.code.tex,v 1.1 2005/08/13 18:59:56 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +% Layers + +\pgfdeclarelayer{background} +\pgfsetlayers{background,main} + + +% Main style + +\tikzstyle{background rectangle}= [draw] +\tikzstyle{background top}= [draw] +\tikzstyle{background bottom}= [draw] +\tikzstyle{background left}= [draw] +\tikzstyle{background right}= [draw] +\tikzstyle{background grid}= [help lines,draw] + +\define@key{tikz}{inner frame sep}{\def\tikz@framexsep{#1}\def\tikz@frameysep{#1}} +\define@key{tikz}{inner frame xsep}{\def\tikz@framexsep{#1}} +\define@key{tikz}{inerr frame ysep}{\def\tikz@frameysep{#1}} +\def\tikz@framexsep{1ex} +\def\tikz@frameysep{1ex} + +\define@key{tikz}{outer frame sep}{\def\tikz@outerframexsep{#1}\def\tikz@outerframeysep{#1}} +\define@key{tikz}{outer frame xsep}{\def\tikz@outerframexsep{#1}} +\define@key{tikz}{outer frame ysep}{\def\tikz@outerframeysep{#1}} +\def\tikz@outerframexsep{0ex} +\def\tikz@outerframeysep{0ex} + + +% Looseness + +\tikzstyle{loose background}= [inner frame sep=2ex] +\tikzstyle{tight background}= [inner frame sep=0ex] + + + +% Showing background styles + +\tikzstyle{framed}= [style=show background rectangle] +\tikzstyle{gridded}= [style=show background grid] + +\tikzstyle{show background rectangle}=[execute at end picture=\tikz@background@framed] +\tikzstyle{show background top}= [execute at end picture=\tikz@background@top] +\tikzstyle{show background bottom}= [execute at end picture=\tikz@background@bottom] +\tikzstyle{show background left}= [execute at end picture=\tikz@background@left] +\tikzstyle{show background right}= [execute at end picture=\tikz@background@right] +\tikzstyle{show background grid}= [execute at end picture=\tikz@background@grid] + + +% Implementation + +\def\tikz@background@save{% + \ifx\tikz@bg@minx\@undefined% + \pgf@xb=\pgf@picminx% + \pgf@yb=\pgf@picminy% + \pgf@xc=\pgf@picmaxx% + \pgf@yc=\pgf@picmaxy% + \setlength{\pgf@x}{\tikz@framexsep}% + \setlength{\pgf@y}{\tikz@frameysep}% + \advance\pgf@xb by-\pgf@x% + \advance\pgf@yb by-\pgf@y% + \advance\pgf@xc by\pgf@x% + \advance\pgf@yc by\pgf@y% + \edef\tikz@bg@minx{\the\pgf@xb}% + \edef\tikz@bg@miny{\the\pgf@yb}% + \edef\tikz@bg@maxx{\the\pgf@xc}% + \edef\tikz@bg@maxy{\the\pgf@yc}% + \setlength{\pgf@x}{\tikz@outerframexsep}% + \setlength{\pgf@y}{\tikz@outerframeysep}% + \advance\pgf@xb by-\pgf@x% + \advance\pgf@yb by-\pgf@y% + \advance\pgf@xc by\pgf@x% + \advance\pgf@yc by\pgf@y% + \edef\tikz@bg@outerminx{\the\pgf@xb}% + \edef\tikz@bg@outerminy{\the\pgf@yb}% + \edef\tikz@bg@outermaxx{\the\pgf@xc}% + \edef\tikz@bg@outermaxy{\the\pgf@yc}% + \fi% +} + +\def\tikz@background@framed{% + \tikz@background@save% + \pgfonlayer{background} + \path[style=background rectangle] (\tikz@bg@minx,\tikz@bg@miny) rectangle (\tikz@bg@maxx,\tikz@bg@maxy); + \endpgfonlayer +} + +\def\tikz@background@top{% + \tikz@background@save% + \pgfonlayer{background} + \path[style=background top] (\tikz@bg@outerminx,\tikz@bg@maxy) -- (\tikz@bg@outermaxx,\tikz@bg@maxy); + \endpgfonlayer +} + +\def\tikz@background@bottom{% + \tikz@background@save% + \pgfonlayer{background} + \path[style=background bottom] (\tikz@bg@outerminx,\tikz@bg@miny) -- (\tikz@bg@outermaxx,\tikz@bg@miny); + \endpgfonlayer +} + +\def\tikz@background@left{% + \tikz@background@save% + \pgfonlayer{background} + \path[style=background left] (\tikz@bg@minx,\tikz@bg@outerminy) -- (\tikz@bg@minx,\tikz@bg@outermaxy); + \endpgfonlayer +} + +\def\tikz@background@right{% + \tikz@background@save% + \pgfonlayer{background} + \path[style=background right] (\tikz@bg@maxx,\tikz@bg@outerminy) -- (\tikz@bg@maxx,\tikz@bg@outermaxy); + \endpgfonlayer +} + +\def\tikz@background@grid{% + \tikz@background@save% + \pgfonlayer{background} + \path[style=background grid] (\tikz@bg@minx,\tikz@bg@miny) grid (\tikz@bg@maxx,\tikz@bg@maxy); + \endpgfonlayer +} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarytikztrees.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarytikztrees.code.tex new file mode 100644 index 00000000000..8f472237604 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibrarytikztrees.code.tex @@ -0,0 +1,94 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibrarytikztrees.code.tex,v 1.4 2005/09/02 16:05:44 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + + +% +% Three point growth +% + +\define@key{tikz}{grow via three points}{\let\tikz@grow=\tikz@grow@three\tikz@parse@three#1} + +\def\tikz@parse@three one child at#1(#2)#3and two children at#4(#5)#6and#7(#8){% + \def\tikz@tree@one@child{\tikz@scan@one@point\pgf@process(#2)} + \def\tikz@tree@left@child{\tikz@scan@one@point\pgf@process(#5)} + \def\tikz@tree@right@child{\tikz@scan@one@point\pgf@process(#8)} +} + +\def\tikz@grow@three{% + \pgf@process{\tikz@tree@one@child}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\tikz@tree@left@child}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \pgf@process{\tikz@tree@right@child}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xc by-\pgf@xa% + \advance\pgf@yc by-\pgf@ya% + \advance\pgf@xc by-\pgf@xb% + \advance\pgf@yc by-\pgf@yb% + \advance\tikznumberofchildren by-1\relax% + \pgf@xb=\tikznumberofchildren\pgf@xb\relax% + \pgf@yb=\tikznumberofchildren\pgf@yb\relax% + \advance\tikznumberofcurrentchild by-1\relax% + \pgf@xc=\tikznumberofcurrentchild\pgf@xc\relax% + \pgf@yc=\tikznumberofcurrentchild\pgf@yc\relax% + \advance\pgf@xa by\pgf@xb% + \advance\pgf@xa by\pgf@xc% + \advance\pgf@ya by\pgf@yb% + \advance\pgf@ya by\pgf@yc% + \edef\pgf@temp{\noexpand\pgftransformshift{\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}}% + \pgf@temp% +} + +% +% Circle grow +% + +\tikzstyle{grow cyclic}=[growth function=\tikz@grow@circle] + +\define@key{tikz}{sibling angle}{\edef\tikz@sibling@angle{#1}} +\def\tikz@sibling@angle{20} + +\def\tikz@grow@circle{% + \c@pgf@counta=\tikz@sibling@angle\relax% + \c@pgf@countb=\tikz@sibling@angle\relax% + \divide\c@pgf@counta by2\relax% + \multiply\c@pgf@countb by\tikznumberofcurrentchild\relax% + \c@pgf@countc=-\c@pgf@counta\relax + \multiply\c@pgf@countc by\tikznumberofchildren\relax% + \advance\c@pgf@countc by-\c@pgf@counta\relax + \advance\c@pgf@countc by\c@pgf@countb\relax + \pgftransformrotate{\the\c@pgf@countc}% + \pgftransformxshift{\the\tikzleveldistance}% +} + + +% +% Connections +% + +\tikzstyle{edge from parent fork down}= + [edge from parent path={(\tikzparentnode\tikzparentanchor) -- +(0pt,-.5\tikzleveldistance) -| (\tikzchildnode\tikzchildanchor)}] + +\tikzstyle{edge from parent fork up}= + [edge from parent path={(\tikzparentnode\tikzparentanchor) -- +(0pt,.5\tikzleveldistance) -| (\tikzchildnode\tikzchildanchor)}] + +\tikzstyle{edge from parent fork left}= + [edge from parent path={(\tikzparentnode\tikzparentanchor) -- +(-.5\tikzleveldistance,0pt) |- (\tikzchildnode\tikzchildanchor)}] + +\tikzstyle{edge from parent fork right}= + [edge from parent path={(\tikzparentnode\tikzparentanchor) -- +(.5\tikzleveldistance,0pt) |- (\tikzchildnode\tikzchildanchor)}] + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg new file mode 100644 index 00000000000..a719fda2380 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg @@ -0,0 +1,23 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgf.cfg,v 1.1.1.1 2005/06/29 12:14:04 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + +% Default driver: +\ifx\pgfsysdriver\@undefined + \def\pgfsysdriver{pgfsys-\Gin@driver} +\fi + + +% Uncomment the following if you use dvipdfm and plain tex: +% \def\pgfsysdriver{pgfsys-dvipdfm.def} + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def new file mode 100644 index 00000000000..3f2c726beb8 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def @@ -0,0 +1,91 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-pdf.def,v 1.4 2005/10/18 18:03:38 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + + +% Driver commands for pdf + +% Path construction: +\def\pgfsys@lineto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{l}} +\def\pgfsys@moveto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{m}} +\def\pgfsys@curveto#1#2#3#4#5#6{% + \pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgf@sys@bp{#3}\pgf@sys@bp{#4}\pgf@sys@bp{#5}\pgf@sys@bp{#6}\pgfsysprotocol@literal{c}} +\def\pgfsys@rect#1#2#3#4{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgf@sys@bp{#3}\pgf@sys@bp{#4}\pgfsysprotocol@literal{re}} +\def\pgfsys@closepath{\pgfsysprotocol@literal{h}} + +% Path usage: +\def\pgfsys@stroke{\pgfsysprotocol@literal{S}} +\def\pgfsys@closestroke{\pgfsysprotocol@literal{s}} +\def\pgfsys@fill{\ifpgfsys@eorule\pgfsysprotocol@literal{f*}\else\pgfsysprotocol@literal{f}\fi} +\def\pgfsys@fillstroke{\ifpgfsys@eorule\pgfsysprotocol@literal{B*}\else\pgfsysprotocol@literal{B}\fi} +\def\pgfsys@clipnext{\ifpgfsys@eorule\pgfsysprotocol@literal{W*}\else\pgfsysprotocol@literal{W}\fi} +\def\pgfsys@discardpath{\pgfsysprotocol@literal{n}} + +% Transformation: +\def\pgfsys@transformcm#1#2#3#4#5#6{% + \pgfsysprotocol@literalbuffered{#1 #2 #3 #4}\pgf@sys@bp{#5}\pgf@sys@bp{#6}\pgfsysprotocol@literal{cm}} + +% Scopes +\def\pgfsys@beginscope{\pgfsysprotocol@literal{q}} +\def\pgfsys@endscope{\pgfsysprotocol@literal{Q}} + +% Graphics state +\def\pgfsys@setdash#1#2{% + \pgfsysprotocol@literalbuffered{[}% + \@for\pgf@sys@temp:={#1}\do{\pgf@sys@bp{\pgf@sys@temp}}% + \pgfsysprotocol@literalbuffered{]}% + \pgf@sys@bp{#2}\pgfsysprotocol@literal{d}} +\def\pgfsys@setlinewidth#1{\pgf@sys@bp{#1}\pgfsysprotocol@literal{w}} +\def\pgfsys@setmiterlimit#1{\pgfsysprotocol@literal{#1 M}} +\def\pgfsys@buttcap{\pgfsysprotocol@literal{0 J}} +\def\pgfsys@roundcap{\pgfsysprotocol@literal{1 J}} +\def\pgfsys@rectcap{\pgfsysprotocol@literal{2 J}} +\def\pgfsys@miterjoin{\pgfsysprotocol@literal{0 j}} +\def\pgfsys@roundjoin{\pgfsysprotocol@literal{1 j}} +\def\pgfsys@beveljoin{\pgfsysprotocol@literal{2 j}} +\def\pgfsys@color@rgb@stroke#1#2#3{\pgfsysprotocol@literal{#1 #2 #3 RG}} +\def\pgfsys@color@rgb@fill#1#2#3{\pgfsysprotocol@literal{#1 #2 #3 rg}} +\def\pgfsys@color@cmyk@stroke#1#2#3#4{\pgfsysprotocol@literal{#1 #2 #3 #4 K}} +\def\pgfsys@color@cmyk@fill#1#2#3#4{\pgfsysprotocol@literal{#1 #2 #3 #4 k}} +\def\pgfsys@color@cmy@stroke#1#2#3{\pgfsysprotocol@literal{#1 #2 #3 0 K}} +\def\pgfsys@color@cmy@fill#1#2#3{\pgfsysprotocol@literal{#1 #2 #3 0 k}} +\def\pgfsys@color@gray@stroke#1{\pgfsysprotocol@literal{#1 G}} +\def\pgfsys@color@gray@fill#1{\pgfsysprotocol@literal{#1 g}} + +% Opacity +\def\pgf@sys@pdf@addtopageresources#1{\pgf@sys@fail{adding to page resources}} +\def\pgf@sys@pdf@readdtopageresources#1{}% not always used +\def\pgfsys@stroke@opacity#1{% + \expandafter\ifx\csname pgf@sys@pdf@so@#1\endcsname\relax% + % Hmm... define... + \expandafter\gdef\csname pgf@sys@pdf@so@#1\endcsname{/pgf@CA#1}% + \pgf@sys@pdf@addtopageresources{/pgf@CA#1 << /CA #1 >>}% + \else% + \pgf@sys@pdf@readdtopageresources{/pgf@CA#1 << /CA #1 >>}% + \fi% + \pgfsysprotocol@literal{\csname pgf@sys@pdf@so@#1\endcsname\space gs}% +} +\def\pgfsys@fill@opacity#1{% + \expandafter\ifx\csname pgf@sys@pdf@fo@#1\endcsname\relax% + % Hmm... define... + \expandafter\gdef\csname pgf@sys@pdf@fo@#1\endcsname{/pgf@ca#1}% + \pgf@sys@pdf@addtopageresources{/pgf@ca#1 << /ca #1 >>}% + \else% + \pgf@sys@pdf@readdtopageresources{/pgf@ca#1 << /ca #1 >>}% + \fi% + \pgfsysprotocol@literal{\csname pgf@sys@pdf@fo@#1\endcsname\space gs}% +} + + + +\endinput + + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def new file mode 100644 index 00000000000..0f6981d04da --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def @@ -0,0 +1,155 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-postscript.def,v 1.6 2005/10/18 18:03:38 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + + +% Driver commands for postscript + +\newif\ifpgf@fillcolor +\newif\ifpgf@strokecolor +\newif\ifpgfsys@@clipnext + +% Path construction: +\def\pgfsys@lineto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{lineto}} +\def\pgfsys@moveto#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{moveto}} +\def\pgfsys@curveto#1#2#3#4#5#6{% + \pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgf@sys@bp{#3}\pgf@sys@bp{#4}\pgf@sys@bp{#5}\pgf@sys@bp{#6}\pgfsysprotocol@literal{curveto}} +\def\pgfsys@rect#1#2#3#4{\pgf@sys@bp{#4}\pgf@sys@bp{#3}\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{pgfe}} +\def\pgfsys@closepath{\pgfsysprotocol@literal{closepath}} + +% Path usage: +\def\pgfsys@stroke{% + \ifpgfsys@@clipnext% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{gsave pgfsc pgfstr grestore eoclip newpath}% + \else% + \pgfsysprotocol@literal{gsave pgfsc pgfstr grestore clip newpath}% + \fi% + \pgfsys@@clipnextfalse% + \else% + \ifpgf@strokecolor% + \pgfsysprotocol@literal{gsave pgfsc pgfstr grestore newpath}% + \else% + \pgfsysprotocol@literal{pgfstr}% + \fi% + \fi} +\def\pgfsys@fill{% + \ifpgfsys@@clipnext% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{gsave pgffc pgfeofill grestore eoclip newpath}% + \else% + \pgfsysprotocol@literal{gsave pgffc pgffill grestore clip newpath}% + \fi% + \pgfsys@@clipnextfalse% + \else% + \ifpgf@fillcolor% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{gsave pgffc pgfeofill grestore newpath}% + \else% + \pgfsysprotocol@literal{gsave pgffc pgffill grestore newpath}% + \fi% + \else% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{pgfeofill}% + \else% + \pgfsysprotocol@literal{pgffill}% + \fi% + \fi% + \fi} +\def\pgfsys@fillstroke{% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{gsave pgffc pgfeofill grestore gsave pgfsc pgfstr grestore}% + \else% + \pgfsysprotocol@literal{gsave pgffc pgffill grestore gsave pgfsc pgfstr grestore}% + \fi% + \ifpgfsys@@clipnext% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{eoclip}% + \else% + \pgfsysprotocol@literal{clip}% + \fi% + \pgfsys@@clipnextfalse% + \fi% + \pgfsysprotocol@literal{newpath}} +\def\pgfsys@clipnext{\pgfsys@@clipnexttrue} +\def\pgfsys@discardpath{% + \ifpgfsys@@clipnext% + \ifpgfsys@eorule% + \pgfsysprotocol@literal{eoclip}% + \else% + \pgfsysprotocol@literal{clip}% + \fi% + \pgfsys@@clipnextfalse% + \fi% + \pgfsysprotocol@literal{newpath}} + +% Transformation: +\def\pgfsys@transformshift#1#2{\pgf@sys@bp{#1}\pgf@sys@bp{#2}\pgfsysprotocol@literal{translate}} +\def\pgfsys@transformxyscale#1#2{\pgfsysprotocol@literal{#1 #2 scale}} +\def\pgfsys@transformcm#1#2#3#4#5#6{% + \pgfsysprotocol@literalbuffered{[#1 #2 #3 #4}\pgf@sys@bp{#5}\pgf@sys@bp{#6}\pgfsysprotocol@literal{] concat}} + +% Scopes +\def\pgfsys@beginscope{\pgfsysprotocol@literal{save}} +\def\pgfsys@endscope{\pgfsysprotocol@literal{restore}} + +% Graphics state +\def\pgfsys@setdash#1#2{% + \pgfsysprotocol@literalbuffered{[}% + \@for\pgf@sys@temp:={#1}\do{\pgf@sys@bp{\pgf@sys@temp}}% + \pgfsysprotocol@literalbuffered{]}% + \pgf@sys@bp{#2}\pgfsysprotocol@literal{setdash}} +\def\pgfsys@setlinewidth#1{\pgf@sys@bp{#1}\pgfsysprotocol@literal{pgfw}} +\def\pgfsys@setmiterlimit#1{\pgfsysprotocol@literal{#1 setmiterlimit}} +\def\pgfsys@buttcap{\pgfsysprotocol@literal{0 setlinecap}} +\def\pgfsys@roundcap{\pgfsysprotocol@literal{1 setlinecap}} +\def\pgfsys@rectcap{\pgfsysprotocol@literal{2 setlinecap}} +\def\pgfsys@miterjoin{\pgfsysprotocol@literal{0 setlinejoin}} +\def\pgfsys@roundjoin{\pgfsysprotocol@literal{1 setlinejoin}} +\def\pgfsys@beveljoin{\pgfsysprotocol@literal{2 setlinejoin}} +\def\pgfsys@color@rgb@stroke#1#2#3{\pgfsysprotocol@literal{/pgfsc{#1 #2 #3 setrgbcolor}def}\pgf@strokecolortrue} +\def\pgfsys@color@rgb@fill#1#2#3{\pgfsysprotocol@literal{/pgffc{#1 #2 #3 setrgbcolor}def}\pgf@fillcolortrue} +\def\pgfsys@color@rgb#1#2#3{\pgfsys@color@reset\pgfsysprotocol@literal{#1 #2 #3 setrgbcolor}} +\def\pgfsys@color@cmyk@stroke#1#2#3#4{\pgfsysprotocol@literal{/pgfsc{#1 #2 #3 #4 setcmykcolor}def}\pgf@strokecolortrue} +\def\pgfsys@color@cmyk@fill#1#2#3#4{\pgfsysprotocol@literal{/pgffc{#1 #2 #3 #4 setcmykcolor}def}\pgf@fillcolortrue} +\def\pgfsys@color@cmyk#1#2#3#4{\pgfsys@color@reset\pgfsysprotocol@literal{#1 #2 #3 #4 setcmykcolor}} +\def\pgfsys@color@cmy@stroke#1#2#3{\pgfsysprotocol@literal{/pgfsc{#1 #2 #3 0 setcmykcolor}def}\pgf@strokecolortrue} +\def\pgfsys@color@cmy@fill#1#2#3{\pgfsysprotocol@literal{/pgffc{#1 #2 #3 0 setcmykcolor}def}\pgf@fillcolortrue} +\def\pgfsys@color@cmy#1#2#3{\pgfsys@color@reset\pgfsysprotocol@literal{#1 #2 #3 0 setcmykcolor}} +\def\pgfsys@color@gray@stroke#1{\pgfsysprotocol@literal{/pgfsc{#1 setgray}def}\pgf@strokecolortrue} +\def\pgfsys@color@gray@fill#1{\pgfsysprotocol@literal{/pgffc{#1 setgray}def}\pgf@fillcolortrue} +\def\pgfsys@color@gray#1{\pgfsys@color@reset\pgfsysprotocol@literal{#1 setgray}} +\def\pgfsysps@color@resetnow{\pgfsysprotocol@literal{/pgfsc{}def/pgffc{}def}\pgf@strokecolorfalse\pgf@fillcolorfalse}% +\def\pgfsys@color@reset{% + \ifpgfsys@color@reset@inorder% + \ifpgf@strokecolor% + \pgfsysps@color@resetnow% + \else% + \ifpgf@fillcolor% + \pgfsysps@color@resetnow% + \fi% + \fi% + \else% + \pgfsysps@color@resetnow% + \fi} + + +% Opacity + +\def\pgfsys@fill@opacity#1{% + \pgfsysprotocol@literal{#1 .pgfsetfillopacityalpha} +} +\def\pgfsys@stroke@opacity#1{% + \pgfsysprotocol@literal{#1 .pgfsetstrokeopacityalpha} +} + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def new file mode 100644 index 00000000000..19a98a6bf60 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def @@ -0,0 +1,353 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-common-svg.def,v 1.12 2005/10/06 13:16:09 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + + +% Driver commands for svg + + +% Helping functions: +\let\pgf@sys@svgpath=\@empty +\def\pgf@sys@svgnum#1{% + {% + \pgf@x=#1\relax% + \edef\temp{\expandafter\Pgf@geT\the\pgf@x\space}% + \toks@\expandafter\expandafter\expandafter{\expandafter\pgf@sys@svgpath\temp}% + \xdef\pgf@sys@svgpath{\the\toks@}% + }% +} +\def\pgf@sys@addtosvgpath#1{\g@addto@macro\pgf@sys@svgpath{#1\space}} +\def\pgf@sys@flushsvgpath{\pgfsysprotocol@literal{\pgf@sys@svgpath}\global\let\pgf@sys@svgpath=\@empty} +\def\pgf@sys@svg@gs#1{% + {\pgfsysprotocol@literal{\Hnewline }}\global\advance\pgf@sys@svg@scopecount by1\relax% +} +\newcount\pgf@sys@svg@objectcount +\let\Hnewline=\@empty + +% Path construction: +\def\pgfsys@lineto#1#2{\pgf@sys@addtosvgpath{L }\pgf@sys@svgnum{#1}\pgf@sys@svgnum{#2}} +\def\pgfsys@moveto#1#2{\pgf@sys@addtosvgpath{M }\pgf@sys@svgnum{#1}\pgf@sys@svgnum{#2}} +\def\pgfsys@curveto#1#2#3#4#5#6{% + \pgf@sys@addtosvgpath{C }% + \pgf@sys@svgnum{#1}\pgf@sys@svgnum{#2}% + \pgf@sys@svgnum{#3}\pgf@sys@svgnum{#4}% + \pgf@sys@svgnum{#5}\pgf@sys@svgnum{#6}} +\def\pgfsys@rect#1#2#3#4{% + \pgfsys@moveto{#1}{#2}% + \pgf@sys@addtosvgpath{h }\pgf@sys@svgnum{#3}% + \pgf@sys@addtosvgpath{v }\pgf@sys@svgnum{#4}% + \pgf@sys@addtosvgpath{h }{\pgf@x=#3\pgf@x=-\pgf@x\pgf@sys@svgnum{\pgf@x}}% + \pgfsys@closepath} +\def\pgfsys@closepath{\pgf@sys@addtosvgpath{Z}} + +% Path usage: +\newif\ifpgf@sys@svg@clipnext +\def\pgf@sys@svg@possiblyclippedpath#1{% + \ifpgf@sys@svg@clipnext% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgfsysprotocol@literal{ + \Hnewline \Hnewline } + \pgfsysprotocol@literal{\Hnewline }% + \pgf@sys@svg@gs{clip-path="url(\#pgfcp\the\pgf@sys@svg@objectcount)"} + \pgf@sys@svg@clipnextfalse% + \else% + \pgfsysprotocol@literal{\Hnewline } + \fi% +} +\def\pgfsys@stroke{\pgf@sys@svg@possiblyclippedpath{style="fill:none"}} +\def\pgfsys@fill{\pgf@sys@svg@possiblyclippedpath{style="stroke:none"}} +\def\pgfsys@fillstroke{\pgf@sys@svg@possiblyclippedpath{}} +\def\pgfsys@clipnext{\pgf@sys@svg@clipnexttrue} +\def\pgfsys@discardpath{% + \ifpgf@sys@svg@clipnext% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgfsysprotocol@literal{ + \Hnewline \Hnewline } + \pgf@sys@svg@gs{clip-path="url(\#pgfcp\the\pgf@sys@svg@objectcount)"} + \pgf@sys@svg@clipnextfalse% + \else% + \global\let\pgf@sys@svgpath=\@empty + \fi} + +% Fill rules: +\def\pgfsys@eoruletrue{\pgf@sys@svg@gs{fill-rule="evenodd"}} +\def\pgfsys@eorulefalse{\pgf@sys@svg@gs{fill-rule="nonzero"}} + +% Transparency: +\def\pgfsys@stroke@opacity#1{\pgf@sys@svg@gs{stroke-opacity="#1"}} +\def\pgfsys@fill@opacity#1{\pgf@sys@svg@gs{fill-opacity="#1"}} + +% Transformation: +\def\pgfsys@transformcm#1#2#3#4#5#6{% + {\pgf@x=#5\pgf@y=#6% + \pgf@sys@svg@gs{transform="matrix(#1,#2,#3,#4,\pgf@sys@tonumber{\pgf@x},\pgf@sys@tonumber{\pgf@y})"}}} + +% Scopes +\newcount\pgf@sys@svg@scopecount +\def\pgfsys@beginscope{% + \edef\pgf@sys@svg@thescopecount{\the\pgf@sys@svg@scopecount}% + \begingroup% + \pgf@sys@svg@scopecount=1\relax% + \pgfsysprotocol@literal{\Hnewline }% + } +\def\pgfsys@endscope{% + \loop% + \pgfsysprotocol@literal{\Hnewline }% + \advance\pgf@sys@svg@scopecount by-1\relax% + \ifnum\pgf@sys@svg@scopecount>0\relax% + \repeat% + \endgroup% + \global\pgf@sys@svg@scopecount=\pgf@sys@svg@thescopecount\relax% +} + +% Graphics state +\def\pgfsys@setdash#1#2{% + \edef\pgf@test@dashpattern{#1}% + \ifx\pgf@test@dashpattern\@empty% + \pgf@sys@svg@gs{stroke-dasharray="none" stroke-dashoffset="#2"}% + \else% + \pgf@sys@svg@gs{stroke-dasharray="#1" stroke-dashoffset="#2"}% + \fi} +\def\pgfsys@setlinewidth#1{\pgf@sys@svg@gs{stroke-width="#1"}} +\def\pgfsys@setmiterlimit#1{\pgf@sys@svg@gs{stroke-miterlimit="#1"}} +\def\pgfsys@buttcap{\pgf@sys@svg@gs{stroke-linecap="butt"}} +\def\pgfsys@roundcap{\pgf@sys@svg@gs{stroke-linecap="round"}} +\def\pgfsys@rectcap{\pgf@sys@svg@gs{stroke-linecap="square"}} +\def\pgfsys@miterjoin{\pgf@sys@svg@gs{stroke-linejoin="miter"}} +\def\pgfsys@roundjoin{\pgf@sys@svg@gs{stroke-linejoin="round"}} +\def\pgfsys@beveljoin{\pgf@sys@svg@gs{stroke-linejoin="bevel"}} + + +% +% Color management +% + +\def\XC@mcolor{\ifpgfpicture\pgfsetcolor{.}\fi} + +\def\pgf@sys@svg@color@rgb#1,#2,#3\relax{% + {% + \pgf@xa=#1pt% + \pgf@xa=100\pgf@xa% + \pgf@xb=#2pt% + \pgf@xb=100\pgf@xb% + \pgf@xc=#3pt% + \pgf@xc=100\pgf@xc% + \xdef\pgf@sys@svg@prepared{rgb(\pgf@sys@tonumber\pgf@xa\%,\pgf@sys@tonumber\pgf@xb\%,\pgf@sys@tonumber\pgf@xc\%)}% + }% +} +\def\pgf@sys@svg@color@cmy#1,#2,#3\relax{% + {% + \pgf@xa=1pt% + \advance\pgf@xa by-#1pt% + \pgf@xa=100\pgf@xa% + \pgf@xb=1pt% + \advance\pgf@xb by-#2pt% + \pgf@xb=100\pgf@xb% + \pgf@xc=1pt% + \advance\pgf@xc by-#3pt% + \pgf@xc=100\pgf@xc% + \xdef\pgf@sys@svg@prepared{rgb(\pgf@sys@tonumber\pgf@xa\%,\pgf@sys@tonumber\pgf@xb\%,\pgf@sys@tonumber\pgf@xc\%)}% + }% +} +\def\pgf@sys@svg@color@cmyk#1,#2,#3,#4\relax{% + {% + \pgf@xa=1pt% + \advance\pgf@xa by-#4pt% + \pgf@xa=#1\pgf@xa% + \advance\pgf@xa by#4pt% + \advance\pgf@xa by-1pt% + \pgf@xa=-100\pgf@xa% + \pgf@xb=1pt% + \advance\pgf@xb by-#4pt% + \pgf@xb=#2\pgf@xb% + \advance\pgf@xb by#4pt% + \advance\pgf@xb by-1pt% + \pgf@xb=-100\pgf@xb% + \pgf@xc=1pt% + \advance\pgf@xc by-#4pt% + \pgf@xc=#3\pgf@xc% + \advance\pgf@xc by#4pt% + \advance\pgf@xc by-1pt% + \pgf@xc=-100\pgf@xc% + \xdef\pgf@sys@svg@prepared{rgb(\pgf@sys@tonumber\pgf@xa\%,\pgf@sys@tonumber\pgf@xb\%,\pgf@sys@tonumber\pgf@xc\%)}% + }% +} +\def\pgf@sys@svg@color@gray#1\relax{% + {% + \pgf@xa=#1pt% + \pgf@xa=100\pgf@xa% + \xdef\pgf@sys@svg@prepared{rgb(\pgf@sys@tonumber\pgf@xa\%,\pgf@sys@tonumber\pgf@xa\%,\pgf@sys@tonumber\pgf@xa\%)}% + }% +} + +\def\pgfsys@color@rgb@stroke#1#2#3{% + \pgf@sys@svg@color@rgb#1,#2,#3\relax% + \pgf@sys@svg@gs{stroke="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@rgb@fill#1#2#3{% + \pgf@sys@svg@color@rgb#1,#2,#3\relax% + \pgf@sys@svg@gs{fill="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@cmyk@stroke#1#2#3#4{% + \pgf@sys@svg@color@cmyk#1,#2,#3,#4\relax% + \pgf@sys@svg@gs{stroke="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@cmyk@fill#1#2#3#4{% + \pgf@sys@svg@color@cmyk#1,#2,#3,#4\relax% + \pgf@sys@svg@gs{fill="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@cmy@stroke#1#2#3{% + \pgf@sys@svg@color@cmy#1,#2,#3\relax% + \pgf@sys@svg@gs{stroke="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@cmy@fill#1#2#3{% + \pgf@sys@svg@color@cmy#1,#2,#3\relax% + \pgf@sys@svg@gs{fill="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@gray@stroke#1{% + \pgf@sys@svg@color@gray#1\relax% + \pgf@sys@svg@gs{stroke="\pgf@sys@svg@prepared"}} +\def\pgfsys@color@gray@fill#1{% + \pgf@sys@svg@color@gray#1\relax% + \pgf@sys@svg@gs{fill="\pgf@sys@svg@prepared"}} + + +% Shadings: +\def\pgf@sys@svg@shading@stops{% + % Step 1: Compute 1/\pgf@sys@shading@end@pos + \pgf@x=\pgf@sys@shading@end@pos\relax% + \c@pgf@counta=\pgf@x\relax% + \divide\c@pgf@counta by4096\relax% + % Step 2: Insert stops. + \expandafter\pgf@sys@svg@shading@dostops\pgf@sys@shading@ranges% + % dummy for end: + {{\pgf@sys@shading@end@pos}{\pgf@sys@shading@end@pos}{\pgf@sys@shading@end@rgb}{\pgf@sys@shading@end@rgb}}% + {}% end +} +\def\pgf@sys@svg@shading@dostops#1{% + \edef\pgf@test{#1}% + \ifx\pgf@test\@empty% + \else% + \expandafter\pgf@sys@svg@shading@dostop\pgf@test% + \expandafter\pgf@sys@svg@shading@dostops% + \fi% +} +\def\pgf@sys@svg@shading@dostop#1#2#3#4{% + % #1 start pos + % #2 end pos + % #3 start rgb + % #4 end rgb + \pgf@sys@svg@addtostops{\noexpand\Hnewline}% +} +\def\pgf@sys@svg@shading@dorgb#1#2#3{% + \pgf@sys@svg@color@rgb#1,#2,#3\relax% + \pgf@sys@svg@addtostops{\pgf@sys@svg@prepared}% +} + +\let\pgf@sys@svg@thestops=\@empty +\def\pgf@sys@svg@addtostops#1{% + \edef\pgf@temp{#1}% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter\pgf@sys@svg@thestops + \expandafter\expandafter\expandafter{\expandafter\pgf@sys@svg@thestops\expandafter\space\pgf@temp}% +} + + +\def\pgfsys@horishading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgf@sys@svg@addtostops{\noexpand\Hnewline} + \pgf@sys@svg@shading@stops% + \pgf@sys@svg@addtostops{\noexpand\Hnewline}% + \pgf@process{\pgfpoint{\pgf@sys@shading@end@pos}{#2}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \def\noexpand\pgf@sys@svg@sh@defs{\noexpand\pgfsysprotocol@literal{\pgf@sys@svg@thestops}}% + \def\noexpand\pgf@sys@svg@sh{\noexpand\pgfsysprotocol@literal{\noexpand\Hnewline}}% + \def\noexpand\pgf@sys@svg@pos{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + }% + }% +} + + +\def\pgfsys@vertshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgf@sys@svg@addtostops{\noexpand\Hnewline} + \pgf@sys@svg@shading@stops% + \pgf@sys@svg@addtostops{\noexpand\Hnewline}% + \pgf@process{\pgfpoint{\pgf@sys@shading@end@pos}{#2}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \def\noexpand\pgf@sys@svg@sh@defs{\noexpand\pgfsysprotocol@literal{\pgf@sys@svg@thestops}}% + \def\noexpand\pgf@sys@svg@sh{\noexpand\pgfsysprotocol@literal{\noexpand\Hnewline}}% + \def\noexpand\pgf@sys@svg@pos{\noexpand\pgfpoint{\the\pgf@y}{\the\pgf@x}}% + }% + }% +} + +\def\pgfsys@radialshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgf@x=\pgf@sys@shading@end@pos\relax% + \c@pgf@counta=\pgf@x\relax% + \divide\c@pgf@counta by4096\relax% + \global\advance\pgf@sys@svg@objectcount by1\relax% + \pgf@process{#2}% + % Divide by 2\pgf@sys@shading@end@pos% + \pgf@x=8\pgf@x% + \divide\pgf@x by \c@pgf@counta\relax% + \pgf@y=8\pgf@y% + \divide\pgf@y by \c@pgf@counta\relax% + \advance\pgf@x by.5pt% + \advance\pgf@y by.5pt% + \pgf@sys@svg@addtostops{\noexpand\Hnewline} + \pgf@sys@svg@shading@stops% + \pgf@sys@svg@addtostops{\noexpand\Hnewline}% + \pgf@xa=\pgf@sys@shading@end@pos% + \pgf@xb=2\pgf@xa% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \def\noexpand\pgf@sys@svg@sh@defs{\noexpand\pgfsysprotocol@literal{\pgf@sys@svg@thestops}}% + \def\noexpand\pgf@sys@svg@sh{\noexpand\pgfsysprotocol@literal{\noexpand\Hnewline}}% + \def\noexpand\pgf@sys@svg@pos{\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@xb}}% + }% + }% +} + + +\endinput + + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def new file mode 100644 index 00000000000..224197f9b51 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def @@ -0,0 +1,131 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-dvipdfm.def,v 1.7 2005/09/30 07:14:03 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + + +% Driver commands for dvipdfm + +% +% Load common pdf commands: +% +\input pgfsys-common-pdf.def + +% +% dvipdfm-specific stuff: +% +\def\pgfsys@invoke#1{\special{pdf: content Q #1 q}} + +\def\pgfsys@hbox#1{% + \special{pdf: content Q q -1 0 0 -1 0 0 cm q}% + \special{pdf: content -1 0 0 -1 0 0 cm q}% translate to original coordinate system + \special{pdf: content 0 0 m W n q}% clip next stuff + {\hbox to 0pt{\pgf@selectfontorig.\hss}}% enforce font change + \special{pdf: content Q}% end of font change enforcement. + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \box#1 + \special{pdf: content Q n Q}% +} +\def\pgfsys@beginpicture{% + \pgfsys@invoke{1 0 0 1 2000 2000 cm}% + \hbox to 0pt{\selectfont.\hss}% + \pgfsys@invoke{1 0 0 1 -2000 -2000 cm}% + \special{pdf: content q}} +\def\pgfsys@endpicture{% + \special{pdf: content n Q}% +} +\def\pgfsys@beginpurepicture{\special{pdf: content q}} + + +\def\pgf@sys@pdf@addtopageresources#1{% + \ifx\pgf@sys@pdf@obj\@undefined% + \global\let\pgf@sys@pdf@obj=\relax% + \special{pdf: obj @pgfopacities << >>}% + \fi% + \special{pdf: put @pgfopacities << #1 >>}% + \special{pdf: put @resources << /ExtGState @pgfopacities >>}% +} +\def\pgf@sys@pdf@readdtopageresources#1{% + \special{pdf: put @resources << /ExtGState @pgfopacities >>}% +} + +\def\pgfsys@imagesuffixlist{pdf:jpg:jpeg:png} +\def\pgfsys@horishading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgf@process{\pgfpoint{\pgf@max}{#2}}% + \edef\@temp{\noexpand\pgf@sys@atbeginpage{\special{pdf: beginxobj @pgfshade#1 width \the\pgf@max\space height \the\pgf@y}}}\@temp% + \edef\@temp{\noexpand\pgf@sys@atbeginpage{\special{pdf: put @resources << + /Shading << /Sh << /ShadingType 2 + /ColorSpace /DeviceRGB + /Domain [\pgf@pdfparseddomain] + /Coords [\pgf@doma\space0 \pgf@domb\space0] + /Function \pgf@pdfparsedfunction + /Extend [false false] >> >> >>}}}\@temp% + \pgf@sys@atbeginpage{\special{pdf: content /Sh sh}% + \special{pdf: endxobj}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \hbox to\the\pgf@max{\vbox to#2{\vfil\special{pdf: usexobj @pgfshade#1}}\hfil}}% + }% +} +\def\pgfsys@vertshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgf@process{\pgfpoint{\pgf@max}{#2}}% + \edef\@temp{\noexpand\pgf@sys@atbeginpage{\special{pdf: beginxobj @pgfshade#1 width \the\pgf@y\space height \the\pgf@max\space}}}\@temp% + \edef\@temp{\noexpand\pgf@sys@atbeginpage{\special{pdf: put @resources << + /Shading << /Sh << /ShadingType 2 + /ColorSpace /DeviceRGB + /Domain [\pgf@pdfparseddomain] + /Coords [0 \pgf@doma\space0 \pgf@domb] + /Function \pgf@pdfparsedfunction + /Extend [false false] >> >> >>}}}\@temp% + \pgf@sys@atbeginpage{\special{pdf: content /Sh sh}% + \special{pdf: endxobj}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \hbox to#2{\vbox to\the\pgf@max{\vfil\special{pdf: usexobj @pgfshade#1}}\hfil}}% + }% +} +\def\pgfsys@radialshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgfpoint{\pgf@max}{\pgf@max}}% + \advance\pgf@xa by \pgf@x\relax% + \advance\pgf@ya by \pgf@y\relax% + \@tempdima=2\pgf@max\relax% + \edef\@temp{\noexpand\pgf@sys@atbeginpage{\special{pdf: beginxobj @pgfshade#1 width \the\@tempdima\space height \the\@tempdima}}}\@temp% + \edef\@temp{\noexpand\pgf@sys@atbeginpage{\special{pdf: put @resources << + /Shading << /Sh << /ShadingType 3 + /ColorSpace /DeviceRGB + /Domain [\pgf@pdfparseddomain] + /Coords [\pgf@sys@tonumber{\pgf@xa} \pgf@sys@tonumber{\pgf@ya} \pgf@doma\space \pgf@sys@tonumber{\pgf@x} \pgf@sys@tonumber{\pgf@y} \pgf@domb] + /Function \pgf@pdfparsedfunction + /Extend [true false] >> >> >>}}}\@temp% + \pgf@sys@atbeginpage{\special{pdf: content /Sh sh}% + \special{pdf: endxobj}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \hbox to\the\@tempdima{\vbox to\the\@tempdima{\vfil\special{pdf: usexobj @pgfshade#1}}\hfil}}% + }% +}% + + +\def\pgf@sys@atbeginpage#1{\AtBeginDvi{#1}} +\AtBeginDocument{% hyperref hack + \providecommand\HyPL@EveryPage{} + \def\@begindvi{\unvbox\@begindvibox\HyPL@EveryPage} +} + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def new file mode 100644 index 00000000000..e6ef83b5ade --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def @@ -0,0 +1,244 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-dvips.def,v 1.9 2005/10/18 18:03:38 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + + +% Driver commands for dvips + +% +% Load common postscript commands: +% +\input pgfsys-common-postscript.def + + +% +% dvips-specific stuff: +% +\def\pgfsys@invoke#1{\special{ps:: #1}} +\def\pgfsys@outerinvoke#1{\special{ps: #1}} + +\def\pgfsys@beginpicture{\special{ps: }\special{ps::[begin]}\pgfsys@invoke{pgfo}} +\def\pgfsys@endpicture{\pgfsys@invoke{pgfc}\special{ps::[end]}} +\def\pgfsys@hbox#1{% + \pgfsys@invoke{pgfs}% + \special{ps::[end]}% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \box#1 + \special{ps::[begin]}% + \pgfsys@invoke{pgfr}% +} +\def\pgfsys@begininvisible{% + \special{ps::[begin]}% + \pgfsys@invoke{gsave nulldevice}% + \special{ps::[end]}} +\def\pgfsys@endinvisible{% + \special{ps::[begin]}% + \pgfsys@invoke{grestore}% + \special{ps::[end]}% +} +\def\pgfsys@color@unstacked#1{\special{ps: \XC@usecolor{#1}}} +\newcount\pgf@objectcount +\def\pgfsys@defobject#1#2#3#4{% + \global\advance\pgf@objectcount by 1 + \expandafter\xdef\csname#1\endcsname{\the\pgf@objectcount} + \pgfsysprotocol@getcurrentprotocol\pgfsys@temp% + {% + \pgfsysprotocol@setcurrentprotocol\@empty% + \pgfsysprotocol@bufferedtrue% + #4% + \pgfsysprotocol@getcurrentprotocol\pgfsys@@temp% + \special{! /pgf\csname#1\endcsname{gsave exec \pgfsys@@temp\space grestore} bind def}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfsys@temp% +} +\def\pgfsys@useobject#1#2{% + \pgfsysprotocol@getcurrentprotocol\pgfsys@temp% + {% + \pgfsysprotocol@setcurrentprotocol\@empty% + \pgfsysprotocol@bufferedfalse% + #2% + \pgfsysprotocol@invokecurrentprotocol% + \pgfsys@invoke{pgf\csname#1\endcsname}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfsys@temp} +\def\pgfsys@imagesuffixlist{epsi:eps:ps} +\def\pgfsys@horishading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \setlength\pgf@x{#2}% + \pgf@xa=\pgf@x% + \pgf@sys@bp@correct{\pgf@x}% + \pgf@y=\pgf@max% + \pgf@sys@bp@correct{\pgf@y}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\hbox to \the\pgf@max{% + \noexpand\vrule width0pt height\the\pgf@xa% + \noexpand\pgfsys@beginpurepicture% + \noexpand\pgfsys@rect{0pt}{0pt}{\the\pgf@y}{\the\pgf@x}% + \noexpand\pgfsys@clipnext% + \noexpand\pgfsys@discardpath% + \noexpand\pgfsys@invoke{\pgf@domb\space \pgf@sys@tonumber{\pgf@x} pgfH \pgf@psfuncs\space pop}% + \hss% + \noexpand\pgfsys@endpurepicture}}% + }% +} +\def\pgfsys@vertshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \setlength\pgf@x{#2}% + \pgf@xa=\pgf@x% + \pgf@sys@bp@correct{\pgf@x}% + \pgf@y=\pgf@max% + \pgf@sys@bp@correct{\pgf@y}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\hbox to\the\pgf@xa{% + \noexpand\vrule width0pt height\the\pgf@max% + \noexpand\pgfsys@beginpurepicture% + \noexpand\pgfsys@rect{0pt}{0pt}{\the\pgf@x}{\the\pgf@y}% + \noexpand\pgfsys@clipnext% + \noexpand\pgfsys@discardpath% + \noexpand\pgfsys@invoke{\pgf@domb\space \pgf@sys@tonumber{\pgf@x} pgfV \pgf@psfuncs\space pop}% + \hss% + \noexpand\pgfsys@endpurepicture}}% + }% +} +\def\pgfsys@radialshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \pgf@process{#2}% + \pgf@xa=2\pgf@max% + \pgf@sys@bp@correct{\pgf@max}% + \advance\pgf@x by \pgf@max% + \advance\pgf@y by \pgf@max% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\hbox to \the\pgf@xa{% + \noexpand\vrule width0pt height\the\pgf@xa% + \noexpand\pgfsys@beginpurepicture% + \noexpand\pgfsys@invoke{% + \pgf@domb\space \pgf@sys@tonumber{\pgf@y} \pgf@sys@tonumber{\pgf@x} \pgf@sys@tonumber{\pgf@max} pgfR1 + \pgf@psfuncs\space \pgf@firstcolor\space \pgf@doma\space pgfR2}% + \hss% + \noexpand\pgfsys@endpurepicture}}% + }% +} + +\AtBeginDocument{ + % Always present specials. + \special{! + /pgfsc{}B% stroke color is empty by default + /pgffc{}B% fill color is empty by default + /pgfstr{stroke}B% + /pgffill{fill}B% + /pgfeofill{eofill}B% + /pgfe{a dup 0 rlineto exch 0 exch rlineto neg 0 rlineto closepath}B% rectangle + /pgfw{setlinewidth}B% setlinewidth + /pgfs{save pgfpd 72 Resolution div 72 VResolution div neg scale + magscale{1 DVImag div dup scale}if + pgfx neg pgfy neg translate pgffoa .setopacityalpha}B% save + /pgfr{pgfsd restore}B %restore + userdict begin% + /pgfo{pgfsd /pgfx currentpoint /pgfy exch def def @beginspecial}B %open + /pgfc{newpath @endspecial pgfpd}B %close + /pgfsd{globaldict /pgfdelta /delta where {pop delta} {0} ifelse put}B% save delta + /pgfpd{/delta globaldict /pgfdelta get def}B % put delta + /.setopacityalpha where {pop} {/.setopacityalpha{pop}def} ifelse % install .setopacityalpha + /.pgfsetfillopacityalpha{/pgffoa exch def + /pgffill{gsave pgffoa .setopacityalpha fill 1 .setopacityalpha newpath fill grestore}B + /pgfeofill{gsave pgffoa .setopacityalpha eofill1 .setopacityalpha newpath eofill grestore}B}B + /.pgfsetstrokeopacityalpha{/pgfsoa exch def + /pgfstr{gsave pgfsoa .setopacityalpha stroke grestore}B}B + /pgffoa 1 def + /pgfsoa 1 def + end + } + + % Parameters to horizontal pre axishade: \pgf@domb x + \special{! /pgfH{% + /pgfheight exch def 0.75 setlinewidth [] 0 setdash + /pgfshade {pgfA} def /pgfdir { dup 0 moveto + dup 5 index lineto } bind def} B}% + + % Parameters to vertical pre axishade: \pgf@domb x + \special{! /pgfV{% + /pgfheight exch def 0.75 setlinewidth [] 0 setdash + /pgfshade {pgfA} def /pgfdir { dup 0 exch moveto dup 5 index + exch lineto } bind def} B}% + + % Parameters to axishade: end x, start x, r-, g-, b- of first color, r-, g-, b- of second color + % Stack afterwards: end x + \special{! /pgfA{ + /pgfdiff 8 index round cvi 8 index round cvi sub 2 mul 1 add def + 2 index 6 index sub pgfdiff div % put red-step on stack + 2 index 6 index sub pgfdiff div % put green-step on stack + 2 index 6 index sub pgfdiff div % put green-step on stack + pgfheight 9 index 9 index 9 index 14 index + pgfdiff { + 3 index 3 index 3 index setrgbcolor % Set color + pgfdir + stroke + 4 -1 roll 7 index add % red += incred + 4 -1 roll 6 index add % green += incgreen + 4 -1 roll 5 index add % blue += incblue + 4 -1 roll .5 sub % x += 0.5 + } repeat + mark 15 1 roll cleartomark exch pop % leave only start x on stack + }B } + + % Parameters to radialshade pre: \pgf@domb y x max + \special{! /pgfR1{ + newpath dup dup dup 0 360 arc clip newpath + dup /pgfendx exch def + /pgfendy exch def + 0.875 setlinewidth + [] 0 setdash + /pgfshade {pgfR} def + /pgfstartx exch def + /pgfstarty exch def + /pgfdiffx pgfendx pgfstartx sub def + /pgfdiffy pgfendy pgfstarty sub def + dup /pgfdomb exch def + }B } + + % Parameters to radialshade post: \pgf@firstcolor \pgf@doma + \special{! /pgfR2{ + newpath 0.5 add pgfcircx pgfcircy 3 2 roll 0 360 arc + setrgbcolor fill pop}B }% + + % Parameters to radialshade: end x, start x, r-, g-, b- of first color, r-, g-, b- of second color + % Stack afterwards: end x + \special{! /pgfR{ + /pgfdiff 8 index round cvi 8 index round cvi sub 4 mul 1 add def + /pgfcircx pgfstartx 9 index pgfdiffx pgfdomb div mul add def + /pgfcircy pgfstarty 9 index pgfdiffy pgfdomb div mul add def + /pgfcircxe pgfstartx 8 index pgfdiffx pgfdomb div mul add def + /pgfcircye pgfstarty 8 index pgfdiffy pgfdomb div mul add def + /pgfxstep pgfcircxe pgfcircx sub pgfdiff div def + /pgfystep pgfcircye pgfcircy sub pgfdiff div def + 2 index 6 index sub pgfdiff div % put red-step on stack + 2 index 6 index sub pgfdiff div % put green-step on stack + 2 index 6 index sub pgfdiff div % put green-step on stack + 8 index 8 index 8 index 13 index + pgfdiff { + 3 index 3 index 3 index setrgbcolor % Set color + pgfcircx pgfcircy 2 index 0 360 arc closepath + stroke + 4 -1 roll 6 index add % red += incred + 4 -1 roll 5 index add % green += incgreen + 4 -1 roll 4 index add % blue += incblue + 4 -1 roll .25 sub % x += 0.25 + /pgfcircx pgfcircx pgfxstep add def + /pgfcircy pgfcircy pgfystep add def + } repeat + mark 14 1 roll cleartomark exch pop % leave only start x on stack + }B} +} + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def new file mode 100644 index 00000000000..79697fbb9f6 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def @@ -0,0 +1,169 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-pdftex.def,v 1.4 2005/10/06 13:16:09 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + + +% Driver commands for pdf + +% +% Load common pdf commands: +% +\input pgfsys-common-pdf.def + +% +% pdftex-specific stuff: +% +\def\pgfsys@invoke#1{\pdfliteral{#1}} + +\def\pgfsys@hboxsynced#1{% + {% + \pgfsys@beginscope% + \setbox\pgf@hbox=\hbox{% + \hskip\pgf@pt@x% + \raise\pgf@pt@y\hbox{% + \pgf@pt@x=0pt% + \pgf@pt@y=0pt% + \pgflowlevelsynccm% + \pgfsys@hbox#1}% + \hss% + }% + \wd\pgf@hbox=0pt% + \ht\pgf@hbox=0pt% + \dp\pgf@hbox=0pt% + \box\pgf@hbox% + \pgfsys@endscope% + }% +} + +\let\pgf@sys@pgf@resource@list=\@empty% +\def\pgf@sys@pdf@addtopageresources#1{% + \xdef\pgf@sys@pgf@resource@list{\pgf@sys@pgf@resource@list\space#1}% + \edef\pgf@temp{{<<\pgf@sys@pgf@resource@list>>}}% + \expandafter\immediate\expandafter\pdfobj\pgf@temp% + \edef\pgf@temp{{/ExtGState \the\pdflastobj\space 0 R}} + \expandafter\global\expandafter\pdfpageresources\pgf@temp% +} + + +\def\pgfsys@imagesuffixlist{pdf:jpg:jpeg:png} +\def\pgfsys@defineimage{% width, height, page number + \ifx\pgf@imagewidth\@empty\else\edef\pgf@imagewidth{ width \pgf@imagewidth }\fi% + \ifx\pgf@imageheight\@empty\else\edef\pgf@imageheight{ height \pgf@imageheight }\fi% + \ifx\pgf@imagepage\@empty\else\edef\pgf@imagepage{ page \pgf@imagepage }\fi% + \ifx\pdfximage\@undefined% old version of pdflatex + \ifx\pgf@imagepage\@empty\else% + \PackageWarning{pgf}{Page selection not supported. Ignoring + page selection}% + \fi% + \setbox\@tempboxa=\hbox{% + \pdfimage \pgf@imageheight \pgf@imagewidth {\pgf@filename}}% + \pdfform\@tempboxa% + \edef\pgf@image{\noexpand\pdfrefform\the\pdflastform}% + \else% new version + {\pdfximage \pgf@imageheight \pgf@imagewidth attr + {\pgf@imageinterpolate\space\pgf@imagemask} \pgf@imagepage + {\pgf@filename}}% + \edef\pgf@image{\noexpand\pdfrefximage\the\pdflastximage}% + \fi +}% +\def\pgfsys@definemask{% + \ifx\pgf@maskmatte\@empty% + \else% + \edef\pgf@maskmatte{/Matte [\pgf@maskmatte]}% + \fi% + \edef\pgf@attr{{\pgf@maskmatte\space /Decode [1 0]}}% + \immediate\pdfximage attr \pgf@attr {\pgf@filename}% + \edef\pgf@mask{\the\pdflastximage}% +} +\def\pgfsys@horishading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \setbox\@tempboxa=\hbox to\pgf@max{\vbox to#2{\vfil\pdfliteral{/Sh sh}}\hfil}% + \pgf@process{\pgfpoint{\pgf@max}{#2}}% + \pdfxform resources {% + /Shading << /Sh << /ShadingType 2 + /ColorSpace /DeviceRGB + /Domain [\pgf@pdfparseddomain] + /Coords [\pgf@doma\space0 \pgf@domb\space0] + /Function \pgf@pdfparsedfunction + /Extend [false false] >> >>}\@tempboxa% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% + }% +} +\def\pgfsys@vertshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \setbox\@tempboxa=\hbox to#2{\vbox to\pgf@max{\vfil\pdfliteral{/Sh sh}}\hfil}% + \pgf@process{\pgfpoint{#2}{\pgf@max}}% + \pdfxform resources {% + /Shading << /Sh << /ShadingType 2 + /ColorSpace /DeviceRGB + /Domain [\pgf@pdfparseddomain] + /Coords [0 \pgf@doma\space0 \pgf@domb] + /Function \pgf@pdfparsedfunction + /Extend [false false] >> >>}\@tempboxa% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% + }% +} +\def\pgfsys@radialshading#1#2#3{% + {% + \pgf@parsefunc{#3}% + \setbox\@tempboxa=\hbox to2\pgf@max{\vbox to2\pgf@max{\vfil\pdfliteral{/Sh sh}}\hfil}% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgfpoint{\pgf@max}{\pgf@max}}% + \advance\pgf@xa by \pgf@x% + \advance\pgf@ya by \pgf@y% + \pdfxform resources {% + /Shading << /Sh << /ShadingType 3 + /ColorSpace /DeviceRGB + /Domain [\pgf@pdfparseddomain] + /Coords [\pgf@sys@tonumber{\pgf@xa} \pgf@sys@tonumber{\pgf@ya} \pgf@doma\space \pgf@sys@tonumber{\pgf@x} \pgf@sys@tonumber{\pgf@y} \pgf@domb] + /Function \pgf@pdfparsedfunction + /Extend [true false] >> >>}\@tempboxa% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% + }% +}% + + % XForm version, crashes ghostview. + %\def\pgfsys@defobject#1#2#3#4{% + % \pgf@process{#2} + % \setbox\pgfobjectbox\hbox{\raise-\pgf@y\hbox{\hskip-\pgf@x\relax#4}} + % \pgf@process{#3} + % \pgf@xa=\pgf@x + % \pgf@ya=\pgf@y + % \pgf@process{#2} + % \advance\pgf@xa by-\pgf@x + % \advance\pgf@ya by-\pgf@y + % \wd\pgfobjectbox=\pgf@xa + % \dp\pgfobjectbox=0pt + % \ht\pgfobjectbox=\pgf@ya + % \pdfxform\pgfobjectbox + % \expandafter\xdef\csname#1\endcsname{\the\pdflastxform} + % \expandafter\xdef\csname pgf@trans#1\endcsname + % {{\pgfget x}{\pgfget y}}} + %\def\pgfsys@useobject#1#2{% + % \setbox\pgfobjectbox\hbox{\pdfrefxform \csname#1\endcsname}% + % \dp\pgfobjectbox=0pt% + % \ht\pgfobjectbox=0pt% + % \wd\pgfobjectbox=0pt% + % \pgfsys@discardpath% + % \pgfsys@beginscope% + % #2% + % \edef\pgf@temp{{1}{0}{0}{1}\csname pgf@trans#1\endcsname}% + % \expandafter\pgfsys@transform\pgf@temp% + % \box\pgfobjectbox% + % \pgfsys@endscope} + +\endinput + + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def new file mode 100644 index 00000000000..f7864d34070 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def @@ -0,0 +1,165 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-tex4ht.def,v 1.8 2005/08/13 18:59:56 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + +\RequirePackage{xcolor} + + +% Driver commands for tex4ht + +% +% Load common pdf commands: +% +\input pgfsys-common-svg.def + +% +% tex4ht-specific stuff: +% +\def\pgfsys@invoke#1{\HCode{#1}} + +\newcount\pgf@sys@svg@picnum + + +\def\pgfsys@beginpicture{% + \Configure{[]}{$}{$} + \Configure{()}{$}{$} + \Configure{$$}{}{}{}%$$ + \Configure{$}{}{}{}%$ + \Configure{SUB}{\HCode{}}{\HCode{}} + \Configure{SUP}{\HCode{}}{\HCode{}} + \Configure{SUBSUP}{}{}{} + \Configure{htf} + {0}{+}{}{} +} +\def\pgfsys@endpicture{% + % undo: + \Configure{htf}{0}{+}{}{} +} + +\def\pgfsys@typesetpicturebox#1{% + \global\advance\pgf@sys@svg@picnum by 1\relax% + % Ok, compute width/height + \pgf@xa=\pgf@picminx% + \pgf@ya=\pgf@picminy% + \pgf@xb=\pgf@picmaxx% + \pgf@yb=\pgf@picmaxy% + \pgf@x=\pgf@xb% + \advance\pgf@x by-\pgf@xa% + \pgf@y=\pgf@yb% + \advance\pgf@y by-\pgf@ya% + \ifdim\pgf@y<1pt% + \pgf@y=1pt% + \fi% + \HCode{

SVG-Viewer needed.

}% + \special{t4ht>\jobname-\the\pgf@sys@svg@picnum.svg}% + \pgfsys@invoke{\Hnewline \Hnewline }% + \setlength\pgf@x{\pgf@shift@baseline}% + \advance\pgf@x by-\pgf@picminy\relax% + \advance\pgf@picmaxy by-\pgf@picminy\relax% maxy is now the height + \advance\pgf@picmaxx by-\pgf@picminx\relax% maxx is now the width + \setbox#1=\hbox{\hskip-\pgf@picminx\lower\pgf@picminy\box#1}% + \ht#1=\pgf@picmaxy% + \wd#1=\pgf@picmaxx% + \dp#1=0pt% + \leavevmode\raise-\pgf@x\box#1% + \pgfsys@invoke{\Hnewline \Hnewline }% + \special{t4ht<\jobname-\the\pgf@sys@svg@picnum.svg}% +} + +\def\pgfsys@hbox#1{% + \pgf@x=.5\wd#1% + \ifx\tikz@textcolor\relax% + \else% + \ifx\tikz@textcolor\@empty% + \pgfsetfillcolor{.}% + \else% + \pgfsetfillcolor{\tikz@textcolor}% + \fi% + \fi% tweak for TikZ + \HCode{\Hnewline }% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \box#1 + \HCode{\Hnewline }% +} + +\def\pgfsys@outerinvoke{\ifpgfpicture\expandafter\pgfsys@invoke\else\expandafter\@gobble\fi} + + +\def\pgfsys@shadingoutsidepgfpicture#1{% + \begingroup% + #1% + \setbox\pgfpic=\hbox to0pt{% + \pgfsys@beginpicture% + \pgfsys@beginscope% + \pgf@sys@svg@sh@defs% + \pgf@sys@svg@sh% + \pgfsys@endscope% + \pgfsys@endpicture% + \hss% + }% + \pgf@process{\pgf@sys@svg@pos}% + \pgf@picminx=0pt% + \pgf@picminy=0pt% + \pgf@picmaxx=\pgf@x% + \pgf@picmaxy=\pgf@y% + \pgf@baseline=0pt% + \pgfsys@typesetpicturebox\pgfpic% + \endgroup% +} + +\def\pgfsys@shadinginsidepgfpicture#1{% + #1% + \pgf@sys@svg@sh@defs% hmmm.... + \pgf@process{\pgf@sys@svg@pos} + \pgf@xa=-.5\pgf@x% + \pgf@ya=-.5\pgf@y% + \pgfsysprotocol@literal{\Hnewline}% + \pgf@sys@svg@sh% + \pgfsysprotocol@literal{\Hnewline}% +} + + + +% Protect against color.4ht evil meddling with xcolor: +\let\pgf@xcolor@declaredcolor=\@declaredcolor +\let\pgf@xcolor@undeclaredcolor=\@undeclaredcolor + +\AtBeginDocument{ + \let\pgf@texht@declaredcolor=\@declaredcolor + \let\pgf@texht@undeclaredcolor=\@undeclaredcolor + \def\@declaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@declaredcolor\else\expandafter\pgf@texht@declaredcolor\fi} + \def\@undeclaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@undeclaredcolor\else\expandafter\pgf@texht@undeclaredcolor\fi} + \ConfigureEnv{pgfpicture}{}{}{}{} +} + +\endinput + + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex new file mode 100644 index 00000000000..22b257f7448 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex @@ -0,0 +1,763 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys.code.tex,v 1.9 2005/10/18 18:03:38 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + + +% +% The following conversion functions are used to convert from TeX +% dimensions to postscript/pdf points. +% +{\catcode`\p=12\catcode`\t=12\gdef\Pgf@geT#1pt{#1}} + +\def\pgf@sys@tonumber#1{\expandafter\Pgf@geT\the#1} + +\def\pgf@sys@bp@correct#1{#1=0.99627#1} + +\def\pgf@sys@bp#1{% + {% + \pgf@x=#1\relax% + \pgf@x=0.99627\pgf@x% + \edef\temp{\expandafter\Pgf@geT\the\pgf@x\space}% + \toks@\expandafter\expandafter\expandafter{\expandafter\pgfsysprotocol@currentprotocol\temp}% + \xdef\pgfsysprotocol@currentprotocol{\the\toks@}% + }% +} +\def\pgf@sys@pt#1{% + {% + \pgf@x=#1\relax% + \edef\temp{\expandafter\Pgf@geT\the\pgf@x\space}% + \toks@\expandafter\expandafter\expandafter{\expandafter\pgfsysprotocol@currentprotocol\temp}% + \xdef\pgfsysprotocol@currentprotocol{\the\toks@}% + }% +} + +% internal dimensions that are always present when pgsys is loaded. +\newdimen\pgf@x +\newdimen\pgf@y +\newdimen\pgf@xa +\newdimen\pgf@ya +\newdimen\pgf@xb +\newdimen\pgf@yb +\newdimen\pgf@xc +\newdimen\pgf@yc + + +% The following \if decides, whether even-odd filling and clipping is +% to be used or normal the non-zero winding number rule. See the +% pdf-documentation for details on what these rules are. + +\newif\ifpgfsys@eorule + + + +% In the following dummy definitions of the pgf system commands are +% given. The individual drivers must overwrite these definitions, +% preferably all of them. If some system command is used that has not +% been overwritten, the command fails with a warning. +% +% In some cases, some pgf system commands are just shorthands for a +% series of more complicated commands. In this case, a default +% implementation is given in this file, but a driver may choose to +% overwrite this default implementation with a more effecient +% version. For example, a closestroke is the same as a closepath +% followed by a stroking, but in pdf there is a special shorthand for +% this. So, the pdf driver overwrites \pgfsys@closestroke, while the +% postscript driver does not. +% +% The commands for which default implementations are available are +% given at the end. + +\def\pgf@sys@fail#1{% + \expandafter\ifx\csname pgf@sys@fail@#1\endcsname\@empty% + \else% + \expandafter\global\expandafter\let\csname pgf@sys@fail@#1\endcsname=\@empty% + \PackageWarning{pgf}{% + Your graphic driver \pgfsysdriver\space does not supported #1. This warning is given only once}% + \fi% +} + + + +\def\pgfsys@invoke{\pgf@sys@fail{invoking specials}} +% This command is used whenever some literal text needs to be inserted +% into the resulting .pdf, .ps, or .dvi file. Note that most +% \pgfsys@xxxx commands will not directly call this command, but, +% rather, use the protocolling mechanism to record their literal +% text. It is then left to the discretion of the protocolling +% mechansim to insert the literal text at some appropriate, later +% time. +% +% This command should only be called when \pgfsys@beginpicture has +% been called previously and when the picture has not been suspended +% using \pgfsys@beginhbox. + + +\def\pgfsys@outerinvoke{\pgfsys@invoke} +% This command can be used to insert protocolled graphic commands +% outside any picture. This is extremely dangerous, but sometimes +% useful. By default, this command does the same as inside pictures. + + + +% +% +% Path construction commands +% +% + +\def\pgfsys@moveto#1#2{\pgf@sys@fail{path constructions}} +% This command is used to start a path at a specific point (#1bp,#2bp) +% or to move the current point of the current path to (#1bp,#2bp) +% without drawing anything upon stroking (the current path is +% `interrupted'). +% +% Here (and in the following) the coordinates are in TeX's big points +% (bp), unless the coordinate system has been scaled. A big point is +% 1/72 inches. Note that TeX's point pt is 1/72.27 inches. +% +% Example: +% +% \pgfsys@moveto{10}{10} +% \pgfsys@lineto{0}{0} +% \pgfsys@stroke +% +% This will draw a line from (10bp,10bp) to the origin of the picture. + +\def\pgfsys@lineto#1#2{\pgf@sys@fail{path constructions}} +% Continue the current path to (#1bp,#2bp) with a line. + +\def\pgfsys@curveto#1#2#3#4#5#6{\pgf@sys@fail{path constructions}} +% Continue the current path with a bezier curver to (#5bp,#6bp). The +% control points of the curve are at (#1bp,#2bp) and (#3bp,#4bp). + +\def\pgfsys@rect#1#2#3#4{\pgf@sys@fail{path constructions}} +% Append a rectangle to the current path whose lower left corner is at +% (#1bp,#2bp) and whose width/height is given by (#3bp,#4bp). +% +% This command can be `mapped back' to moveto and lineto commands, but +% it is included since pdf has a special, quick version of this command. + +\def\pgfsys@closepath{\pgf@sys@fail{path constructions}} +% Close the current path. This results in joining the current point of +% the path with the point specified by the last moveto +% operation. Typically, this is preferable over using lineto to the +% last point specified by a moveto, since the line starting at this +% point and the line ending at this point will be smoothly joined by +% closepath. +% +% Example: +% +% \pgfsys@moveto{0}{0} +% \pgfsys@lineto{10}{10} +% \pgfsys@lineto{0}{10} +% \pgfsys@closepath +% \pgfsys@stroke +% +% versus +% +% \pgfsys@moveto{0}{0} +% \pgfsys@lineto{10}{10} +% \pgfsys@lineto{0}{10} +% \pgfsys@lineto{0}{0} +% \pgfsys@stroke +% +% The difference between the above will be that in the second triangle +% the corner at the origin will be wrong; it will just be the overlay +% of two lines going in different directions, not a sharp pointed +% corner. + + + + + + +% +% +% Stroking and filling commands +% +% + +\def\pgfsys@stroke{\pgf@sys@fail{path usage}} +% Stroke the current path (as if it were drawn with a pen). A number +% of so-called graphic state parameters influence this, which can be +% set in different ways: +% +% - linewidth +% The `thickness' of the line. A width of 0 is the thinnest width +% renderable on the device. On a high-resolution printer this may +% become invisible and should be avoided. A good choice is 0.4pt, +% which is the default. +% +% - stroke color +% This special color is used for stroking. If it is not set, the +% current color is used. +% +% - cap +% The cap describes how the endings of lines a drawn. A round cap +% adds a little half circle to these endings. A butt cap ends the +% lines exactly at the end (or start) point without anything +% added. A rectangular cap ends the lines like the butt cap, but the +% lines protrude over the endpoint by the line thickness. (See also +% the pdf or postscript manual). If the path has been closed, no cap +% is drawn. +% +% - join +% This describes how a bend (a join) in a path is rendered. A round +% join draws bends using small arcs. A bevel join just draws the two +% lines and then fills the join minimally so that it becomes +% convex. A miter join extends the lines so that they form a single +% sharp corner, but only up to a certain miter limit. (See the pdf +% or postscript manual once more). +% +% - dash +% The line may be dashed according to a dashing pattern. +% +% - clipping area +% If a clipping area is established, only those parts of the path +% that are inside the clipping area will be drawn. +% +% In addition to stroking a path, the path may also be used for +% clipping after it has been stroked. This will happen if the +% \pgfsys@clipnext is used prior to this command, see there for +% details. + +\def\pgfsys@fill{\pgf@sys@fail{path usage}} +% This command fills the area surrounded by the current path. If the +% path has not yet been closed, it is closed prior to filling. The +% path itself is not stroked. For self-intersecting paths or paths +% consisting of multiple parts, the nonzero winding number rule is +% used to determine whether a point is inside or outside the +% path, except if \ifpgfsys@eorule holds -- in which case the even-odd +% rule should be used. (See the pdf or postscript manual for details.) +% +% The following graphic state parameters influence the filling: +% +% - fill color +% If the fill color is not especially set, the current color is +% used. +% +% - clipping area +% If a clipping area is established, only those parts of the filling +% area that are inside the clipping area will be drawn. +% +% In addition to filling the path, the path will also be used for +% clipping if \pgfsys@clipnext is used prior to this command. + +\def\pgfsys@fillstroke{\pgf@sys@fail{path usage}} +% First, the path is filled, then the path is stroked. If the fill and +% stroke colors are the same (or if they are not specified and the +% current color is used), this yields almost the same as a +% \pgfsys@fill. However, due to the line thickness of the stroked +% path, the fillstroked area will be slightly larger. +% +% In addition to stroking and filling the path, the path will also be +% used for clipping if \pgfsys@clipnext is used prior to this command. + +\def\pgfsys@clipnext{\pgf@sys@fail{path usage}} +% This command should be issued after a path has been constructed, but +% before it has been stroked and/or filled or discarded. When the +% command is used, the next stroking/filling/discarding command will +% first be executed normally. Then, afterwards, the just-used path +% will be used for subsequent clipping. If there has already been a +% clipping region, this region is intersected with the new clipping +% path (the clipping cannot get bigger). The nonzero winding number +% rule is used to determine whether a point is inside or outside the +% clipping area or the even-odd rule, depending on whether +% \ifpgfsys@eorule holds. + +\def\pgfsys@discardpath{\pgf@sys@fail{path usage}} +% Normally, this command should `throw away' the current path. +% However, after \pgfsys@clipnext has been called, the current path +% should subsequently be used for clipping. See \pgfsys@clipnext for +% details. + + + + + +% +% +% Stroking options +% +% +\def\pgfsys@setlinewidth#1{\pgf@sys@fail{setting the line width}} +% Sets the width of lines, when stroked, to #1bp. + +\def\pgfsys@buttcap{\pgf@sys@fail{setting the line cap}} +% Sets the cap to a butt cap. See \pgfsys@stroke. + +\def\pgfsys@roundcap{\pgf@sys@fail{setting the line cap}} +% Sets the cap to a round cap. See \pgfsys@stroke. + +\def\pgfsys@rectcap{\pgf@sys@fail{setting the line cap}} +% Sets the cap to a rectangular cap. See \pgfsys@stroke. + +\def\pgfsys@miterjoin{\pgf@sys@fail{setting the line join}} +% Sets the join to a miter join. See \pgfsys@stroke. + +\def\pgfsys@setmiterlimit#1{\pgf@sys@fail{setting the line cap}} +% Sets the miter limit of lines to #1. See the pdf or postscript +% documentation. + +\def\pgfsys@roundjoin{\pgf@sys@fail{setting the line cap}} +% Sets the join to a round join. See \pgfsys@stroke. + +\def\pgfsys@beveljoin{\pgf@sys@fail{setting the line cap}} +% Sets the join to a bevel join. See \pgfsys@stroke. + +\def\pgfsys@setdash#1#2{\pgf@sys@fail{setting the dashing pattern}} +% Sets the dashing patter. #1 should be a list of lengths given in big +% points (bp) separated by spaces. #2 should be a single value given +% in bp. +% +% The list of values in #1 is used to determine the lengths of the +% `on' phases of the dashing and of the `off' phases. For example, if +% #1 is `3 4', then the dashing pattern is `3bp on followed by 4bp +% off, followed by 3bp on, followed by 4bp off, and so on'. A pattern +% of `.5 4 3 1.5' means `.5bp on, 4bp off, 3bp on, 1.5bp off, .5bp on, +% ...'. If the number of entries is odd, the last one is used twice, +% so `3' means `3bp on, 3bp off, 3bp on, 3bp off,...'. An empty list +% means `always on'. +% +% The second argument determines the `phase' of the pattern. For +% example, for a pattern of `3 4' and a phase of `1', the pattern +% would start: `2bp on, 4bp off, 3bp on, 4bp off, 3bp on, 4bp off...'. + + + + +% +% +% Opacity stuff +% +% + +\def\pgfsys@stroke@opacity#1{\pgf@sys@fail{opacity}} +% Sets the opacity of stroking operations. 1 means fully opaque, 0 +% means fully transparent. + +\def\pgfsys@fill@opacity#1{\pgf@sys@fail{opacity}} +% Sets the opacity of filling operations. 1 means fully opaque, 0 +% means fully transparent. + + + + +% +% +% Color stuff +% +% + +\def\pgfsys@color@rgb@stroke#1#2#3{\pgf@sys@fail{color}} +% Sets the color used for stroking operations to the given rgb tuple +% (numbers between 0 and 1). +% +% Example: Make stroked text dark red: \pgfsys@color@rgb@stroke{0.5}{0}{0} +% +% The special stroking color is only used if the stroking color has +% been set since the last \color command. Thus, each \color command +% should reset both the stroking and filling colors. + +\def\pgfsys@color@rgb@fill#1#2#3{\pgf@sys@fail{color}} +% Sets the color used for filling operations to the given rgb tuple +% (numbers between 0 and 1). This color may be different from the +% stroking color. + +\def\pgfsys@color@rgb#1#2#3{\pgfsys@color@rgb@stroke{#1}{#2}{#3}\pgfsys@color@rgb@fill{#1}{#2}{#3}} +% Sets the color used for filling and stroking operations. This is a +% ``low-level'' version of the \color command. It is currently only +% used by the plain tex version to support colors. + +\def\pgfsys@color@cmyk@stroke#1#2#3#4{\pgf@sys@fail{color}} +% Sets the color used for stroking operations to the given cymk tuple +% (numbers between 0 and 1). + +\def\pgfsys@color@cmyk@fill#1#2#3#4{\pgf@sys@fail{color}} +% Sets the color used for filling operations to the given cymk tuple +% (numbers between 0 and 1). + +\def\pgfsys@color@cmyk#1#2#3#4{\pgfsys@color@cmyk@stroke{#1}{#2}{#3}{#4}\pgfsys@color@cmyk@fill{#1}{#2}{#3}{#4}} +% Sets the color used for filling and stroking operations. + +\def\pgfsys@color@cmy@stroke#1#2#3{\pgf@sys@fail{color}} +% Sets the color used for stroking operations to the given cym tuple +% (numbers between 0 and 1). + +\def\pgfsys@color@cmy@fill#1#2#3{\pgf@sys@fail{color}} +% Sets the color used for filling operations to the given cym tuple +% (numbers between 0 and 1). + +\def\pgfsys@color@cmy#1#2#3{\pgfsys@color@cmy@stroke{#1}{#2}{#3}\pgfsys@color@cmy@fill{#1}{#2}{#3}} +% Sets the color used for filling and stroking operations. + +\def\pgfsys@color@gray@stroke#1{\pgf@sys@fail{color}} +% Sets the color used for stroking operations to the given gray level +% (number between 0 and 1). + +\def\pgfsys@color@gray@fill#1{\pgf@sys@fail{color}} +% Sets the color used for filling operations to the given gray level +% (number between 0 and 1). + +\def\pgfsys@color@gray#1{\pgfsys@color@gray@stroke{#1}\pgfsys@color@gray@fill{#1}} +% Sets the color used for filling and stroking operations. + +\newif\ifpgfsys@color@reset@inorder +% This if decides whether the color resetting of the +% \pgfsys@color@reset command may assume that all color commands are +% given ``in order.'' This means that this command will not be called, +% say, at the beginning of a box that is later inserted at a point +% where a fill color was actively set. This may allow the command to +% produce more compact code when it ``knows'' that no special fill or +% stroke color has been set. +\pgfsys@color@reset@inordertrue + + +\def\pgfsys@color@reset{} +% This command will be called when the \color command is used. It +% should purge any internal settings of stroking and filling +% color. After this call, till the next use of a command like +% \pgfsys@color@rgb@fill, the current color installed by the \color +% command should be used. + +\def\pgfsys@color@unstacked#1{} +% This slightly obscure command causes the color stack to be +% tricked. When called, this command should set the current color to +% #1 without causing any change in the color stack. + + + +% +% +% Coordinate system transformations +% +% + +\def\pgfsys@transformcm#1#2#3#4#5#6{\pgf@sys@fail{transformations}} +% Perform a concatenation of the low-level current transformation +% matrix with the matrix given by the values #1 to #6. The +% transformation matrix is a transformation on a homogeneous +% 2D-coordinate system. See the pdf or postscript manual for details. + + + + +% +% +% Graphic state saving and restoring. +% +% + +\def\pgfsys@beginscope{\pgf@sys@fail{scoping}} +% Saves the current graphic state on a graphic state stack. All +% changes to the graphic state parameters mentioned for \pgfsys@stroke +% and \pgfsys@fill will be local to the current graphic state and will +% the old values will be restored after endscope is used. +% +% WARNING: pdf and postscript differ with respect to the question of +% whether the current path is part of the graphic state or not. For +% this reason, you should never use this command unless the path is +% currently empty. For example, it might be a good idea to use +% discardpath prior to calling this command. + +\def\pgfsys@endscope{\pgf@sys@fail{scoping}} +% Restores the last saved graphic state. + + + + +% +% +% Special commands +% +% + +\def\pgfsys@imagesuffixlist{} +% A list of suffixes, separated by `:', that will be tried when +% searching for an image. + + + +% +% +% Special commands +% +% + + +\def\pgfsys@definemask{\pgf@sys@fail{masking}} +% This command declares a mask for usage with images. It works similar +% to \pgfsys@defineimage: Certain macros are set when the command is +% called. The result should be to set the macro \pgf@mask to a pdf +% object count that can subsequently be used as a soft mask. The +% following macros will be set when this command is invoked: +% +% - \pgf@filename +% File name of the mask to be defined. +% +% - \pgf@maskmatte +% The so-called matte of the mask (see the pdf documentation for +% details). The matte is a color specification consisting of 1, 3 or +% 4 numbers between 0 and 1. The number of numbers depends on the +% number of color channels in the image (not in the mask!). It will +% be assumed that the image has been preblended with this color. + + + + +% +% +% Shading commands +% +% + +\def\pgfsys@horishading#1#2#3{\pgf@sys@fail{shadings}} +% Declares a horizontal shading for later use. The effect of this +% command should be the definition of a macro called `@pgfshading#1!' +% (or \csname @pdfshading#1!\endcsname, to be precise). When invoked, +% this new macro should insert a shading at the current position. +% +% #1 is the name of the shading, which is also used in the output +% macro name. #2 is the height of the shading and must be given as a +% TeX dimension like `2cm' or `10pt'. #3 is a shading color +% specification as specified in the pgfuserguide. The shading +% specification implicitly fixes the width of the shading. +% +% When `@pgfshading#1!' is invoked, it should insert a box of height +% #2 and the width implicit in the shading declaration. + +\def\pgfsys@vertshading#1#2#3{\pgf@sys@fail{shadings}} +% Like horishading, only for vertical shadings. This time, the height +% of the shading is implicit in #3 and the width is given as #2. + +\def\pgfsys@radialshading#1#2#3{\pgf@sys@fail{shadings}} +% Declares a radial shading. Like the previous macros, this command +% should setup the macro `@pgfshading#1!', which upon invocation +% should insert a radial shading whose size is implicit in #3. +% +% The parameter #2 is a pgf point specification if the starting point +% of the shading. See the pgfuserguide for details. + +\def\pgfsys@shadingoutsidepgfpicture#1{% + #1% +} +% This command gets the definition of a shading (@pgfshadingxxxx!) as +% an argument and should insert this shading into the normal text. +% +% This command has a default implementation. + + +\def\pgfsys@shadinginsidepgfpicture#1{% + \pgf@makehbox{#1}% + \setbox\pgf@hbox=\hbox{\hskip-.5\wd\pgf@hbox\lower.5\ht\pgf@hbox\hbox{\box\pgf@hbox}}% + \pgfqbox{\pgf@hbox}% +} +% This command works like \pgfsys@shadingoutsidepgfpicture, only it is +% called when a shading should be inserted inside a picture. This +% command should insert the shading centered on the origin (which will +% typically have been low-level translated somewhere else.) +% +% This command has a default implementation. + + + + + +% +% +% Commands having a default implementation. These commands only need +% not be implemented by drivers if this results in a better +% preformance. +% +% + + +\def\pgfsys@closestroke{\pgfsys@closepath\pgfsys@stroke} +% This command should have the same effect as first closing the path +% and then stroking it. + + +\def\pgfsys@transformshift#1#2{\pgfsys@transformcm{1}{0}{0}{1}{#1}{#2}} +% This command will change the origin of the low-level coordinate +% system to (#1bp,#2bp). + +\def\pgfsys@transformxyscale#1#2{\pgfsys@transformcm{#1}{0}{0}{#2}{0bp}{0bp}} +% This command will scale the low-level coordinate system (and +% everything that is drawn) by a factor of #1 in x-directed and #2 in +% y-direction. Note that this applies to everything, including +% lines. So a scaled line will have a different width and may even +% have a different width when going along the x-axis and when going +% along the y-axis, if the scaling is different in these directions. + +\def\pgfsys@hbox#1{% + \pgfsys@beginscope% + \wd#1=0pt% + \ht#1=0pt% + \dp#1=0pt% + \box#1% + \pgfsys@endscope% +} +% Called to insert a TeX hbox into a pgfpicture. + +\def\pgfsys@hboxsynced#1{% + {\pgfsys@beginscope\pgflowlevelsynccm\pgfsys@hbox#1\pgfsys@endscope}% +} +% Called to insert a TeX hbox into a pgfpicture, but with the current +% coordiante transformation matrix synced with the canvas +% transformation matrix. +% +% In essence, this command does the same as if you first said +% \pgflowlevelsynccm and then \pgfsys@hbox. However, a driver may +% choose to use a ``TeX-translation'' for the translation part of the +% transformation cm. This will ensure that hyperlinks ``survive'' at +% least translations. + +\def\pgfsys@beginpicture{} +% Called at the beginning of a pgfpicture. Used to setup things. + +\def\pgfsys@endpicture{} +% Called at the end of a pgfpicture. + +\def\pgfsys@typesetpicturebox#1{% + \setlength\pgf@x{\pgf@shift@baseline}% + \advance\pgf@x by-\pgf@picminy\relax% + \advance\pgf@picmaxy by-\pgf@picminy\relax% maxy is now the height + \advance\pgf@picmaxx by-\pgf@picminx\relax% maxx is now the width + \setbox#1=\hbox{\hskip-\pgf@picminx\lower\pgf@picminy\box#1}% + \ht#1=\pgf@picmaxy% + \wd#1=\pgf@picmaxx% + \dp#1=0pt% + \leavevmode\raise-\pgf@x\box#1% +} +% Called after a picture has been typeset in box #1. This +% command should insert the box into the normal TeX code. The box #1 +% will still be a ``raw'' box that contains only the \special's. The +% job of this command is to resize and shift this box according to the +% baseline shift and the size of the box. +% +% This command has a default implementation. + +\def\pgfsys@beginpurepicture{\pgfsys@beginpicture} +% This version of the beginpicture command can be used for pictures +% that are guaranteed not to contain any hboxes. In this case, a +% driver might provide a more compact version of the command. + +\def\pgfsys@endpurepicture{\pgfsys@endpicture} +% Called at the end of a ``pure'' pgfpicture. + +\def\pgfsys@defineimage{% + \ifx\pgf@imagewidth\@empty\else\edef\pgf@imagewidth{width=\pgf@imagewidth,}\fi% + \ifx\pgf@imageheight\@empty\else\edef\pgf@imageheight{height=\pgf@imageheight,}\fi% + \ifx\pgf@imagepage\@empty\else\edef\pgf@imagepage{page=\pgf@imagepage,}\fi% + \edef\pgf@image{\noexpand\includegraphics[\pgf@imageheight\pgf@imagewidth]{\pgf@filename}}% +} +% Called, when an image should be defined. +% +% This command does not take any parameters. Instead, certain macros +% will be preinstalled with appropriate values when this command is +% invoked. These are: +% +% - \pgf@filename +% File name of the image to be defined. +% +% - \pgf@imagewidth +% Will be set to the desired (scaled) width of the image. +% +% - \pgf@imageheight +% Will be set to the desired (scaled) height of the image. +% +% If this macro and also the height macro are empty, the image +% should have its `natural' size. +% +% If exactly only of them is specified, the undefined value the +% image is scaled so that the aspect ratio is kept. +% +% If both are set, the image is scaled in both directions +% independently, possibly changing the aspect ratio. +% +% +% The following macros presumable mostly make sense for drivers that +% can handle pdf: +% +% - \pgf@imagepage +% The desired page number to be extracted from a multi-page +% `image'. +% +% - \pgf@imagemask +% If set, it will be set to `/SMask x 0 R', where x is the pdf +% object number of a soft mask to be applied to the image. +% +% - \pgf@imageinterpolate +% If set, it will be set to `/Interpolate true' or `/Interpolate +% false', indicating whether the image should be interpolated in +% pdf. +% +% +% The command should now setup the macro \pgf@image such that calling +% this macro will result in typesetting the image. Thus, \pgf@image is +% the `return value' of the command. + + +\def\pgfsys@defobject#1#2#3#4{% + \pgfsysprotocol@getcurrentprotocol\pgfsys@temp% + {% + \pgfsysprotocol@setcurrentprotocol\@empty% + \pgfsysprotocol@bufferedtrue% + #4% + \pgfsysprotocol@getcurrentprotocol\pgfsys@@temp% + \expandafter\global\expandafter\let\csname #1\endcsname=\pgfsys@@temp% + }% + \pgfsysprotocol@setcurrentprotocol\pgfsys@temp% +} +% Declares an object for later use. The idea is that the object can be +% precached in some way and then be rendered more quickly when used +% several times. For example, an arrow head might be defined and +% prerendered in this way. +% +% The parameter #1 is the name for later use. #2 and #3 are pgf points +% specifying a bounding box for the object. #4 is the code for the +% object. The code may only contain protocollable code. + + +\def\pgfsys@useobject#1#2{% + \pgfsysprotocol@getcurrentprotocol\pgfsys@temp% + {% + \pgfsysprotocol@setcurrentprotocol\@empty% + \pgfsysprotocol@bufferedfalse% + #2% + \expandafter\pgfsysprotocol@setcurrentprotocol\csname #1\endcsname% + \pgfsysprotocol@invokecurrentprotocol% + }% + \pgfsysprotocol@setcurrentprotocol\pgfsys@temp% +} +% Renders a previously declared object. The first parameter is the +% name of the the object. The second parameter is extra code that +% should be executed right *before* the object is rendered. Typically, +% this will be some transformation code. + + +\def\pgfsys@begininvisible{\pgfsys@transformcm{1}{0}{0}{1}{2000bp}{2000bp}} +% Between this command and the closing endinvisible, all output should +% be suppressed. Nothing should be drawn at all, which includes all +% paths, images and shadings. + +\def\pgfsys@endinvisible{\pgfsys@transformcm{1}{0}{0}{1}{-2000bp}{-2000bp}} +% Ends the invisibilty section, unless invisibility blocks have been +% nested. In this case, only the `last' one restores visibility. + + + + +% Discern the driver: +\input pgf.cfg + +\PackageInfo{pgfsys}{Driver file for pgf: \pgfsysdriver} +\InputIfFileExists{\pgfsysdriver}{}{% + \PackageError{pgfsys}{Driver file ``\pgfsysdriver'' not found.}{}} + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex new file mode 100644 index 00000000000..119fc5d7128 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex @@ -0,0 +1,68 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsysprotocol.code.tex,v 1.1.1.1 2005/06/29 12:14:04 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + + + +% This package provides the pgf system protcol layer. Protocolling is +% used to record a bunch of graphic operations so that they can be +% reused quickly at a later point. +% +% Basically, all ``recordable'' \pgfsys@xxxx commands call +% \pgfsysprotocol@protocol for their protocolable literal +% specials. The literal text will either be stored in the current +% protocol. At a later point (actually, normally this happens +% immediately afterwards), the accumulated protocolled text is invoked +% using pgfsys@invokeprotocol. + + + +\let\pgfsysprotocol@currentprotocol=\@empty +\newif\ifpgfsysprotocol@buffered + + +% Add to the protocol buffered +\def\pgfsysprotocol@literalbuffered#1{% + \edef\pgfsysprotocol@temp{{#1\space}}% + \expandafter\g@addto@macro\expandafter\pgfsysprotocol@currentprotocol\pgfsysprotocol@temp% +} + +% Add to the protocol +\def\pgfsysprotocol@literal#1{% + \pgfsysprotocol@literalbuffered{#1}% + \ifpgfsysprotocol@buffered% + \else% + \pgfsysprotocol@flushcurrentprotocol% + \fi% +} + +% Getting and setting the current protocol +\def\pgfsysprotocol@getcurrentprotocol#1{% + \let#1=\pgfsysprotocol@currentprotocol% +} + +\def\pgfsysprotocol@setcurrentprotocol#1{% + \global\let\pgfsysprotocol@currentprotocol=#1% +} + + +% Invoking the current protocol +\def\pgfsysprotocol@invokecurrentprotocol{% + \ifx\pgfsysprotocol@currentprotocol\@empty% + \else% + \expandafter\pgfsys@invoke\expandafter{\pgfsysprotocol@currentprotocol}% + \fi% +} + +\def\pgfsysprotocol@flushcurrentprotocol{% + \pgfsysprotocol@invokecurrentprotocol% + \pgfsysprotocol@setcurrentprotocol\@empty% +} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex new file mode 100644 index 00000000000..1eecaf431e9 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex @@ -0,0 +1,128 @@ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsyssoftpath.code.tex,v 1.1.1.1 2005/06/29 12:14:05 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + +% This package provides the pgf system path abstraction layer. This +% layer is used to construct paths first ``abstractly.'' These +% abstract paths can still be modified, before they are ``made +% concrete.'' +% +% An abstract path consists of a sequence of basic building blocks, +% each of which is a tuple consisting of two numbers (specifying a +% coordinate) and a token. Possible tokens are: +% +% 1. moveto +% 2. lineto +% 3. rectcorner +% 4. rectsize +% 5. curvetosupporta +% 6. curvetosupportb +% 7. curveto +% 8. closepath +% 9. specialround +% +% A curveto must always be preceeded by a curvetosupporta and a +% curvetosupportb. A non-empty path must always begin with a +% moveto. The coordinates of a closepath are non-specified, currently, +% but they might be set to the coordinate of the path segment start, +% in the future. + + + +\let\pgfsyssoftpath@currentpath=\@empty +% The current path + +\def\pgfsyssoftpath@lastmoveto{{0pt}{0pt}} + +% Add a moveto element to the current path +\def\pgfsyssoftpath@moveto#1#2{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@movetotoken{#1}{#2}% + }}% + \expandafter\g@addto@macro\expandafter\pgfsyssoftpath@currentpath\pgfsyssoftpath@temp% + \xdef\pgfsyssoftpath@lastmoveto{{#1}{#2}}% +} + +% Add a lineto element to the current path +\def\pgfsyssoftpath@lineto#1#2{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@linetotoken{#1}{#2}% + }}% + \expandafter\g@addto@macro\expandafter\pgfsyssoftpath@currentpath\pgfsyssoftpath@temp% +} + +% Add curveto elements to the current path +\def\pgfsyssoftpath@curveto#1#2#3#4#5#6{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@curvetosupportatoken{#1}{#2}% + \noexpand\pgfsyssoftpath@curvetosupportbtoken{#3}{#4}% + \noexpand\pgfsyssoftpath@curvetotoken{#5}{#6}% + }}% + \expandafter\g@addto@macro\expandafter\pgfsyssoftpath@currentpath\pgfsyssoftpath@temp% +} + +% Add rectanlge elements to the current path +\def\pgfsyssoftpath@rect#1#2#3#4{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@rectcornertoken{#1}{#2}% + \noexpand\pgfsyssoftpath@rectsizetoken{#3}{#4}% + }}% + \expandafter\g@addto@macro\expandafter\pgfsyssoftpath@currentpath\pgfsyssoftpath@temp% +} + +% Add closepath element to the current path +\def\pgfsyssoftpath@closepath{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@closepathtoken\pgfsyssoftpath@lastmoveto% + }}% + \expandafter\g@addto@macro\expandafter\pgfsyssoftpath@currentpath\pgfsyssoftpath@temp% +} + +% Add special element to the current path +\def\pgfsyssoftpath@specialround#1#2{% + \edef\pgfsyssoftpath@temp{{% + \noexpand\pgfsyssoftpath@specialroundtoken{#1}{#2}% + }}% + \expandafter\g@addto@macro\expandafter\pgfsyssoftpath@currentpath\pgfsyssoftpath@temp% +} + + +% Getting and setting the current path +\def\pgfsyssoftpath@getcurrentpath#1{% + \let#1=\pgfsyssoftpath@currentpath% +} + +\def\pgfsyssoftpath@setcurrentpath#1{% + \global\let\pgfsyssoftpath@currentpath=#1% +} + + +% Invoking the current path +\def\pgfsyssoftpath@invokecurrentpath{% + \pgfsyssoftpath@currentpath% +} + +\def\pgfsyssoftpath@flushcurrentpath{% + \pgfsyssoftpath@invokecurrentpath% + \pgfsyssoftpath@setcurrentpath\@empty% +} + +% Marshallers +\def\pgfsyssoftpath@movetotoken#1#2{\pgfsys@moveto{#1}{#2}} +\def\pgfsyssoftpath@linetotoken#1#2{\pgfsys@lineto{#1}{#2}} +\def\pgfsyssoftpath@rectcornertoken#1#2#3#4#5{\pgfsys@rect{#1}{#2}{#4}{#5}} % #3 = \pgfsyssoftpath@rectsizetoken +\def\pgfsyssoftpath@curvetosupportatoken#1#2#3#4#5#6#7#8{\pgfsys@curveto{#1}{#2}{#4}{#5}{#7}{#8}} +\def\pgfsyssoftpath@closepathtoken#1#2{\pgfsys@closepath} +\let\pgfsyssoftpath@specialroundtoken=\@gobbletwo + + +\endinput + +%%% Local Variables: +%%% mode: latex +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgf-latex-emulation.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgf-latex-emulation.tex new file mode 100644 index 00000000000..46ee571bf7d --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgf-latex-emulation.tex @@ -0,0 +1,291 @@ +% This file is pgf-latex-emulation.tex + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the LaTeX Project Public License Distributed from CTAN +% archives in directory macros/latex/base/lppl.txt. + +\catcode`\@=11\relax + +\def\pgf@test@fmtname{LaTeX2e} +\expandafter\ifx\csname fmtname\endcsname\pgf@test@fmtname% + \PackageError{pgf}{This file should not be loaded with \LaTeX.}{} +\else% + +% Direct copy from latex.ltx: +\long\def\@ifundefined#1#2#3{\expandafter\ifx\csname #1\endcsname\relax#2\else#3\fi} +\def\typeout#1{\immediate\write\@unused{#1}} +\alloc@7\write\chardef\sixt@@n\@unused +\let\@@par=\par +\def\@empty{} +\def\@gobble #1{} +\def\@gobbletwo #1#2{} +\long\def\@ifnextchar#1#2#3{% + \let\reserved@d=#1% + \def\reserved@a{#2}% + \def\reserved@b{#3}% + \futurelet\@let@token\@ifnch} +\def\@ifnch{% + \ifx\@let@token\@sptoken + \let\reserved@c\@xifnch + \else + \ifx\@let@token\reserved@d + \let\reserved@c\reserved@a + \else + \let\reserved@c\reserved@b + \fi + \fi + \reserved@c} +\def\in@#1#2{% + \def\in@@##1#1##2##3\in@@{% + \ifx\in@##2\in@false\else\in@true\fi}% + \in@@#2#1\in@\in@@} +\newif\ifin@ +\newdimen\@tempdima +\newdimen\@tempdimb +\newcount\@tempcnta +\newcount\@tempcntb +\def\@namedef#1{\expandafter\def\csname #1\endcsname} +\long\def\g@addto@macro#1#2{% + \begingroup + \toks@\expandafter{#1#2}% + \xdef#1{\the\toks@}% + \endgroup} +\long\def\mbox#1{\leavevmode\hbox{#1}} +\begingroup +\def\:{\global\let\@sptoken= } \: +\def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch} +\endgroup +\def\@nnil{\@nil} +\def\@fornoop#1\@@#2#3{} +\long\def\@for#1:=#2\do#3{% + \expandafter\def\expandafter\@fortmp\expandafter{#2}% + \ifx\@fortmp\@empty \else + \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}\fi} +\long\def\@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else + #5\def#4{#2}\ifx #4\@nnil \else#5\@iforloop #3\@@#4{#5}\fi\fi} +\long\def\@iforloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil + \expandafter\@fornoop \else + #4\relax\expandafter\@iforloop\fi#2\@@#3{#4}} +\def\@tfor#1:={\@tf@r#1 } +\long\def\@tf@r#1#2\do#3{\def\@fortmp{#2}\ifx\@fortmp\space\else + \@tforloop#2\@nil\@nil\@@#1{#3}\fi} +\long\def\@tforloop#1#2\@@#3#4{\def#3{#1}\ifx #3\@nnil + \expandafter\@fornoop \else + #4\relax\expandafter\@tforloop\fi#2\@@#3{#4}} +\chardef\@inputcheck0 +\def\IfFileExists#1#2#3{% + \openin\@inputcheck#1 % + \ifeof\@inputcheck + #3\relax + \else + #2\relax + \fi + \closein\@inputcheck} +\newbox\@tempboxa +\newif\if@tempswa +\long\def\@firstoftwo#1#2{#1} +\long\def\@secondoftwo#1#2{#2} + +% Simplified version of latex.ltx: +\def\PackageInfo#1#2{}%\typeout{Package #1: Info: #2.}}% +\def\PackageWarning#1#2{\typeout{Package #1: Warning! #2.}}% +\def\PackageError#1#2#3{\typeout{Package #1: Error! #2.}}% +\long\def\AtBeginDocument#1{#1}% +\long\def\AtBeginDvi#1{#1}% +\def\InputIfFileExists#1#2#3{\input #1\relax#2}% +\def\minipage[#1]#2{% + \hbox to#2\bgroup% + \hsize=#2\relax% + \vbox\bgroup\leavevmode% +} +\def\endminipage{\egroup\egroup} +\def\providecommand#1#2{\def#1{#2}} + +\def\newcounter#1{\expandafter\alloc@\expandafter0\expandafter\count\expandafter\countdef\expandafter\insc@unt\csname c@#1\endcsname}% +\def\setcounter#1#2{\global\csname c@#1\endcsname#2\relax}% +\def\addtocounter#1#2{\global\advance\csname c@#1\endcsname #2\relax} +\def\setlength#1#2{#1#2\relax} +\def\addtolength#1#2{\advance#1 #2\relax} + + +% Driver detector (not so good): +\ifx\pdfoutput\@undefined\alloc@0\count\countdef\insc@unt\pdfoutput\fi +\ifx\pdfoutput\relax\alloc@0\count\countdef\insc@unt\pdfoutput\fi +\ifcase\pdfoutput% + \gdef\Gin@driver{dvips.def}% +\else% + \gdef\Gin@driver{pdftex.def}% +\fi% + + +% Things that are not too clever, yet: +\def\selectfont{\rm} +\def\applycolormixins#1{} + + +% My ultra-quick xcolor.sty emulation... +\newif\ifglobalcolors +\def\definecolor#1#2#3{\csname pgf@emu@#2\endcsname{#1}#3\@nil} +\def\pgf@emu@rgb#1#2,#3,#4\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#3,#4}}} +\def\pgf@emu@gray#1#2\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#2,#2}}} + +\definecolor{white}{gray}{1} +\definecolor{black}{gray}{0} +\definecolor{gray}{gray}{0.5} +\definecolor{red}{rgb}{1,0,0} +\definecolor{green}{rgb}{0,1,0} +\definecolor{blue}{rgb}{0,0,1} +\definecolor{cyan}{rgb}{0,1,1} +\definecolor{magenta}{rgb}{1,0,1} +\definecolor{yellow}{rgb}{1,1,0} +\definecolor{orange}{rgb}{1,0.5,0} +\definecolor{violet}{rgb}{0.5,0,0.5} +\definecolor{purple}{rgb}{0.75,0,0.25} +\definecolor{brown}{rgb}{0.75,0.5,0.25} + +\def\color#1{% + \pgfsysprotocol@getcurrentprotocol\pgf@emu@temp% + {% + \pgfsysprotocol@setcurrentprotocol\@empty% + \pgfsysprotocol@bufferedtrue% + \pgfsetcolor{#1}% + \expandafter\pgfsys@outerinvoke\expandafter{\pgfsysprotocol@currentprotocol}% + }% + \pgfsysprotocol@setcurrentprotocol\pgf@emu@temp% + \edef\pgf@marshal{\noexpand\let\expandafter\noexpand\csname\string\color@.\endcsname=% + \expandafter\noexpand\csname\string\color@#1\endcsname}% + \pgf@marshal% + \aftergroup\reset@color% +} +\def\reset@color{% + \pgfsysprotocol@getcurrentprotocol\pgf@emu@temp% + {% + \pgfsysprotocol@setcurrentprotocol\@empty% + \pgfsysprotocol@bufferedtrue% + \pgfsetcolor{.}% + \expandafter\pgfsys@outerinvoke\expandafter{\pgfsysprotocol@currentprotocol}% + }% + \pgfsysprotocol@setcurrentprotocol\pgf@emu@temp% +} +\expandafter\def\csname\string\color@.\endcsname{\xcolor@{}{}{rgb}{0,0,0}} + + +\def\colorlet#1#2{% + \in@!{#2}% + \ifin@% + % compute mixture + {% + \pgf@emu@mix#2!white!\@nil% + \xdef\pgf@marshal{\noexpand\def\expandafter\noexpand\csname\string\color@#1\endcsname{% + \noexpand\xcolor@{}{}{rgb}{\pgf@sys@tonumber\pgf@xa,\pgf@sys@tonumber\pgf@xb,\pgf@sys@tonumber\pgf@xc}}}% + }% + \pgf@marshal% + \else% + \edef\pgf@marshal{\noexpand\let\expandafter\noexpand\csname\string\color@#1\endcsname=% + \expandafter\noexpand\csname\string\color@#2\endcsname}% + \pgf@marshal% + \fi% +} +\def\pgf@emu@mix#1!#2!#3!#4\@nil{% + \expandafter\expandafter\expandafter\pgf@emu@unpack\csname\string\color@#1\endcsname% + \pgf@ya=\pgf@xa% + \pgf@yb=\pgf@xb% + \pgf@yc=\pgf@xc% + \expandafter\expandafter\expandafter\pgf@emu@unpack\csname\string\color@#3\endcsname% + \c@pgf@counta=#2\relax% + \c@pgf@countb=100\relax% + \advance\c@pgf@countb by-\c@pgf@counta\relax% + \pgf@xa=\c@pgf@countb\pgf@xa% + \advance\pgf@xa by\c@pgf@counta\pgf@ya% + \divide\pgf@xa by 100\relax% + \pgf@xb=\c@pgf@countb\pgf@xb% + \advance\pgf@xb by\c@pgf@counta\pgf@yb% + \divide\pgf@xb by 100\relax% + \pgf@xc=\c@pgf@countb\pgf@xc% + \advance\pgf@xc by\c@pgf@counta\pgf@yc% + \divide\pgf@xc by 100\relax% +} +\def\pgf@emu@unpack#1#2#3#4#5{% + \pgf@emu@@unpack#5\@nil% +} +\def\pgf@emu@@unpack#1,#2,#3\@nil{% + \pgf@xa=#1pt% + \pgf@xb=#2pt% + \pgf@xc=#3pt% +} + +\def\extractcolorspec#1#2{% + \def#2{{#1}}% +} + +\def\convertcolorspec#1#2#3{% + \edef#3{\expandafter\expandafter\expandafter\pgf@emu@select\csname\string\color@#1\endcsname}% +} +\def\pgf@emu@select#1#2#3#4#5{#5} + + + + +% Adapted from keyval.sty: +\newtoks\KV@toks@ + +\ifx\setkeys\@undefined +\def\setkeys#1#2{% + \def\KV@prefix{KV@#1@}% + \let\@tempc\relax + \KV@do#2,\relax,} +\def\KV@do#1,{% + \ifx\relax#1\empty\else + \KV@split#1==\relax + \expandafter\KV@do\fi} +\def\KV@split#1=#2=#3\relax{% + \KV@@sp@def\@tempa{#1}% + \ifx\@tempa\@empty\else + \expandafter\let\expandafter\@tempc + \csname\KV@prefix\@tempa\endcsname + \ifx\@tempc\relax + \KV@errx + {\@tempa\space undefined}% + \else + \ifx\@empty#3\@empty + \KV@default + \else + \KV@@sp@def\@tempb{#2}% + \expandafter\@tempc\expandafter{\@tempb}\relax + \fi + \fi + \fi} +\def\KV@default{% + \expandafter\let\expandafter\@tempb + \csname\KV@prefix\@tempa @default\endcsname + \ifx\@tempb\relax + \KV@errx{No value specified for \@tempa}% + \else + \@tempb\relax + \fi} +\def\KV@errx#1{\PackageError{keyval}{#1}{}} +\def\@tempa#1{% +\def\KV@@sp@def##1##2{% + \futurelet\KV@tempa\KV@@sp@d##2\@nil\@nil#1\@nil\relax##1}% +\def\KV@@sp@d{% + \ifx\KV@tempa\@sptoken + \expandafter\KV@@sp@b + \else + \expandafter\KV@@sp@b\expandafter#1% + \fi}% +\def\KV@@sp@b#1##1 \@nil{\KV@@sp@c##1}% + } +\@tempa{ } +\def\KV@@sp@c#1\@nil#2\relax#3{\KV@toks@{#1}\edef#3{\the\KV@toks@}} +\def\define@key#1#2{% + \@ifnextchar[{\KV@def{#1}{#2}}{\@namedef{KV@#1@#2}####1}} +\def\KV@def#1#2[#3]{% + \@namedef{KV@#1@#2@default\expandafter}\expandafter + {\csname KV@#1@#2\endcsname{#3}}% + \@namedef{KV@#1@#2}##1} +\fi% +\fi% + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex new file mode 100644 index 00000000000..6d381dcbdec --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex @@ -0,0 +1,217 @@ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgffor.code.tex,v 1.2 2005/07/06 15:58:58 tantau Exp $ + +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + + + +\newdimen\pgffor@iter +\newdimen\pgffor@skip +\newif\ifpgffor@continue + +\let\pgffor@beginhook=\@empty +\let\pgffor@endhook=\@empty +\let\pgffor@afterhook=\@empty + +\def\foreach#1in#2{% + \def\pgffor@var{#1}% + \def\pgffor@values{#2, \pgffor@stop,}% + \let\pgffor@body\@empty% + \global\pgffor@continuetrue% + \pgffor@collectbody} + +\def\pgffor@collectbody{% + \@ifnextchar\foreach{\pgffor@collectforeach}{% + \@ifnextchar\bgroup{\pgffor@collectargument}{\pgffor@collectsemicolon}}% +} + +\def\pgffor@collectforeach\foreach#1in#2{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body\foreach#1in{#2}}% + \pgffor@collectbody% +} + +\long\def\pgffor@collectargument#1{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body{#1}}% + \pgffor@iterate% +} + + +\def\pgffor@collectsemicolon{% + \let\pgffor@next=\pgffor@collectnormalsemicolon% + \ifnum\the\catcode`\;=\active\relax% + \let\pgffor@next=\pgffor@collectactivesemicolon% + \fi% + \pgffor@next% +} + +\def\pgffor@collectnormalsemicolon#1;{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body#1;}% + \pgffor@iterate% +} + +{ + \catcode`\;=\active + + \gdef\pgffor@collectactivesemicolon#1;{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body#1;}% + \pgffor@iterate% + } +} + +\def\pgffor@iterate{% + \let\pgffor@last\@empty% + \let\pgffor@prevlast\@empty% + \expandafter\pgffor@scan\pgffor@values} + +\def\pgffor@stop{\pgffor@stop}% +\def\pgffor@dots{...}% + +\def\pgffor@scan{\@ifnextchar({\pgffor@scanround}{\pgffor@scanone}} +\def\pgffor@scanround(#1)#2,{\def\pgffor@value{(#1)}\pgffor@scanned} +\def\pgffor@scanone#1,{\def\pgffor@value{#1}\pgffor@scanned} + +\def\pgffor@scanned{% + \ifx\pgffor@value\pgffor@stop% + \let\pgffor@next=\pgffor@after% done! + \else% + \ifx\pgffor@value\pgffor@dots% + \let\pgffor@next=\pgffor@handledots% + \else% + \let\pgffor@next=\pgffor@handlevalue% + \fi% + \ifpgffor@continue% + \else% + \let\pgffor@next=\pgffor@scan% done! + \fi% + \fi% + \pgffor@next} + +\def\pgffor@after{% + \global\pgffor@continuetrue% + \pgffor@afterhook} + +\def\pgffor@handlevalue{% + \let\pgffor@prevlast\pgffor@last% + \let\pgffor@last\pgffor@value% + \pgffor@invokebody% + \pgffor@scan% +} + +\def\pgffor@invokebody{% + \begingroup% + \expandafter\in@\expandafter/\expandafter{\pgffor@var}% + \ifin@% + \expandafter\def\expandafter\pgffor@valuerest\expandafter{\pgffor@value//\relax}% + \expandafter\pgffor@multiassign\pgffor@var/\pgffor@stop/\pgffor@stop/\relax% + \else% + \expandafter\expandafter\expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@value}% + \fi% + \expandafter\pgffor@beginhook\pgffor@body\pgffor@endhook% + \endgroup% +} + + +\def\pgffor@multiassign#1/#2/\relax{% + \def\pgffor@currentvar{#1}% + \def\pgffor@rest{#2}% + \ifx\pgffor@currentvar\pgffor@stop% + \let\pgffor@next=\relax% + \else% + \let\pgffor@next=\pgffor@multiassignrest% + \fi% + \pgffor@next% +} + +\def\pgffor@multiassignrest{\expandafter\pgffor@multiassignfinal\pgffor@valuerest} +\def\pgffor@multiassignfinal#1/#2/\relax{% + \def\pgffor@test{#2}% + \ifx\pgffor@test\@empty% + \def\pgffor@valuerest{#1//\relax}% repeat + \else% + \def\pgffor@valuerest{#2/\relax}% + \fi% + \expandafter\def\pgffor@currentvar{#1}% + \expandafter\pgffor@multiassign\pgffor@rest/\relax% +} + + + + +\def\pgffor@handledots{% + \ifx\pgffor@last\@empty% + \PackageError{pgffor}{``...'' not allowed without prior value}{}% + \fi% + \pgffor@dotsscanend% +} +\def\pgffor@dotsscanend#1,{% + \def\pgffor@dotsend{#1}% + % calculate skip% + \ifx\pgffor@prevlast\@empty% + \ifdim\pgffor@dotsend pt>\pgffor@last pt% + \pgffor@skip=1pt% + \else% + \pgffor@skip=-1pt% + \fi% + \else% + \pgffor@skip=\pgffor@last pt% + \pgffor@iter=\pgffor@prevlast pt% + \advance\pgffor@skip by-\pgffor@iter% + \fi% + \pgffor@iter=\pgffor@last pt% + % do loop + \pgffor@loop% +} + +\def\pgffor@loop{% + \advance\pgffor@iter by\pgffor@skip% + \let\pgffor@next=\pgffor@doloop% + \ifdim\pgffor@skip<0pt% + \ifdim\pgffor@iter<\pgffor@dotsend pt% + \let\pgffor@next=\pgffor@endloop% + \fi% + \else% + \ifdim\pgffor@iter>\pgffor@dotsend pt% + \let\pgffor@next=\pgffor@endloop% + \fi% + \fi% + \ifpgffor@continue% + \else% + \let\pgffor@next=\pgffor@endloop% done! + \fi% + \pgffor@next% +} + +\def\pgffor@endloop{% + \pgffor@scan% +} + +{\catcode`\p=12\catcode`\t=12\gdef\Pgffor@geT#1pt{#1}} + +\def\pgffor@doloop{% + \begingroup% + \edef\pgffor@temp{\expandafter\Pgffor@geT\the\pgffor@iter}% + \edef\pgffor@incheck{{.0/}{\pgffor@temp/}}% + \expandafter\in@\pgffor@incheck% + \ifin@% + \expandafter\pgffor@strip\pgffor@temp% + \fi% + \expandafter\in@\expandafter/\expandafter{\pgffor@var}% + \ifin@% + \expandafter\def\expandafter\pgffor@valuerest\expandafter{\pgffor@temp//\relax}% + \expandafter\pgffor@multiassign\pgffor@var/\pgffor@stop/\pgffor@stop/\relax% + \else% + \expandafter\expandafter\expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@temp}% + \fi% + \expandafter\pgffor@beginhook\pgffor@body\pgffor@endhook% + \endgroup% + \pgffor@loop% +} + +\def\pgffor@strip#1.0{\def\pgffor@temp{#1}} + + +\def\breakforeach{\global\pgffor@continuefalse} + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex new file mode 100644 index 00000000000..3686eec117b --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex @@ -0,0 +1,85 @@ +% Copyright 2005 by Till Tantau . +% +% This program can be redistributed and/or modified under the terms +% of the GNU Public License, version 2. + +% The purpose of this file is to define the command +% \ProvidesPackageRCS, which should be followed by an RCS id +% string. This command will also be available in plain TeX, where it +% prints out a message to the log. + + +\def\pgfversion{1.00} + + +\ifx\pgfrcsloaded\undefined +\def\pgfrcsloaded{} + +\edef\pgfrcsatcode{\the\catcode`\@} +\catcode`\@=11 + +\def\@empty{} + +% Get date and version from RCS Ids +\def\pgf@parseid $#1: #2.#3,v #4 #5/#6/#7 #8${% + \pgf@parsercsfile$#2/$ + \def\pgf@rcssuffix{#3} + \def\pgf@rcsrevision{#4} + \def\pgf@rcsdate{#5/#6/#7} +} +\def\pgf@parsercsfile$#1/#2${ + \def\pgf@temp{#2} + \ifx\pgf@temp\@empty + \def\pgf@rcsfile{#1} + \else + \pgf@parsercsfile$#2$ + \fi} + +\def\ProvidesFileRCS $#1${ + \pgf@parseid $#1$ + \ProvidesFile{\pgf@rcsfile.\pgf@rcssuffix}[\pgf@rcsdate\space (rcs-revision \pgf@rcsrevision)] +} + +\def\ProvidesPackageRCS{% + \def\pgf@rcsadditional{}% + \afterassignment\pgfrcs@checkforoptional\let\next=} + +\def\pgfrcs@checkforoptional{% + \ifx\next[% + \let\next=\pgfrcs@getoptional% + \else + \let\next=\pgfrcs@package% + \fi% + \next}%} + +\def\pgfrcs@getoptional#1] ${% + \def\pgf@rcsadditional{#1}% + \pgfrcs@package% +} + +\def\pgfrcs@package#1${ + \pgf@parseid $#1$ + \ProvidesPackage{\pgf@rcsfile}[\pgf@rcsdate\space\pgf@rcsadditional\space(rcs-revision \pgf@rcsrevision)] +} + +\def\ProvidesClassRCS $#1$ [#2]{% + \pgf@parseid $#1$ + \ProvidesClass{\pgf@rcsfile}[\pgf@rcsdate\space#2\space (rcs-revision \pgf@rcsrevision)] +} + +\ifx\ProvidesPackage\@undefined + % plain tex + \def\ProvidesPackage#1[#2]{\wlog{Loading package #1 version #2.}} +\fi + +\ifx\ProvidesFile\@undefined + % plain tex + \def\ProvidesFile#1[#2]{\wlog{Loading file #1 version #2.}} +\fi + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgfrcs.code.tex,v 1.7 2005/10/23 16:16:21 tantau Exp $ + +\catcode`\@=\pgfrcsatcode + +\fi + -- cgit v1.2.3