diff options
author | Karl Berry <karl@freefriends.org> | 2010-10-29 00:31:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-10-29 00:31:31 +0000 |
commit | 6bc1f5497cfb2f56d65c80a4c36ea3bad6dc046c (patch) | |
tree | f7751da75030fb1e06653eeb44e579fcee09c65f /Master/texmf-dist/tex/generic/pgf/basiclayer | |
parent | ed0c7c756e441b2d2ba3633da233fc24361ac0d3 (diff) |
pgf 2.10 (28oct10)
git-svn-id: svn://tug.org/texlive/trunk@20236 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/basiclayer')
15 files changed, 1621 insertions, 377 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex index b76772cc4ac..8a7ab4a2862 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcore.code.tex,v 1.6 2008/01/15 10:27:34 tantau Exp $ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcore.code.tex,v 1.7 2010/04/11 07:09:19 ludewich Exp $ \newif\ifpgf@draftmode @@ -29,4 +29,7 @@ \input pgfcoretransparency.code.tex \input pgfcorepatterns.code.tex +\pgfutil@ifundefined{pgf@texdist@protect}{% + \def\pgf@texdist@protect{}% +}{} \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 index bdf4906c1be..19e73e0b44e 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorearrows.code.tex,v 1.8 2007/06/07 07:41:10 tantau Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorearrows.code.tex,v 1.11 2008/04/23 14:59:01 tantau Exp $ % Sets the end arrow @@ -89,7 +89,7 @@ % Called when an arrow needs to be rendered \def\pgf@arrow@call#1{% - \expandafter\ifx\csname pgf@arrow@prot@#1@\the\pgflinewidth\endcsname\relax% + \expandafter\ifx\csname\pgf@arrow@full@name{#1}\endcsname\relax% \pgfsysprotocol@getcurrentprotocol\pgf@arrow@temp% {% \pgfinterruptpath% @@ -105,13 +105,15 @@ \global\let\pgf@@arrow@temp=\pgf@@arrow@temp% \endpgfinterruptpath% \expandafter\def\expandafter\pgf@temp\expandafter{\expandafter\pgfsys@invoke\expandafter{\pgf@@arrow@temp}}% - \expandafter\global\expandafter\let\csname pgf@arrow@prot@#1@\the\pgflinewidth\endcsname=\pgf@temp% + \expandafter\global\expandafter\let\csname\pgf@arrow@full@name{#1}\endcsname=\pgf@temp% }% \pgfsysprotocol@setcurrentprotocol\pgf@arrow@temp% \fi% - \csname pgf@arrow@prot@#1@\the\pgflinewidth\endcsname% + \csname\pgf@arrow@full@name{#1}\endcsname% } +\def\pgf@arrow@full@name#1{pgf@arrow@prot@#1@\the\pgflinewidth @\pgfinnerlinewidth @\pgfgetarrowoptions{#1}} + \def\pgf@arrow@code@{} % dummy \def\pgf@nousepath@here#1{% @@ -119,6 +121,41 @@ } +% Get options for an arrow +% +% #1 = arrow tip name +% +% Description: +% +% For every arrow tip certain options can be set, which may influence +% the appearance of the arrow tip. How the options are used is up the +% arrow tip code. This command will expand to the current value of +% the options for this tip. The default is 0. + +\def\pgfgetarrowoptions#1{% + \expandafter\ifx\csname pgf@arrow@opt@#1\endcsname\relax0\else\csname pgf@arrow@opt@#1\endcsname\fi% +} + + +% Set options for an arrow +% +% #1 = arrow tip name +% #2 = options +% +% Description: +% +% Sets the arrow tip options for an arrow. The options should be a +% normal string and will be used to detect whether an arrow should be +% recached. For instance, when you set the arrow tip options of +% "myarrow" to "1", the arrow will be rendered in a certain way. Then, +% when you set the options to "2", the arrow will be rerendered. + +\def\pgfsetarrowoptions#1#2{% + \expandafter\def\csname pgf@arrow@opt@#1\endcsname{#2}% +} + + + % Define an arrow type. % @@ -374,13 +411,21 @@ \pgfarrowsdeclare{stealth}{stealth} { \pgfutil@tempdima=0.28pt% - \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfutil@tempdimb=\pgflinewidth% + \ifdim\pgfinnerlinewidth>0pt% + \pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}% + \fi% + \advance\pgfutil@tempdima by.3\pgfutil@tempdimb% \pgfarrowsleftextend{+-3\pgfutil@tempdima} \pgfarrowsrightextend{+5\pgfutil@tempdima} } { \pgfutil@tempdima=0.28pt% - \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfutil@tempdimb=\pgflinewidth% + \ifdim\pgfinnerlinewidth>0pt% + \pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}% + \fi% + \advance\pgfutil@tempdima by.3\pgfutil@tempdimb% \pgfpathmoveto{\pgfqpoint{5\pgfutil@tempdima}{0pt}} \pgfpathlineto{\pgfqpoint{-3\pgfutil@tempdima}{4\pgfutil@tempdima}} \pgfpathlineto{\pgfpointorigin} @@ -464,13 +509,21 @@ \pgfarrowsdeclare{latex}{latex} { \pgfutil@tempdima=0.28pt% - \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfutil@tempdimb=\pgflinewidth% + \ifdim\pgfinnerlinewidth>0pt% + \pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}% + \fi% + \advance\pgfutil@tempdima by.3\pgfutil@tempdimb% \pgfarrowsleftextend{+-1\pgfutil@tempdima} \pgfarrowsrightextend{+9\pgfutil@tempdima} } { \pgfutil@tempdima=0.28pt% - \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfutil@tempdimb=\pgflinewidth% + \ifdim\pgfinnerlinewidth>0pt% + \pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}% + \fi% + \advance\pgfutil@tempdima by.3\pgfutil@tempdimb% \pgfpathmoveto{\pgfqpoint{9\pgfutil@tempdima}{0pt}} \pgfpathcurveto {\pgfqpoint{6.3333\pgfutil@tempdima}{.5\pgfutil@tempdima}} @@ -509,5 +562,24 @@ } +% A space arrow +% +% This arrow can be combined with other arrows to add "space" around +% them. +% +% Example: +% +% \pgfarrowsdeclarecombine{my<}{my>}{<}{>}{space}{space} + +\pgfarrowsdeclare{space}{space} +{ + \pgfutil@tempdima=0.88pt% + \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfarrowsleftextend{0pt} + \pgfarrowsrightextend{\pgfutil@tempdima} +} +{} + + \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex new file mode 100644 index 00000000000..d8eaca5aee7 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex @@ -0,0 +1,501 @@ +% Copyright 2006 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreexternal.code.tex,v 1.17 2010/09/01 08:56:40 ludewich Exp $ + + + +\newif\ifpgfexternal@aux@in@dpth +\newif\ifpgfexternal@info + +\pgfkeys{ + /pgf/images/include external/.code={\pgfimage{#1}}, + /pgf/images/aux in dpth/.is if=pgfexternal@aux@in@dpth, + /pgf/images/aux in dpth/.default=true, + /pgf/images/trim external/.code n args={4}{% + \def\pgf@external@kern@left{#1}% + \def\pgf@external@kern@bottom{#2}% + \def\pgf@external@kern@right{#3}% + \def\pgf@external@kern@top{#4}% + \ifx\pgf@external@kern@left\pgfutil@empty\def\pgf@external@kern@left{0sp}\fi% + \ifx\pgf@external@kern@bottom\pgfutil@empty\def\pgf@external@kern@bottom{0sp}\fi% + \ifx\pgf@external@kern@right\pgfutil@empty\def\pgf@external@kern@right{0sp}\fi% + \ifx\pgf@external@kern@top\pgfutil@empty\def\pgf@external@kern@top{0sp}\fi% + }, + /pgf/images/trim external={1truein}{1truein}{1truein}{1truein}, + /pgf/images/external info/.is if=pgfexternal@info, + /pgf/images/external info/.default=true, +} + +% The external read/write mechanism is used as follows: +% +% In your document, you put a number or all of your pgfpicture (or +% tikzpicture) environments inside a pair of \beginpgfexternal and +% \endpgfexternal. The \beginpgfexternal gets one parameter called the +% graphics name. +% +% Once this is done, the next step is to declare the names of your +% graphics in the document at the beginning using the +% \pgfdeclaregraphicname command. +% +% Now, when you typeset your document, each time a \beginpgfexternal +% command is encountered, it will be checked whether the corresponding +% graphics file exists. If this is the case, it will be included and +% the code between \beginpgfexternal and \endpgfexternal is +% ignored. Otherwise, the code is executed normally. +% +% Things change when you run tex on your file with the \jobname set to +% the name of a decalred graphics name. In this case, only your +% graphic will be typeset, the rest of the document will be "thrown away". +% To be more precise, everything is gobbled up to the beginning +% of the first \beginpgfexternal with the given graphics name. Then, +% the content of the "environment" is put in a box (this "environment" +% need not contain a graphics, it may contain anything that can be put +% in a box). Then a single page is output whose size is exactly the +% size of the picture. +% +% So, once you have run tex repeatedly, each time with the jobname set +% to each of the graphics, you can then run tex on the whole document +% and this will cause all graphics to be included rather than begin +% typeset. +% +% Finally, once all the graphics have been created, you can also say +% \input pgfexternal.tex instead of including pgf/TikZ. + + +\newif\ifpgfexternalreadmainaux +\pgfexternalreadmainauxtrue + +% Tells pgf which jobname is the name of the real file +% +% #1 = name +% +% Description: +% +% This command is used to tell pgf that the file named #1 should be +% typeset normally. If \jobname is not equal to #1, only +% the graphic called \jobname will be typeset. +% +% Example: +% +% \pgfrealjobname{survey} +% +% Note that afterwards, \jobname will be set to the argument. In our +% example, \jobname will be 'survey'. This is to accomplish +% compatibility with aux-file generation. + +\def\pgfrealjobname#1{% + \global\let\pgfactualjobname=\jobname + \edef\pgf@tempa{\expandafter\string\csname #1\endcsname}% + \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}% + \ifx\pgf@tempa\pgf@tempb% + \else% + \pgf@external@grabshipouttrue% + \pgfexternal@nofiles% see also \pgf@external@init@aux@in@dpth + \ifpgfexternalreadmainaux + % and reset the jobname. This should allow to handle any + % \label/\ref constructions which are stored in \jobname.aux (and + % which won't be found otherwise) + \gdef\jobname{#1}% + \fi + \ifpgfexternal@aux@in@dpth + \csname newwrite\endcsname\w@pgfexternal@auxout + \fi + \fi% + \gdef\pgfrealjobname##1{}% avoid multiple calls. +} + +\def\pgfexternal@nofiles{% + % replace \relax. The \nofiles macros does + % \let\makeglossary=\relax + % but the glossary.sty calls \renewcommand\makeglossary (which + % will fail if \makeglossary=\relax). Stupid, but it works. + \let\pgfexternal@nofiles@=\relax + \def\relax{\relax}% + % + % suppress generation of LaTeX .aux, .toc etc files. + % generation of these files is not thread-safe. + % the \csname \endcsname yields \relax if \nofiles doesn't exist. + \csname nofiles\endcsname + % + \let\relax=\pgfexternal@nofiles@ +}% + +\newif\ifpgf@external@grabshipout +\newbox\pgfexternal@startupbox + +\pgfutil@ifundefined{AtBeginDocument}{}{% + \AtBeginDocument{% + \ifpgf@external@grabshipout% + \global\let\pgfexternal@originalshipout=\shipout% + \global\def\shipout{\setbox\pgfpic=}% + \maxdeadcycles=10000% + % Ok, gather everything we have seen up to now in a box. This box + % will contain any specials that have been used. + {% + \output{\global\setbox\pgfexternal@startupbox=\vbox{\csname @begindvi\endcsname\unvbox255}}% + \hbox{}\eject% + }% + \fi% + } +}% + +\pgfutil@ifundefined{AtEndDocument}{}{% + \AtEndDocument{% + \ifpgf@external@grabshipout + \pgfutil@ifundefined{pgfexternal@did@a@shipout}{% + \pgfexternal@error@no@shipout + }{}% + \fi + }% +} + +% This will be overwritten by the tikz external lib if it is loaded. +\def\pgfexternal@error@no@shipout{% + \PackageError{pgf}{Sorry, image externalization failed: the resulting image was EMPTY. I tried to externalize '\pgfactualjobname'. Perhaps there was a typo somewhere? Please check that your document contains '\string\beginpgfgraphicnamed{\pgfactualjobname} ... \string\endpgfgraphicnamed'}% +}% + + +% "Environment" for an external graphic. +% +% #1 = graphic name +% +% Example: +% +% \beginpgfgraphicnamed{main-graphic2} +% \begin{tikzpicture} +% ... +% \end{tikzpicture} +% \endpgfgraphicnamed + +\def\pgf@externalbegin#1{% + % First, check whether we wish to grab this graphic: + \let\pgf@next=\pgf@external@normal% + \ifpgf@external@grabshipout% + \edef\pgf@tempa{\expandafter\string\csname #1\endcsname}% + \edef\pgf@tempb{\expandafter\string\csname\pgfactualjobname\endcsname}% + \ifx\pgf@tempa\pgf@tempb% + \let\pgf@next=\pgf@external@grab% + \fi% + \fi% + \pgf@next{#1}% +} + + +\AtBeginDocument{ + \let\beginpgfgraphicnamed=\pgf@externalbegin% overwrite definition of pgfexternal.tex if necessary + \let\endpgfgraphicnamed=\unskip +} + + +% Normal operation: Include an external graphic instead of the +% picture, if such an external picture exists. +\def\pgf@external@normal#1{% + \let\pgf@filename=\pgfutil@empty% + \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#1}% + \ifx\pgf@filename\pgfutil@empty% + % Ok, no such image... Just typeset the picture normally. + \let\pgf@next=\relax% + \else% + \let\pgf@next=\pgf@replacepicturebygraphic% + \fi% + \pgf@next% +} + +\long\def\pgf@replacepicturebygraphic#1\endpgfgraphicnamed{% + \expandafter\pgfincludeexternalgraphics\expandafter{\pgf@filename}\unskip +} + +% This is almost the same as \includegraphics{#1}, but it checks +% whether '#1.dpth' exists. In such case, it restores the boxes depth +% stored in #1.dpth. +% +% Furthermore, the .dpth file may contain .aux related information +% collected for the external graphics (references). They start after +% the first line (if any). +\def\pgfincludeexternalgraphics#1{% + \begingroup + \pgfexternalreaddpth{#1}% + \pgfkeysifdefined{/pgf/images/include external/#1/.@cmd}{% + \pgfkeysgetvalue{/pgf/images/include external/#1/.@cmd}\pgf@tempa + \pgfkeyslet{/pgf/images/include external/.@cmd}\pgf@tempa + }{}% + \setbox1=\hbox{\pgfkeysvalueof{/pgf/images/include external/.@cmd}{#1}\pgfeov}% + \ifdim\pgfexternaltrimleft=0sp \else \kern\pgfexternaltrimleft\relax \fi + \ifdim\pgfexternaldepth=0pt + \box1 + \else + \dimen0=\pgfexternaldepth\relax + \hbox{\lower\dimen0 \box1 }% + \fi + \ifdim\pgfexternaltrimright=0sp \else \kern\pgfexternaltrimright\relax \fi + \endgroup +} + +% Defines \pgfexternaldepth to be the depth of the external picture +% '#1' and \pgfexternaltrimleft / \pgfexternaltrimright to be the 'hbaseline' shift. +% +% +% Furthermore, it handles any auxiliary information stored in the +% .dpth file (it appends it to the main aux file). +% +\def\pgfexternalreaddpth#1{% + % no \begingroup. Handle that manually: + \edef\pgfexternalreaddpth@restore{% + \noexpand\endlinechar=\the\endlinechar\space + \noexpand\catcode`\noexpand\@=\the\catcode`\@\space + }% + % + \def\pgfexternaldepth{0sp}% + \def\pgfexternaltrimleft{0sp}% + \def\pgfexternaltrimright{0sp}% + \endlinechar=-1 % suppress white space at end + \catcode`\@=11 + \openin\r@pgf@reada=#1.dpth + \pgfincludeexternalgraphics@read@dpth + % + \pgfexternalreaddpth@restore +}% +% +% The .dpth consists of 0-N lines, where each is either a single +% dimension (the box' depth) or something which belongs to the .aux +% file (such lines will always start with a macro). +\def\pgfincludeexternalgraphics@read@dpth{% + \ifeof\r@pgf@reada + \closein\r@pgf@reada + \else + \read\r@pgf@reada to\pgfincludeexternalgraphics@auxline + \ifx\pgfincludeexternalgraphics@auxline\pgfutil@empty + \else + \expandafter\pgfincludeexternalgraphics@read@dpth@line\pgfincludeexternalgraphics@auxline\pgfincludeexternalgraphics@read@dpth@line@EOI + \fi + \expandafter\pgfincludeexternalgraphics@read@dpth + \fi +}% + +\def\pgfexternal@restore#1{#1}% + +\long\def\pgfincludeexternalgraphics@read@dpth@line@getfirst#1#2\pgfincludeexternalgraphics@read@dpth@line@EOI{% + \def\pgf@first{#1}% +}% +\long\def\pgfincludeexternalgraphics@read@dpth@line#1\pgfincludeexternalgraphics@read@dpth@line@EOI{% + \pgfincludeexternalgraphics@read@dpth@line@getfirst#1\pgfincludeexternalgraphics@read@dpth@line@EOI + \expandafter\ifcat\expandafter\noexpand\pgf@first\relax + % Ah -- the first token is a control sequence. It belongs to + % the .aux file. + % + \expandafter\ifx\pgf@first\pgfexternal@restore + #1% + \else + % do NOT execute #1! many LaTeX commands don't support it (\label for example) + \pgfutil@ifundefined{if@filesw}{% + % sorry, .aux file support only for latex + }{% + % append to main .aux file (for forward references) + \if@filesw + {% + \toks0={#1}% + % believe it or not, but the + % \def\dpthimport{...}\dpthimport *makes* a + % difference! In ensures any occuring `##' characters are properly expanded to `#'. + \immediate\write\@auxout{% + \noexpand\def\noexpand\dpthimport{\the\toks0}\noexpand\dpthimport}% + }% + \fi + }% + \fi + \else% it is the depth (which is simply a number for backwards compatibility) + \def\pgfexternaldepth{#1}% + \fi +}% + +% Stores '#1' (expanded!) into the .dpth file of the currently +% exported image. +% +% This command has only an effect if an image is being exported. +% +% The stored contents will be read in the context where +% /pgf/images/include external is active (i.e. by +% \pgfexternalreaddpth). +% +\def\pgfexternalstorecommand#1{% +}% +\def\pgfexternalstorecommand@isexporting#1{% + \immediate\write\w@pgfexternal@auxout{\noexpand\pgfexternal@restore{#1}}% +}% + + + +% Grab operation: If jobname matches the graphic name, typeset this +% picture normall. +% REMARK: +% this method is also invoked from within the tikz external library. +\def\pgf@external@grab#1{% + \def\pgf@filename{#1}% + \ifpgfexternal@aux@in@dpth + \begingroup + \pgf@external@init@aux@in@dpth + \let\G@refundefinedtrue=\pgf@external@grab@refundefinedtrue + \fi + \gdef\pgf@trimleft@final{0sp}% + \gdef\pgf@trimright@final{0sp}% + \setbox\pgfpic=\hbox\bgroup\bgroup% + \let\endpgfgraphicnamed=\pgf@externalend% +} + +{\catcode`\^=12 \gdef\pgfexternal@hat{^}} + +\expandafter\let\expandafter\pgf@external@grab@refundefinedtrue@orig\csname G@refundefinedtrue\endcsname + +\def\pgf@external@grab@refundefinedtrue{% + \pgf@external@grab@refundefinedtrue@orig + \begingroup + \def\n{\pgfexternal@hat\pgfexternal@hat J}% + \pgfexternalstorecommand{% + \noexpand\immediate\noexpand\write16{\pgf@external@grab@refundefinedtrue@warning}% + \noexpand\G@refundefinedtrue + }% + \endgroup +}% +\def\pgf@external@grab@refundefinedtrue@warning{% + LaTeX Warning: External picture `\pgfactualjobname' contains undefined references\noexpand\on@line.\n +}% + +\let\pgf@external@@protected@write@orig=\protected@write +\long\def\pgf@external@@protected@write@immediate#1#2#3{% + \begingroup + \let\pgf@write@=\write + \def\write{\noexpand\immediate\pgf@write@}% + \pgf@external@@protected@write@orig{#1}{#2}{#3}% + \endgroup +}% + +\def\pgf@external@init@aux@in@dpth{% + \let\pgfexternalstorecommand=\pgfexternalstorecommand@isexporting + % + % tell LaTeX to write aux files... + \csname @fileswtrue\endcsname + % ... but redirect output to the .dpth file! + \immediate\openout\w@pgfexternal@auxout=\pgf@filename.dpth + \let\@auxout=\w@pgfexternal@auxout + % ... and disable the correct page numbers. I can't get that + % (because the correct page number is only available in the + % shipout routine). Use immediate output: + \let\protected@write=\pgf@external@@protected@write@immediate +}% + +\def\pgf@externalend@storeshifts#1{% + \immediate\write#1{\the\dp\pgfpic}% store the depth simply as number for backw. compat. + \ifx\pgf@trimleft@final\pgfutil@empty\else + \immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternaltrimleft{\pgf@trimleft@final}}}% + \fi + \ifx\pgf@trimright@final\pgfutil@empty\else + \immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternaltrimright{\pgf@trimright@final}}}% + \fi + \ifpgfexternal@info + \immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternalwidth{\the\wd\pgfpic}}}% + \immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternalheight{\the\dimen0}}}% + \fi +} +% REMARK: +% this method is also invoked from within the tikz external library. +\def\pgf@externalend{% + \unskip\egroup\egroup% + {% + \def\pgf@external@trim{0}% + \def\pgf@external@store@dpth{0}% + % + \ifpgf@trim@lowlevel + \gdef\pgf@trimleft@final{}% + \gdef\pgf@trimright@final{}% + \else + \ifdim\pgf@trimleft@final=0sp \gdef\pgf@trimleft@final{} \else\def\pgf@external@trim{1}\fi + \ifdim\pgf@trimright@final=0sp \gdef\pgf@trimright@final{} \else\def\pgf@external@trim{1}\fi + \if1\pgf@external@trim + % UNDO the trimming! export to pdf doesn't supported trimmed + % bounding boxes (has to do with the mediabox/trimbox etc). + % I'll keep the bounding box intact and store the trim information + % into the .dpth file. + \setbox\pgfpic=\hbox{% + \ifx\pgf@trimleft@final\pgfutil@empty\else\kern-\pgf@trimleft@final\fi + \box\pgfpic + \ifx\pgf@trimright@final\pgfutil@empty\else\kern-\pgf@trimright@final\fi + }% + \def\pgf@external@store@dpth{1}% + \fi + \fi + % + \parindent0pt % leave the space +% \leftmargin0pt% +% \rightmargin0pt% + \hoffset=0pt % reset to default + \voffset=0pt + \dimen0\ht\pgfpic% + \advance\dimen0\dp\pgfpic% + \ifdim\dp\pgfpic=0pt\relax + \else% store the picture's depth. Otherwise, it would be lost. + \def\pgf@external@store@dpth{1}% + \fi + \ifpgfexternal@info + \def\pgf@external@store@dpth{1}% + \fi + % + \if1\pgf@external@store@dpth + \ifpgfexternal@aux@in@dpth + \pgf@externalend@storeshifts\@auxout + \immediate\closeout\@auxout + \else + \immediate\openout\pgf@plotwrite=\pgf@filename.dpth + \pgf@externalend@storeshifts\pgf@plotwrite + \immediate\closeout\pgf@plotwrite + \fi + \fi + \pgfsys@papersize{\the\wd\pgfpic}{\the\dimen0}% + % + \setbox0=\vbox{% + % I admit that I don't know why there is this kerning: + \kern -\pgf@external@kern@top\relax% + \hbox{% + \kern -\pgf@external@kern@left\relax% + \hbox to0pt{% + \wd\pgfexternal@startupbox=0pt % + \ht\pgfexternal@startupbox=0pt % + \dp\pgfexternal@startupbox=0pt % + \box\pgfexternal@startupbox% + \pgfsys@atbegindocument\hss}% + \box\pgfpic% + \kern\pgf@external@kern@right\relax% + }% + \kern\pgf@external@kern@bottom\relax% + }% + % + % compatibility with eso-pic package: \nointerlineskip is not + % allowed here, but the eso-pic package uses \nointerlineskip in + % its shipout routine. + \let\pgfexternal@nointerlineskip@orig=\nointerlineskip + \let\nointerlineskip=\pgfexternal@nointerlineskip + % + \pgfexternal@originalshipout\box0 % + \gdef\pgfexternal@did@a@shipout{1}% + }% + \ifpgfexternal@aux@in@dpth + \endgroup + \fi +} + +\def\pgfexternal@nointerlineskip{% + \ifvmode + \pgfexternal@nointerlineskip@orig + \else + \relax% \nointerlineskip in horizontal mode not allowed. Silently ignore the error message. + \fi +}% + +\endinput +% vi: tabstop=4 shiftwidth=2 expandtab diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex index b3a04e6cad0..eeb6c3e8635 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex,v 1.8 2007/12/12 16:57:17 tantau Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex,v 1.9 2008/04/22 17:03:26 tantau Exp $ % Globals @@ -29,6 +29,45 @@ \ignorespaces} +% Set the inner line width to #1. +% +% #1 = new inner line width. +% +% Description: +% +% The inner line width is the width of a second line that is drawn on +% top of the main stroked line. If the inner line width is 0pt, no +% inner line is drawn. The main use of inner lines is for creating +% "double" lines. +% +% Inner lines are not drawn when a path is used for clipping. +% +% The inner line width is local to the current TeX group, it is not +% part of the graphic state. +% +% Example: +% +% \pgfsetinnerlinewidth{1pt} + +\def\pgfsetinnerlinewidth#1{% + \pgfmathsetlength\pgf@x{#1}% + \edef\pgfinnerlinewidth{\the\pgf@x}% +} +\def\pgfinnerlinewidth{0pt} + + +% Set the inner line color to #1. +% +% #1 = color for the inner line +% +% Example: +% +% \pgfsetinnerlinecolor{green} % yikes! + +\def\pgfsetinnerstrokecolor#1{\def\pgfinnerstrokecolor{#1}} +\def\pgfinnerstrokecolor{white} + + % Set the miter limit to #1. % % #1 = new miter limit factor. diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex index d74d3d1f84f..59a3699f70d 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreimage.code.tex,v 1.1 2008/01/15 10:27:34 tantau Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreimage.code.tex,v 1.16 2010/03/25 20:57:13 ludewich Exp $ @@ -47,10 +47,10 @@ \PackageWarning{pgf}% {File "#3" not found when defining image "#2".\MessageBreak Tried all extensions in "\pgfsys@imagesuffixlist"}% - \pgf@declaredraftimage{#2}% + \pgf@declaredraftimage{#2}{#3}% \else% \ifpgf@draftmode% - \pgf@declaredraftimage{#2}% + \pgf@declaredraftimage{#2}{#3}% \else% \pgfsys@defineimage% \fi% @@ -58,10 +58,14 @@ \expandafter\global\expandafter\let\csname pgf@image@#2!\endcsname=\pgf@image% } + +\pgfkeys{ + /pgf/images/draft/.is if=pgf@draftmode, + /pgf/images/draft/.default=true} \pgfkeys{/pgf/images/width/.estore in=\pgf@imagewidth} \pgfkeys{/pgf/images/height/.estore in=\pgf@imageheight} \pgfkeys{/pgf/images/page/.estore in=\pgf@imagepage} -\pgfkeys{/pgf/images/interpolate/.cd,.code=\edef\pgf@imageinterpolate{/Interpolate #1},.default=true} +\pgfkeys{/pgf/images/interpolate/.cd,.code=\edef\pgf@imageinterpolate{#1},.default=true} \pgfkeys{/pgf/images/mask/.code=% {% \edef\pgf@imagemask{#1}% @@ -71,10 +75,6 @@ {\PackageError{pgf}{Undefined mask "#1".}{}% \edef\pgf@imagemask{}}% {\edef\pgf@imagemask{\csname pgf@mask@#1\endcsname}% - \ifx\pgf@imagemask\pgfutil@empty% - \else - \edef\pgf@imagemask{/SMask \pgf@imagemask\space 0 R}% - \fi% }% \fi% }} @@ -88,13 +88,15 @@ \pgf@findfile#2+{#3}% \fi}} -\def\pgf@declaredraftimage#1{% +% #1: image name +% #2: file name +\def\pgf@declaredraftimage#1#2{% \ifx\pgf@imagewidth\pgfutil@empty% - \PackageWarning{pgf}{Missing width for image "#1" in draft mode.\MessageBreak Using 1cm instead}% + \PackageWarning{pgf}{Missing width for image "#1" ("#2") in draft mode.\MessageBreak Using 1cm instead}% \edef\pgf@imagewidth{1cm}% \fi% \ifx\pgf@imageheight\pgfutil@empty% - \PackageWarning{pgf}{Missing height for image "#1" in draft mode.\MessageBreak Using 1cm instead}% + \PackageWarning{pgf}{Missing height for image "#1" ("#2") in draft mode.\MessageBreak Using 1cm instead}% \edef\pgf@imageheight{1cm}% \fi% \ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepagetext{ page \pgf@imagepage}\fi% @@ -103,7 +105,7 @@ \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}% + \hbox to \pgf@imagewidth{\hskip-10cm\hfil\noexpand\tiny#2\pgf@imagepage\hfil\hskip-10cm}% \vfil\hrule}% \kern-0.4pt\vrule}% }% @@ -143,7 +145,7 @@ {File "#3" not found when defining mask "#2".\MessageBreak Tried all extensions in "\pgfsys@imagesuffixlist"}% \else% - \pgfsys@definemask% + \pgfsys@definemask{#2}% \fi% \expandafter\global\expandafter\let\csname pgf@mask@#2\endcsname=\pgf@mask% } @@ -236,173 +238,6 @@ \pgfuseimage{pgflastimage}} - - - - - - -% The external read/write mechanism is used as follows: -% -% In your document, you put a number or all of your pgfpicture (or -% tikzpicture) environments inside a pair of \beginpgfexternal and -% \endpgfexternal. The \beginpgfexternal gets one parameter called the -% graphics name. -% -% Once this is done, the next step is to declare the names of your -% graphics in the document at the beginning using the -% \pgfdeclaregraphicname command. -% -% Now, when you typeset your document, each time a \beginpgfexternal -% command is encountered, it will be checked whether the corresponding -% graphics file exists. If this is the case, it will be included and -% the code between \beginpgfexternal and \endpgfexternal is -% ignored. Otherwise, the code is executed normally. -% -% Things change when you run tex on your file with the \jobname set to -% the name of a decalred graphics name. In this case, only your -% graphic will be typeset, the rest of the document will be "thrown away". -% To be more precise, everything is gobbled up to the beginning -% of the first \beginpgfexternal with the given graphics name. Then, -% the content of the "environment" is put in a box (this "environment" -% need not contain a graphics, it may contain anything that can be put -% in a box). Then a single page is output whose size is exactly the -% size of the picture. -% -% So, once you have run tex repeatedly, each time with the jobname set -% to each of the graphics, you can then run tex on the whole document -% and this will cause all graphics to be included rather than begin -% typeset. -% -% Finally, once all the graphics have been created, you can also say -% \input pgfexternal.tex instead of including pgf/TikZ. - - - -% Tells pgf which jobname is the name of the real file -% -% #1 = name -% -% Description: -% -% This command is used to tell pgf that the file named #1 should be -% typeset normally. If \jobname is not equal to #1, only -% the graphic called \jobname will be typeset. -% -% Example: -% -% \pgfrealjobname{survey} - -\def\pgfrealjobname#1{% - \edef\pgf@tempa{\expandafter\string\csname #1\endcsname}% - \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}% - \ifx\pgf@tempa\pgf@tempb% - \else% - \pgf@external@grabshipouttrue% - \fi% -} - - -\newif\ifpgf@external@grabshipout -\newbox\pgfexternal@startupbox - -\AtBeginDocument{% - \ifpgf@external@grabshipout% - \global\let\pgfexternal@originalshipout=\shipout% - \global\def\shipout{\setbox\pgfpic=}% - \maxdeadcycles=10000% - % Ok, gather everything we have seen up to now in a box. This box - % will contain any specials that have been used. - {% - \output{\global\setbox\pgfexternal@startupbox=\vbox{\csname @begindvi\endcsname\unvbox255}}% - \hbox{}\eject% - }% - \fi% -} - - -% "Environment" for an external graphic. -% -% #1 = graphic name -% -% Example: -% -% \beginpgfgraphicnamed{main-graphic2} -% \begin{tikzpicture} -% ... -% \end{tikzpicture} -% \endpgfgraphicnamed - -\def\pgf@externalbegin#1{% - % First, check whether we wish to grab this graphic: - \let\pgf@next=\pgf@external@normal% - \ifpgf@external@grabshipout% - \edef\pgf@tempa{\expandafter\string\csname #1\endcsname}% - \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}% - \ifx\pgf@tempa\pgf@tempb% - \let\pgf@next=\pgf@external@grab% - \fi% - \fi% - \pgf@next{#1}% -} - - -\AtBeginDocument{ - \let\beginpgfgraphicnamed=\pgf@externalbegin% overwrite definition of pgfexternal.tex if necessary - \let\endpgfgraphicnamed=\unskip -} - - -% Normal operation: Include an external graphic instead of the -% picture, if such an external picture exists. -\def\pgf@external@normal#1{% - \let\pgf@filename=\pgfutil@empty% - \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#1}% - \ifx\pgf@filename\pgfutil@empty% - % Ok, no such image... Just typeset the picture normally. - \let\pgf@next=\relax% - \else% - \let\pgf@next=\pgf@replacepicturebygraphic% - \fi% - \pgf@next% -} - -\long\def\pgf@replacepicturebygraphic#1\endpgfgraphicnamed{\includegraphics{\pgf@filename}\unskip} - - -% Grab operation: If jobname matches the graphic name, typeset this -% picture normall. - -\def\pgf@external@grab#1{% - \setbox\pgfpic=\hbox\bgroup\bgroup% - \let\endpgfgraphicnamed=\pgf@externalend% -} - -\def\pgf@externalend{% - \unskip\egroup\egroup% - {% - \parindent0pt% - \leftmargin0pt% - \rightmargin0pt% - \dimen0\ht\pgfpic% - \advance\dimen0\dp\pgfpic% - \pgfsys@papersize{\the\wd\pgfpic}{\the\dimen0}% - \setbox0=\vbox{% - \kern -1truein% - \hbox{% - \kern -1truein% - \hbox to0pt{% - \wd\pgfexternal@startupbox=0pt% - \ht\pgfexternal@startupbox=0pt% - \dp\pgfexternal@startupbox=0pt% - \box\pgfexternal@startupbox% - \pgfsys@atbegindocument\hss}% - \box\pgfpic% - \kern 1truein}% - \kern1truein}% - \pgfexternal@originalshipout\box0% - }% -} - +\input pgfcoreexternal.code.tex \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex index d1e464fb7b7..e18aea0cde9 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorelayers.code.tex,v 1.1 2008/01/15 10:27:34 tantau Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorelayers.code.tex,v 1.2 2010/08/27 12:51:47 ludewich Exp $ % Creates a new pgf layer @@ -50,7 +50,7 @@ % % Note: % -% You cannot anything to the ``main'' layer using this command. +% You cannot add anything to the ``main'' layer using this command. % % Example: % @@ -59,11 +59,17 @@ % \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% + \pgfutil@ifundefined{pgf@layerbox@#1}{% + \PackageError{pgf}{Sorry, the requested layer '#1' could not be found. Maybe you misspelled it?}{}% + \bgroup + \begingroup + }{% + \expandafter\global\expandafter% + \setbox\csname pgf@layerbox@#1\endcsname=\hbox to 0pt% + \bgroup% + \expandafter\box\csname pgf@layerbox@#1\endcsname% + \begingroup% + }% } \def\endpgfonlayer{% \endgroup% diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex index b96d766b081..db62f73b6bf 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex @@ -7,13 +7,14 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex,v 1.14 2008/02/13 15:10:06 tantau Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex,v 1.24 2010/08/03 12:27:36 ludewich Exp $ \newdimen\pgf@path@lastx \newdimen\pgf@path@lasty - +\let\pgfgetpath=\pgfsyssoftpath@getcurrentpath +\let\pgfsetpath=\pgfsyssoftpath@setcurrentpath % Replace corners by arcs. % @@ -98,14 +99,14 @@ \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% + \ifpgf@size@hooked% + \let\pgf@size@hook@x#1\let\pgf@size@hook@y#2\pgf@path@size@hook% + \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% - \ifpgf@size@hooked% - \let\pgf@size@hook@x#1\let\pgf@size@hook@y#2\pgf@path@size@hook% - \fi% } \newif\ifpgf@size@hooked \let\pgf@path@size@hook=\pgfutil@empty% @@ -176,7 +177,7 @@ } -% Append a bezier spline from the current point to #3 with control +% Append a cubic bezier spline from the current point to #3 with control % points #1 and #2 to the current path. % % #1 = first control point @@ -185,8 +186,8 @@ % % Example: % -% \pgfpathmoveto{\pgfxy(0,0)} -% \pgfpathcurveto{\pgfxy(0,1)}{\pgfxy(1,1)}{\pgfxy(1,2)} +% \pgfpathmoveto{\pgfpointxy{0}{0}} +% \pgfpathcurveto{\pgfpointxy{0}{1}}{\pgfpointxy{1}{1}}{\pgfpointxy{1}{2}} % \pgfstroke \def\pgfpathcurveto#1#2#3{% @@ -207,6 +208,46 @@ } + +% Append a quadratic bezier spline from the current point to #2 with +% control point #1 to the current path. +% +% #1 = control point +% #2 = end point +% +% Example: +% +% \pgfpathmoveto{\pgfpointxy{0}{0}} +% \pgfpathquadraticcurveto{\pgfpointxy{1}{1}}{\pgfpointxy{2}{0}} +% \pgfstroke + +\def\pgfpathquadraticcurveto#1#2{% + \pgfpointtransformed{#2}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgfpointtransformed{#1}% + \pgf@xc=.6666666\pgf@x% + \pgf@yc=.6666666\pgf@y% + % compute second control point: + \pgf@xa=.33333333\pgf@xb% + \pgf@ya=.33333333\pgf@yb% + \advance\pgf@xa by\pgf@xc% + \advance\pgf@ya by\pgf@yc% + \pgf@protocolsizes{\pgf@xa}{\pgf@ya}% + % compute first control point + \advance\pgf@xc by.3333333\pgf@path@lastx% + \advance\pgf@yc by.3333333\pgf@path@lasty% + \pgf@protocolsizes{\pgf@xc}{\pgf@yc}% + \pgf@roundcornerifneeded% + \pgfsyssoftpath@curveto{\the\pgf@xc}{\the\pgf@yc}{\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. @@ -233,19 +274,6 @@ \fi% \pgf@arc@local@angle@a=\pgf@temp@a pt% \pgf@arc@local@angle@b=\pgf@temp@b pt% - \relax% - \ifdim\pgf@arc@local@angle@a>360pt\relax% - \advance\pgf@arc@local@angle@a by-360pt\relax% - \fi% - \ifdim\pgf@arc@local@angle@a<-360pt\relax% - \advance\pgf@arc@local@angle@a by360pt\relax% - \fi% - \ifdim\pgf@arc@local@angle@b>360pt\relax% - \advance\pgf@arc@local@angle@b by-360pt\relax% - \fi% - \ifdim\pgf@arc@local@angle@b<-360pt\relax% - \advance\pgf@arc@local@angle@b by360pt\relax% - \fi% \loop% \pgfutil@tempdima=\pgf@arc@local@angle@a% \advance\pgfutil@tempdima by-\pgf@arc@local@angle@b\relax% @@ -292,40 +320,22 @@ \def\pgf@arc{% {% - % \pgfmathsetlength{\pgfutil@tempdima}{#3}% - % \pgfmathsetlength{\pgfutil@tempdimb}{#4}% \pgfutil@tempdima=\pgf@arc@radius@a pt% \pgfutil@tempdimb=\pgf@arc@radius@b pt% % \pgf@xa=\pgf@arc@local@angle@a\relax% \pgf@xb=\pgf@arc@local@angle@b\relax% - % \pgfutil@tempcnta=#1\relax% - % \pgfutil@tempcntb=#2\relax% \advance\pgf@xb by-\pgf@xa\relax% \ifdim\pgf@xb<0pt\relax% \pgf@xb=-\pgf@xb\relax% \fi% - \ifdim\pgf@xb>85pt\relax% hackery to correct the control points - \pgfutil@tempdima=0.0555\pgfutil@tempdima\relax% - \pgfutil@tempdimb=0.0555\pgfutil@tempdimb\relax% + \ifdim\pgf@xb=90.0pt% + \def\pgfmathresult{0.55228475}% \else% - \ifdim\pgf@xb>75pt\relax% - \pgfutil@tempdima=0.055\pgfutil@tempdima\relax% - \pgfutil@tempdimb=0.055\pgfutil@tempdimb\relax% - \else% - \ifdim\pgf@xb>60pt\relax% - \pgfutil@tempdima=0.0545\pgfutil@tempdima\relax% - \pgfutil@tempdimb=0.0545\pgfutil@tempdimb\relax% - \else% - \pgfutil@tempdima=0.054\pgfutil@tempdima\relax% - \pgfutil@tempdimb=0.054\pgfutil@tempdimb\relax% - \fi% - \fi% - \fi - \pgfutil@tempdima=\pgf@sys@tonumber{\pgf@xb}\pgfutil@tempdima\relax% - \divide\pgfutil@tempdima by 9\relax% - \pgfutil@tempdimb=\pgf@sys@tonumber{\pgf@xb}\pgfutil@tempdimb\relax% - \divide\pgfutil@tempdimb by 9\relax% + \pgfmathparse{1.333333333*tan(.25*\pgf@sys@tonumber{\pgf@xb})}% many thanks to Ken Starks + \fi% + \pgfutil@tempdima=\pgfmathresult\pgfutil@tempdima% + \pgfutil@tempdimb=\pgfmathresult\pgfutil@tempdimb% %.. controls +(\pgf@xa+90:\pgfutil@tempdima) and +(\pgf@xb-90:\pgfutil@tempdima) .. +(-(#1:#3)+(#2:#3))% % store first support vector in xa/ya: \pgf@xa=\pgf@arc@local@angle@a\relax% @@ -373,6 +383,7 @@ }% } + % Append an arc to the current point, where the arc is on an ellipse % given by two axis vectors. % @@ -396,6 +407,466 @@ +% Append an arc to the current point that ends at a given position. +% +% #1 = x-radius +% #2 = y-radius +% #3 = x-axis-rotation (in degrees) +% #4 = large-arc-sweep-flag (0 or 1) +% #5 = sweep-flag (0 or 1) +% #6 = target point +% +% Description: +% +% This command implements an arc drawing where a given target +% coordinate (#6) is given and the task is to draw an arc of an +% ellipse with the given radii. The center point of the ellipse is not +% give, but computed automatically. +% +% This kind of "endpoint parameterization" of an arc is exactly the +% same as the one specified by the SVG-specification for the "A" and +% "a" path commands. Please see the SVG-specification for details. +% +% Note that the problem is internally converted to drawing an arc +% using \pgfpatharc. This means that there may be a heavy loss of +% accuracy. +% +% Example: +% +% \pgfpathmoveto{\pgfpoint{1cm}{1cm}} +% \pgfpatharcto{1cm}{1cm}{0}{0}{0}{\pgfpoint{0cm}{2cm}} + +\def\pgfpatharcto#1#2#3#4#5#6{% + {% + % The following code is based on the transformation described in svg + % 1.1 specification Section F.6.5 + % + % Step 1: store the simple parameters (xa=x1 since TeX does not + % allow numbers in names) + % + \pgfmathsetmacro\pgf@arcto@rx{abs(#1)}% + \pgfmathsetmacro\pgf@arcto@ry{abs(#2)}% + \ifdim\pgf@arcto@rx pt=0pt% special rule: zero radius=straight line + \gdef\pgf@marshal{\pgfpathlineto{#6}}% + \else + \ifdim\pgf@arcto@ry pt=0pt% special rule: zero radius=straight line + \gdef\pgf@marshal{\pgfpathlineto{#6}}% + \else + \pgfmathsetmacro\pgf@arcto@phi{#3}% + \pgfmathsetmacro\pgf@arcto@fA{#4}% + \ifdim\pgf@arcto@fA pt=0pt + \else + \pgfmathsetmacro\pgf@arcto@fA{1.0} % Special rule: every non-zero value is 1. + \fi + \pgfmathsetmacro\pgf@arcto@fS{#5}% + \ifdim\pgf@arcto@fS pt=0pt + \else + \pgfmathsetmacro\pgf@arcto@fS{1.0} % Special rule: every non-zero value is 1. + \fi + \pgf@process{#6} + \edef\pgf@arcto@xb{\the\pgf@x}% + \edef\pgf@arcto@yb{\the\pgf@y}% + % + % Step 2: x1,y1 is more complicated to compute: It is given by lastx + % and lasty, but these are transformed coordinates, we need the + % untransformed ones. So, we inverse the transformation (arghh...) + % + \pgftransforminvert% + \pgf@process{\pgfpointtransformed{\pgfqpoint{\pgf@path@lastx}{\pgf@path@lasty}}} + \edef\pgf@arcto@xa{\the\pgf@x} + \edef\pgf@arcto@ya{\the\pgf@y} + \edef\pgf@temp@a{\pgf@arcto@xa,\pgf@arcto@ya} + \edef\pgf@temp@b{\pgf@arcto@xb,\pgf@arcto@yb} + \ifx\pgf@temp@a\pgf@temp@b% special rule: skip! + \global\let\pgf@marshal\pgfutil@empty + \else + % + % Ok, now we got all the parameters setup. Now comes the + % computation... + % + % + % Step 3: Start with a new coordinate system and rotate everything + % by the negated phi. + % + \pgftransformreset + \pgftransformrotate{-\pgf@arcto@phi} + % Ok, using \pgfpointtransformed we now get transformed points... + % + % Step 4: Compute x1' and y1' (xaprime and yaprime) + % + \pgf@process{ + \pgfpointtransformed{\pgfpointscale{.5}{\pgfpointdiff + {\pgfqpoint{\pgf@arcto@xb}{\pgf@arcto@yb}} + {\pgfqpoint{\pgf@arcto@xa}{\pgf@arcto@ya}} + } + } + } + \edef\pgf@arcto@xaprime{\pgf@sys@tonumber\pgf@x} + \edef\pgf@arcto@yaprime{\pgf@sys@tonumber\pgf@y} + % + % Compute Lambda + % + \pgfmathsetmacro\pgf@arcto@frac@x{\pgf@arcto@xaprime/\pgf@arcto@rx} + \pgfmathsetmacro\pgf@arcto@frac@y{\pgf@arcto@yaprime/\pgf@arcto@ry} + \pgfmathsetmacro\pgf@arcto@lambda{ + \pgf@arcto@frac@x*\pgf@arcto@frac@x+\pgf@arcto@frac@y*\pgf@arcto@frac@y + } + \ifdim\pgf@arcto@lambda pt>1pt% + \pgfmathsetmacro\pgf@arcto@sqrt@lambda{sqrt(\pgf@arcto@lambda)} + \pgfmathsetmacro\pgf@arcto@rx{\pgf@arcto@sqrt@lambda*\pgf@arcto@rx} + \pgfmathsetmacro\pgf@arcto@ry{\pgf@arcto@sqrt@lambda*\pgf@arcto@ry} + \fi + % + % Do some scaling + % + \pgfmathsetmacro\pgf@arcto@xaprime@abs{abs(\pgf@arcto@xaprime)} + \pgfmathsetmacro\pgf@arcto@yaprime@abs{abs(\pgf@arcto@yaprime)} + \pgfmathmax@{\pgf@arcto@rx,\pgf@arcto@ry,\pgf@arcto@xaprime@abs,\pgf@arcto@yaprime@abs} + \pgfmathsetmacro\pgf@arcto@scaling{20/\pgfmathresult} + \pgfmathsetmacro\pgf@arcto@rx@scaled{\pgf@arcto@scaling*\pgf@arcto@rx} + \pgfmathsetmacro\pgf@arcto@ry@scaled{\pgf@arcto@scaling*\pgf@arcto@ry} + \pgfmathsetmacro\pgf@arcto@xaprime@scaled{\pgf@arcto@scaling*\pgf@arcto@xaprime} + \pgfmathsetmacro\pgf@arcto@yaprime@scaled{\pgf@arcto@scaling*\pgf@arcto@yaprime} + % + % Step 5: Now comes the messy computation of c1' and c2'. + % + \ifdim\pgf@arcto@rx pt>\pgf@arcto@ry pt% + \pgfmathsetmacro\pgf@arcto@rx@over@ry{\pgf@arcto@rx/\pgf@arcto@ry} + \pgfmathsetmacro\pgf@arcto@ry@over@rx{\pgf@arcto@ry/\pgf@arcto@rx} + \pgfmathsetmacro\pgf@arcto@temp{\pgf@arcto@ry@over@rx*\pgf@arcto@xaprime@scaled} + \pgfmathsetmacro\pgf@arcto@numerator{ + \pgf@arcto@ry@scaled*\pgf@arcto@ry@scaled- + \pgf@arcto@yaprime@scaled*\pgf@arcto@yaprime@scaled- + \pgf@arcto@temp*\pgf@arcto@temp + } + \pgfmathsetmacro\pgf@arcto@denominator{ + \pgf@arcto@yaprime@scaled*\pgf@arcto@yaprime@scaled+ + \pgf@arcto@temp*\pgf@arcto@temp + } + \else + \pgfmathsetmacro\pgf@arcto@rx@over@ry{\pgf@arcto@rx/\pgf@arcto@ry} + \pgfmathsetmacro\pgf@arcto@ry@over@rx{\pgf@arcto@ry/\pgf@arcto@rx} + \pgfmathsetmacro\pgf@arcto@temp{\pgf@arcto@rx@over@ry*\pgf@arcto@yaprime@scaled} + \pgfmathsetmacro\pgf@arcto@numerator{ + \pgf@arcto@rx@scaled*\pgf@arcto@rx@scaled- + \pgf@arcto@xaprime@scaled*\pgf@arcto@xaprime@scaled- + \pgf@arcto@temp*\pgf@arcto@temp + } + \pgfmathsetmacro\pgf@arcto@denominator{ + \pgf@arcto@xaprime@scaled*\pgf@arcto@xaprime@scaled+ + \pgf@arcto@temp*\pgf@arcto@temp + } + \fi + \pgfmathsetmacro\pgf@arcto@frac{ + \pgf@arcto@numerator/\pgf@arcto@denominator + } + \ifdim\pgf@arcto@frac pt<0pt + \pgfmathsetmacro\pgf@arcto@factor{0} + \else + \pgfmathsetmacro\pgf@arcto@factor{sqrt(\pgf@arcto@frac)} + \fi + \ifx\pgf@arcto@fA\pgf@arcto@fS + \pgfmathsetmacro\pgf@arcto@factor{-\pgf@arcto@factor} + \fi + \pgfmathsetmacro\pgf@arcto@cxprime{ + \pgf@arcto@factor*\pgf@arcto@rx@over@ry*\pgf@arcto@yaprime + } + \pgfmathsetmacro\pgf@arcto@cyprime{ + -\pgf@arcto@factor*\pgf@arcto@ry@over@rx*\pgf@arcto@xaprime + } + % + % Step 6: Ok, now compute cx,cy + % + \pgftransformreset + \pgftransformrotate{\pgf@arcto@phi} + \pgf@process{ + \pgfpointtransformed{\pgfqpoint{\pgf@arcto@cxprime pt}{\pgf@arcto@cyprime pt}} + } + \edef\pgf@arcto@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}} + \pgf@process{\pgfpointadd{\pgf@arcto@temp}{ + \pgfpointscale{.5}{ + \pgfpointadd + {\pgfqpoint{\pgf@arcto@xa}{\pgf@arcto@ya}} + {\pgfqpoint{\pgf@arcto@xb}{\pgf@arcto@yb}} } + } + } + \edef\pgf@arcto@cx{\the\pgf@x} + \edef\pgf@arcto@cy{\the\pgf@y} + % + % Step 7: Compute start angle: + % + \pgfmathsetmacro\pgf@arcto@vec@x{(\pgf@arcto@xaprime-\pgf@arcto@cxprime)/\pgf@arcto@rx} + \pgfmathsetmacro\pgf@arcto@vec@y{(\pgf@arcto@yaprime-\pgf@arcto@cyprime)/\pgf@arcto@ry} + \pgfmathsetmacro\pgf@arcto@denominator{veclen(\pgf@arcto@vec@x,\pgf@arcto@vec@y)} + \pgfmathsetmacro\pgf@arcto@frac{\pgf@arcto@vec@x/\pgf@arcto@denominator} + \pgfmathsetmacro\pgf@arcto@theta@start{acos(\pgf@arcto@frac)} + \ifdim\pgf@arcto@vec@y pt<0pt + \pgfmathsetmacro\pgf@arcto@theta@start{-\pgf@arcto@theta@start} + \fi + % + % Step 8: Compute end angle: + % + \pgfmathsetmacro\pgf@arcto@vec@x{(-\pgf@arcto@xaprime-\pgf@arcto@cxprime)/\pgf@arcto@rx} + \pgfmathsetmacro\pgf@arcto@vec@y{(-\pgf@arcto@yaprime-\pgf@arcto@cyprime)/\pgf@arcto@ry} + \pgfmathsetmacro\pgf@arcto@denominator{veclen(\pgf@arcto@vec@x,\pgf@arcto@vec@y)} + \pgfmathsetmacro\pgf@arcto@frac{\pgf@arcto@vec@x/\pgf@arcto@denominator} + \pgfmathsetmacro\pgf@arcto@theta@end{acos(\pgf@arcto@frac)} + \ifdim\pgf@arcto@vec@y pt<0pt + \pgfmathsetmacro\pgf@arcto@theta@end{-\pgf@arcto@theta@end} + \fi + \pgfmathsetmacro\pgf@arcto@delta@theta{abs(\pgf@arcto@theta@start-\pgf@arcto@theta@end)} + \ifdim\pgf@arcto@fA pt=0pt% + \ifdim\pgf@arcto@delta@theta pt>180pt% + % Ok, we need to adjust the angle! + \ifdim\pgf@arcto@theta@end pt>\pgf@arcto@theta@start pt + \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end-360} + \else + \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end+360} + \fi + \fi + \else + \ifdim\pgf@arcto@delta@theta pt<180pt% + % Ok, we need to adjust the angle! + \ifdim\pgf@arcto@theta@end pt>\pgf@arcto@theta@start pt + \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end-360} + \else + \pgfmathsetmacro\pgf@arcto@theta@end{\pgf@arcto@theta@end+360} + \fi + \fi + \fi + \xdef\pgf@marshal{\noexpand + \pgfpatharcaxes{\pgf@arcto@theta@start}{\pgf@arcto@theta@end} + {\noexpand\pgfpointpolar{\pgf@arcto@phi}{\pgf@arcto@rx}} + {\noexpand\pgfpointpolar{\pgf@arcto@phi+90}{\pgf@arcto@ry}} + } + \fi\fi\fi + } + \pgf@marshal +} + + + +% the quality of arc approximation by means of Bezier splines is +% controlled by a mesh width. +% +% The mesh width is provided in (full!) degrees. The smaller the mesh +% width, the more precise the arc approximation. +% +% Use an empty value to disable spline approximation (uses a single +% cubic polynomial for the complete arc). +% +% The value must be an integer! +\def\pgfpatharctomaxstepsize{45} + +% A specialized arc operation for an arc on an (axis--parallel) ellipse. +% +% In contrast to \pgfpatharc, it explicitly interpolates start- and end points. +% +% In contrast to \pgfpatharcto, this routine is numerically stable and +% quite fast since it relies on a lot of precomputed information. +% +% #1 center of ellipse +% #2 angle of last path position inside of the ellipse +% #3 end angle +% #4 end point (a \pgfpoint) +% #5 xradius +% #6 yradius +% #7 the ratio xradius/yradius of the ellipse +% #8 the ratio yradius/xradius of the ellipse +% Example: +% \def\cx{1cm}% center x +% \def\cy{1cm}% center y +% \def\startangle{0}% +% \def\endangle{45}% +% \def\a{5cm}% xradius +% \def\b{10cm}% yradius +% \pgfmathparse{\a/\b}\let\abratio=\pgfmathresult +% \pgfmathparse{\b/\a}\let\baratio=\pgfmathresult +% +% \pgfpathmoveto{\pgfpoint{\cx+\a*cos(\startangle)}{\cy+\b*sin(\startangle)}}% +% \pgfpatharctoprecomputed +% {\pgfpoint{\cx}{\cy}} +% {\startangle} +% {\endangle} +% {\pgfpoint{\cx+\a*cos(\endangle)}{\cy+\b*sin(\endangle)}}% +% {\a} +% {\b} +% {\abratio} +% {\baratio} +% +\def\pgfpatharctoprecomputed#1#2#3#4#5#6#7#8{% + \begingroup + % Implementation idea: + % + % let + % m = center (#1) + % \gamma_0 = start angle + % \gamma_1 = end angle + % a = x radius + % b = y radius + % + % an axis parallel ellipse is parameterized by + % C(\gamma) = m + ( a cos(\gamma), b sin(\gamma) ), \gamma in [0,360]. + % + % Now, consider the segment \gamma(t), + % \gamma:[0,1] -> [\gamma_0,\gamma_1], + % t -> \gamma_0 + t(\gamma_1 - \gamma_0) + % and + % C(\gamma(t)) which is defined on [0,1]. + % + % I'd like to approximate the arc by one or more cubic bezier + % splines which interpolate through the last and first provided + % points. + % + % In general, a Bezier spline C:[0,1] -> \R of order n fulfills + % C'(0) = n ( P_1 - P_0 ), + % C'(1) = n ( P_n - P_{n-1} ). + % For n=3 and given P_0 and P_3, I can directly compute P_1 and P_2 once I know + % the derivatives at t=0 and t=1. + % + % The derivatives in our case are + % ( C \circ \gamma )'(t) = C'[\gamma(t)] * \gamma'(t) + % = ( -a pi/180 sin(\gamma(t)), b pi/180 cos(\gamma(t)) ) * (\gamma_1 - \gamma_0). + % The pi/180 comes into play since we are working with degrees. + % + % Expression (C\circ\gamma)'(0) using P_0 and (C \circ \gamma)'(1) + % using P_3 yields the expressions + % (C \circ \gamma)'(0) = + % pi/180 * (\gamma_1 - \gamma_0)* [ - a/b(P_0^y - my), b/a (P_0^x - mx) ] + % (C \circ \gamma)'(1) = + % pi/180 * (\gamma_1 - \gamma_0)* [ - a/b(P_3^y - my), b/a (P_3^x - mx) ] + % + % defining + % scaleA = a/b * pi / (3*180) * (\gamma_1 - \gamma_0) + % and + % scaleB = b/a * pi / (3*180) * (\gamma_1 - \gamma_0) + % yields the direct expressions for the intermediate bezier + % control points + % + % P_1 = [ + % P_0^x - scaleA* ( P_0^y -my), + % P_0^y + scaleB* ( P_0^x -mx) ] + % and + % P_2 = [ + % P_3^x + scaleA* ( P_3^y -my), + % P_3^y - scaleB* ( P_3^x -mx) ]. + % + % This works fast, with few operations, if + % - a/b and b/a are known in advance + % - P_0 and P_3 are known in advance + % - \gamma_0 and \gamma_1 are known. + % + % It is also reliable if (\gamma_1 - \gamma_0) is small + % + \pgf@process{#1}% + \edef\pgfpath@center@x{\the\pgf@x}% + \edef\pgfpath@center@y{\the\pgf@y}% + \def\pgfpath@completearcend{#4}% + % compute scale (#3-#2) * pi/(3*180) = (#3 - #2) * pi/27 * 1/20 + % splitting pi/(3*180) into two scales has higher TeX accuracy + \pgf@xa=#2pt + \pgf@xb=#3pt + \edef\pgfpath@startangle{#2pt}% + \edef\pgfpath@endangle{\pgf@sys@tonumber\pgf@xb}% + % + \pgf@ya=\pgf@xb + \advance\pgf@ya by-\pgf@xa + % + \ifx\pgfpatharctomaxstepsize\pgfutil@empty + \def\pgfpath@N{1}% + \pgf@xc=\pgf@ya + \else + \pgf@xc=\pgf@ya% compute N = floor((gamma_1 - gamma_0) / max) +1 + \ifdim\pgf@xc<0pt + \multiply\pgf@xc by-1 + \fi + \divide\pgf@xc by\pgfpatharctomaxstepsize\relax + \afterassignment\pgfutil@gobble@until@relax + \c@pgf@counta=\the\pgf@xc\relax + \advance\c@pgf@counta by1 + \edef\pgfpath@N{\the\c@pgf@counta}% + % + \pgf@xc=\pgf@ya + \divide\pgf@xc by\c@pgf@counta + \fi + % + \edef\pgfpath@h{\pgf@sys@tonumber\pgf@xc}% + % +%\message{pgfpathellipse: using N =\pgfpath@N\space spline points y0 = \pgfpath@startangle, y0+i*h, yN=\pgfpath@endangle, i=1,...,(\pgfpath@N-1), with h=\pgfpath@h\space mesh width (total arc angle \pgf@sys@tonumber\pgf@ya).}% + % + % + \pgf@xc=0.116355283466289\pgf@xc % pi/27 + \divide\pgf@xc by20 + \pgf@xa=#7\pgf@xc + \edef\pgfpath@scale@A{\pgf@sys@tonumber\pgf@xa}% + \pgf@xa=#8\pgf@xc + \edef\pgfpath@scale@B{\pgf@sys@tonumber\pgf@xa}% + % + % compute intermediate spline segments for + % i = 1,...,N-1 + % this is a no-op for N=1. + \c@pgf@countd=1 + \pgfutil@loop + \ifnum\c@pgf@countd<\pgfpath@N\relax + % + \pgf@xa=\pgfpath@startangle % compute \pgf@xa = y_0 + i*h + \pgf@xb=\pgfpath@h pt + \multiply\pgf@xb by\c@pgf@countd + \advance\pgf@xa by\pgf@xb + \edef\pgfpath@angle@i{\pgf@sys@tonumber\pgf@xa}% +%\message{angle \the\c@pgf@countd: \pgfpath@angle@i...}% + % + \pgfpatharcofellipse@{% + \pgfpoint + {\pgfpath@center@x + #5*cos(\pgfpath@angle@i)} + {\pgfpath@center@y + #6*sin(\pgfpath@angle@i)} + }% + % + \advance\c@pgf@countd by1 + \pgfutil@repeat + % + % compute final spline segment. It only differs insofar as the + % final point is already known explicitly and should be + % interpolated without additional math error. +%\message{angle \pgfpath@N: \pgfpath@endangle...}% + \pgfpatharcofellipse@{\pgfpath@completearcend}% + \endgroup +}% +\def\pgfpatharcofellipse@#1{% + \begingroup + \pgf@process{#1}% + \edef\pgfpath@endpt{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% + % + \pgfpathcurveto{ + \begingroup + \global\pgf@x=\pgf@path@lastx + \global\pgf@y=\pgf@path@lasty + \pgf@xa=\pgf@x \advance\pgf@xa by-\pgfpath@center@x + \pgf@ya=\pgf@y \advance\pgf@ya by-\pgfpath@center@y + \global\advance\pgf@x by-\pgfpath@scale@A\pgf@ya + \global\advance\pgf@y by \pgfpath@scale@B\pgf@xa + \endgroup + }{% + \begingroup + \pgfpath@endpt + \pgf@xa=\pgf@x \advance\pgf@xa by-\pgfpath@center@x + \pgf@ya=\pgf@y \advance\pgf@ya by-\pgfpath@center@y + \global\advance\pgf@x by \pgfpath@scale@A\pgf@ya + \global\advance\pgf@y by-\pgfpath@scale@B\pgf@xa + \endgroup + }{% + \pgfpath@endpt + }% + \endgroup +} + + + + + + + + % Append an ellipse to the current path. % @@ -432,16 +903,16 @@ \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% + \pgf@x=0.55228475\pgf@xb% first arc + \pgf@y=0.55228475\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% + \pgf@x=0.55228475\pgf@xa% + \pgf@y=0.55228475\pgf@ya% \advance\pgf@x by\pgf@xb% \advance\pgf@y by\pgf@yb% {% @@ -455,16 +926,16 @@ }% \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% + \pgf@x=0.55228475\pgf@xa% second arc + \pgf@y=0.55228475\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% + \pgf@x=0.55228475\pgf@xb% + \pgf@y=0.55228475\pgf@yb% \advance\pgf@x by\pgf@xa% \advance\pgf@y by\pgf@ya% {% @@ -478,16 +949,16 @@ }% \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% + \pgf@x=0.55228475\pgf@xb% third arc + \pgf@y=0.55228475\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% + \pgf@x=0.55228475\pgf@xa% + \pgf@y=0.55228475\pgf@ya% \advance\pgf@x by\pgf@xb% \advance\pgf@y by\pgf@yb% {% @@ -501,16 +972,16 @@ }% \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% + \pgf@x=0.55228475\pgf@xa% fourth arc + \pgf@y=0.55228475\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% + \pgf@x=0.55228475\pgf@xb% + \pgf@y=0.55228475\pgf@yb% \advance\pgf@x by\pgf@xa% \advance\pgf@y by\pgf@ya% {% @@ -887,4 +1358,110 @@ } + +% Draw part of a curve between two specified times s and t. +% +% #1 - a start time s. +% #2 - an end time t. +% #3 - start point of the curve +% #4 - first control +% #5 - second control +% #6 - end point of the curve +% +% There are two versions, \pgfpathcurvebetweentime and +% \pgfpathcurvebetweentimecontinue. The latter does not insert a +% moveto to the first point. +% +\def\pgfpathcurvebetweentime{\pgf@ignoremovetofalse\pgf@@pathcurvebetweentime} +\def\pgfpathcurvebetweentimecontinue{\pgf@ignoremovetotrue\pgf@@pathcurvebetweentime} +\newif\ifpgf@ignoremoveto + +\def\pgf@@pathcurvebetweentime#1#2#3#4#5#6{% + \pgfmathparse{#1}% + \let\pgf@time@s=\pgfmathresult% + \pgfmathparse{#2}% + \let\pgf@time@t=\pgfmathresult% + \ifdim\pgf@time@s pt>\pgf@time@t pt\relax% + \pgfmathsetmacro\pgf@time@s{1-#1}% + \pgfmathsetmacro\pgf@time@t{1-#2}% + \pgf@@@pathcurvebetweentime{\pgf@time@t}{#6}{#5}{#4}{#3}% + \else% + \pgf@@@pathcurvebetweentime{\pgf@time@t}{#3}{#4}{#5}{#6}% + \fi% +} + +\def\pgf@@@pathcurvebetweentime#1#2#3#4#5{% + % Q1 = P1. + \pgf@process{#2}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + % Q2 = P1 + t*(P2-P1). + \pgf@process{% + \pgf@process{#3}% + \pgf@xa=#1\pgf@x% + \pgf@ya=#1\pgf@y% + \pgf@process{#2}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \advance\pgf@x by-#1\pgf@xb% + \advance\pgf@y by-#1\pgf@yb% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya% + }% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + % Q3 = Q2 + t*((P2 + t*(P3-P2)) - Q2). + \pgf@process{% + \pgf@process{#4}% + \pgf@xa=#1\pgf@x% + \pgf@ya=#1\pgf@y% + % + \pgf@process{#3}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xc by-#1\pgf@x% + \advance\pgf@yc by-#1\pgf@y% + % + \pgf@x=\pgf@xb% + \pgf@y=\pgf@yb% + \advance\pgf@x by#1\pgf@xa% + \advance\pgf@y by#1\pgf@ya% + \advance\pgf@x by-#1\pgf@xb% + \advance\pgf@y by-#1\pgf@yb% + \advance\pgf@x by#1\pgf@xc% + \advance\pgf@y by#1\pgf@yc% + }% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + % Q4 = (1-t)^3*P1 + 3*t(1-t)^2*P2 + 3*t^2(1-t)*P3 + t^3*P4. + \pgf@process{\pgfpointcurveattime{#1}{#2}{#3}{#4}{#5}}% + \ifx#1\pgf@time@t% + % First time round... + \pgfmathdivide@{\pgf@time@s}{\pgf@time@t}% + \pgfmathadd@{-\pgfmathresult}{1}% + \let\pgf@time@s=\pgfmathresult% + \edef\pgf@marshal{% + \noexpand\pgf@@@pathcurvebetweentime{\noexpand\pgf@time@s}% + {\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + }% + \else% + % ...second time round. + \ifpgf@ignoremoveto% + \edef\pgf@marshal{% + \noexpand\pgfpathcurveto{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + }% + \else% + \edef\pgf@marshal{% + \noexpand\pgfpathmoveto{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \noexpand\pgfpathcurveto{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + }% + \fi% + \fi% + \pgf@marshal% +} + + \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 index a8da0ca9410..9bcfc739f56 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex,v 1.7 2008/01/23 15:22:29 tantau Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex,v 1.8 2008/10/09 16:46:56 tantau Exp $ @@ -301,8 +301,8 @@ \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% + \advance\pgf@xa by 0.5522847\pgf@x% + \advance\pgf@ya by 0.5522847\pgf@y% \edef\pgfprocess@addition{\noexpand\pgfsyssoftpath@curvetosupportatoken{\the\pgf@xa}{\the\pgf@ya}}% \expandafter\pgfutil@g@addto@macro\expandafter\pgfprocess@segment\expandafter{\pgfprocess@addition}% }% @@ -312,8 +312,8 @@ \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% + \advance\pgf@xc by 0.5522847\pgf@x% + \advance\pgf@yc by 0.5522847\pgf@y% \edef\pgfprocess@addition{\noexpand\pgfsyssoftpath@curvetosupportbtoken{\the\pgf@xc}{\the\pgf@yc}}% \expandafter\pgfutil@g@addto@macro\expandafter\pgfprocess@segment\expandafter{\pgfprocess@addition}% }% diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex index e14a4e44447..b803cce9caf 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathusage.code.tex,v 1.11 2008/01/23 13:15:28 tantau Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepathusage.code.tex,v 1.12 2008/04/22 17:03:26 tantau Exp $ % Stroke/fill/clip/etc. the current path. Depending on the options, @@ -96,12 +96,14 @@ \pgfsyssoftpath@invokecurrentpath% \pgfsyssoftpath@getcurrentpath\pgf@last@used@path% \pgf@up@action% + \pgf@stroke@inner@line@if@needed% \pgfsyssoftpath@setcurrentpath\pgfutil@empty% \pgf@add@arrows@as@needed% \else% \pgfsyssoftpath@invokecurrentpath% \pgfsyssoftpath@getcurrentpath\pgf@last@used@path% \pgf@up@action% + \pgf@stroke@inner@line@if@needed% \fi% \fi% \else% @@ -117,6 +119,18 @@ \ignorespaces% } +\def\pgf@stroke@inner@line@if@needed{% + \ifdim\pgfinnerlinewidth>0pt\relax% + \pgfsys@beginscope% + {% + \pgfsys@setlinewidth{\pgfinnerlinewidth}% + \pgfsetstrokecolor{\pgfinnerstrokecolor}% + \pgfsyssoftpath@invokecurrentpath% + \pgfsys@stroke% + }% + \pgfsys@endscope% + \fi% +} % Shorten start/end of paths by a certain amount. % diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex index a3f6eb12502..b308c5aef8f 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex @@ -7,16 +7,16 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepatterns.code.tex,v 1.1 2008/01/15 10:27:34 tantau Exp $ - +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepatterns.code.tex,v 1.3 2009/07/02 11:43:15 tantau Exp $ % Creates a new uncolored pattern % -% #1 = pattern name -% #2 = lower left of bounding box -% #3 = upper right of bounding box -% #4 = step vector -% #5 = pattern code +% [#1] = optional list of variables. +% #2 = pattern name +% #3 = lower left of bounding box +% #4 = upper right of bounding box +% #5 = step vector +% #6 = pattern code % % Description: % @@ -26,6 +26,8 @@ % % See the pdf-manual for more details on uncolored patterns. % +% Specifying a variable list makes the pattern ``mutable''. +% % The bounding box must be a bounding box of the pattern cell. % % The step vector must provide the x- and y-step by which the cells @@ -49,16 +51,21 @@ % \pgfpathclose% % \pgfusepath{stroke} % } +% +\def\pgfdeclarepatternformonly{% + \def\pgf@pattern@type{formonly}% + \pgfutil@ifnextchar[{\pgf@declarepattern@checkarg}{\pgf@declarepattern@checkarg[]}% +} -\def\pgfdeclarepatternformonly#1#2#3#4#5{\pgf@declarepattern{#1}{#2}{#3}{#4}{#5}{0}} % Creates a new colored pattern % -% #1 = pattern name -% #2 = lower left of bounding box -% #3 = upper right of bounding box -% #4 = step vector -% #5 = pattern code +% [#1] = optional list of variables. +% #2 = pattern name +% #3 = lower left of bounding box +% #4 = upper right of bounding box +% #5 = step vector +% #6 = pattern code % % Description: % @@ -83,8 +90,38 @@ % \pgfpathclose% % \pgfusepath{stroke,fill} % } +% +\def\pgfdeclarepatterninherentlycolored{% + \def\pgf@pattern@type{inherentlycolored}% + \pgfutil@ifnextchar[{\pgf@declarepattern@checkarg}{\pgf@declarepattern@checkarg[]}% +} + + -\def\pgfdeclarepatterninherentlycolored#1#2#3#4#5{\pgf@declarepattern{#1}{#2}{#3}{#4}{#5}{1}} + + +\def\pgf@declarepattern@checkarg[#1]{% + \def\pgf@pattern@tempvars{#1}% + \ifx\pgf@pattern@tempvars\pgfutil@empty% + \expandafter\let\expandafter\pgf@next\csname pgf@declarepattern\pgf@pattern@type\endcsname% + \else% + \expandafter\let\expandafter\pgf@next\csname pgf@declarepattern\pgf@pattern@type @mutable\endcsname% + \fi% + \pgf@next} + +\long\def\pgf@declarepatternformonly#1#2#3#4#5{\pgf@declarepattern{#1}{#2}{#3}{#4}{#5}{0}} + +\long\def\pgf@declarepatterninherentlycolored#1#2#3#4#5{\pgf@declarepattern{#1}{#2}{#3}{#4}{#5}{1}} + +\long\def\pgf@declarepatternformonly@mutable#1#2#3#4#5{% + \def\pgf@marshal{\pgf@declarepatternmutable{#1}}% + \expandafter\pgf@marshal\expandafter{\pgf@pattern@tempvars}{#2}{#3}{#4}{#5}{2}% +} + +\long\def\pgf@declarepatterninherentlycolored@mutable#1#2#3#4#5#6{% + \def\pgf@marshal{\pgf@declarepatternmutable{#1}}% + \expandafter\pgf@marshal\expandafter{\pgf@pattern@tempvars}{#2}{#3}{#4}{#5}{3}% +} \def\pgf@declarepattern#1#2#3#4#5#6{% \pgfutil@ifundefined{pgf@pattern@name@#1}{% @@ -125,16 +162,37 @@ \expandafter\global\expandafter\let\csname pgf@pattern@instantiate@#1\endcsname=\pgf@marshal% } {% - \PackageError{pgfbasepatterns}{Pattern `#1' already defined}{}% + \PackageError{pgfcorepatterns}{Pattern `#1' already defined}{}% }% } \def\pgf@pattern@number{0}% +\def\pgf@declarepatternmutable#1#2#3#4#5#6#7{% + \pgfutil@ifundefined{pgf@pattern@name@#1}{% + \expandafter\gdef\csname pgf@pattern@name@#1\endcsname{#1}% + \expandafter\gdef\csname pgf@pattern@variables@#1\endcsname{#2}% + \expandafter\gdef\csname pgf@pattern@lowerleft@#1\endcsname{#3}% + \expandafter\gdef\csname pgf@pattern@upperright@#1\endcsname{#4}% + \expandafter\gdef\csname pgf@pattern@tilesize@#1\endcsname{#5}% + \expandafter\long\expandafter\gdef\csname pgf@pattern@code@#1\endcsname{#6}% + \expandafter\gdef\csname pgf@pattern@type@#1\endcsname{7}% + }{\PackageError{pgfcorepatterns}{The pattern `#1' is already defined}{}}% +} + \def\pgf@ifpatternisinherentlycolored#1#2#3{% - \expandafter\ifnum\csname pgf@pattern@type@#1\endcsname=1\relax#2\else#3\fi% + \expandafter\ifodd\csname pgf@pattern@type@#1\endcsname\relax#2\else#3\fi% } +\def\pgf@ifpatternismutable#1#2#3{% + \expandafter\ifnum\csname pgf@pattern@type@#1\endcsname>1\relax#2\else#3\fi% +} + +\def\pgfpatternreleasename#1{\expandafter\let\csname pgf@pattern@name@#1\endcsname\relax} + + + + % Set an pattern as fill color @@ -150,10 +208,51 @@ % Example: % % \pgfsetfillpattern{stars}{red} - +% \def\pgfsetfillpattern#1#2{% + \pgfutil@ifundefined{pgf@pattern@name@#1}% + {% + \PackageError{pgfcorepatterns}{Undefined pattern `#1'}{}% + }% + {% + \pgf@ifpatternismutable{#1}% + {% + % So, a mutable pattern. Check to see if the pattern + % has been used with the current variable values... + \let\pgf@pattern@tempvars\pgfutil@empty% + \expandafter\expandafter\expandafter\pgf@pattern@check@vars% + \csname pgf@pattern@variables@#1\endcsname,\pgf@stop,% + \edef\pgf@pattern@nametemp{pgf@pattern@#1@\pgf@pattern@tempvars}% + \expandafter\pgfutil@ifundefined\expandafter{\pgf@pattern@nametemp}% + {% + % ...Nope. So declare a new instance of the mutable pattern. + \pgf@ifpatternisinherentlycolored{#1}% + {\let\pgf@set@fillpattern@declare\pgfdeclarepatterninherentlycolored}% + {\let\pgf@set@fillpattern@declare\pgfdeclarepatternformonly}% + \pgf@set@fillpattern@declare% + {\pgf@pattern@nametemp}% + {\csname pgf@pattern@lowerleft@#1\endcsname}% + {\csname pgf@pattern@upperright@#1\endcsname}% + {\csname pgf@pattern@tilesize@#1\endcsname}% + {\csname pgf@pattern@code@#1\endcsname}% + }% + {% + % ...Yep. So do nothing. + }% + \expandafter\pgf@set@fillpattern\expandafter{\pgf@pattern@nametemp}{#2}% + \expandafter\gdef\csname\pgf@pattern@nametemp\endcsname{#1}% + }% + {% + % A non-mutable pattern. + \pgf@set@fillpattern{#1}{#2}% + }% + }% +} + + +\def\pgf@set@fillpattern#1#2{% \pgfutil@ifundefined{pgf@pattern@name@#1}{% - \PackageError{pgfbasepatterns}{Undefined pattern `#1'}{}} + \PackageError{pgfcorepatterns}{Undefined pattern `#1'}{}} {% \csname pgf@pattern@instantiate@#1\endcsname% \expandafter\global\expandafter\let\csname pgf@pattern@instantiate@#1\endcsname=\relax% @@ -168,11 +267,30 @@ }% }% } + \def\pgf@set@fill@patternuncolored#1,#2,#3\relax#4{% \pgfsys@setpatternuncolored{\csname pgf@pattern@name@#4\endcsname}{#1}{#2}{#3}% } - - +\def\pgf@pattern@check@vars#1,{% + \ifx#1\pgf@stop% + \let\pgf@next\relax% + \else% + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\let\expandafter\pgf@pattern@char#1#1\pgfmath@% + \ifx\pgf@pattern@char/% + \edef\pgf@pattern@tempvar{(\pgfkeysvalueof{#1})}% + \else% + \expandafter\ifcat\pgf@pattern@char\relax% + \edef\pgf@pattern@tempvar{(\the#1)}% + \else% + \edef\pgf@pattern@tempvar{(#1)}% + \fi% + \fi% + \edef\pgf@pattern@tempvars{\pgf@pattern@tempvars\pgf@pattern@tempvar}% + \let\pgf@next\pgf@pattern@check@vars% + \fi% + \pgf@next% +} \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 index 3ab2b4e009b..79cb3a06f77 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepoints.code.tex,v 1.13 2008/02/03 19:37:26 tantau Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorepoints.code.tex,v 1.20 2010/04/09 08:53:45 ludewich Exp $ \newdimen\pgf@picminx \newdimen\pgf@picmaxx @@ -35,7 +35,7 @@ \def\pgfextract@process#1#2{% \pgf@process{#2}% - \edef#1{\noexpand\pgf@x\the\pgf@x\noexpand\pgf@y\the\pgf@y}% + \edef#1{\noexpand\pgf@x=\the\pgf@x\noexpand\relax\noexpand\pgf@y=\the\pgf@y\noexpand\relax}% } % This needed until old shapes code changed. \let\pgfsavepgf@process\pgfextract@process% @@ -172,6 +172,14 @@ \def\pgfpointscale#1#2{% \pgf@process{#2}% + \pgfmathparse{#1}% + \pgf@x=\pgfmathresult\pgf@x% + \pgf@y=\pgfmathresult\pgf@y% +} +% A "quick" variant of \pgfpointscale which doesn't invoke the math parser for '#1'. +% #1 must be a number without units, no registers are accepted. +\def\pgfqpointscale#1#2{% + \pgf@process{#2}% \pgf@x=#1\pgf@x% \pgf@y=#1\pgf@y% } @@ -736,6 +744,15 @@ \advance\pgf@y by \pgftemp@y\pgf@yy} +% "Quick" variant for \pgfpointxy. +% +% Only numbers without unit are allowed here. +\def\pgfqpointxy#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 @@ -782,6 +799,16 @@ \advance\pgf@y by \pgftemp@y\pgf@yy% \advance\pgf@y by \pgftemp@z\pgf@zy} +% "Quick" variant for \pgfpointxyz. +% +% Only numbers without unit are allowed. +\def\pgfqpointxyz#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} @@ -913,7 +940,7 @@ \pgf@x=0pt\relax% \else% \divide\c@pgf@countb by \c@pgf@counta% - \pgf@y=\csname pgf@cosfrac\the\c@pgf@countb\endcsname pt% + \pgf@y=\csname pgfmath@cosfrac@\the\c@pgf@countb\endcsname pt% \pgf@xc=8192pt% \divide\pgf@xc by\c@pgf@counta% \pgf@x=\pgf@sys@tonumber{\pgf@xc}\pgf@xa% @@ -1114,6 +1141,13 @@ #1=\pgf@y\relax} +% Stores the most recently used (x,y) coordinates into two macros, #1 +% and #2. +\def\pgfgetlastxy#1#2{% + \edef#1{\the\pgf@x}% + \edef#2{\the\pgf@y}% +}% + \def\pgf@def#1#2#3{\expandafter\def\csname pgf@#1#2\endcsname{#3}} \pgf@def{cosfrac}{0}{1} @@ -1168,6 +1202,4 @@ \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/pgfcorequick.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex index 84a432ceadb..d5817ce4282 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorequick.code.tex,v 1.2 2006/10/11 15:22:25 tantau Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorequick.code.tex,v 1.3 2008/10/09 16:46:56 tantau Exp $ % Quick version of basic drawing commands. Most high-level commands % are not available if these commands are used. @@ -76,7 +76,7 @@ \def\pgfpathqcircle#1{% {% \pgf@x=#1% - \pgf@y=0.555\pgf@x% + \pgf@y=0.5522847\pgf@x% \pgfsyssoftpath@moveto{\the\pgf@x}{0pt}% \pgfsyssoftpath@curveto{\the\pgf@x}{\the\pgf@y}{\the\pgf@y}{\the\pgf@x}{0pt}{\the\pgf@x}% \pgfsyssoftpath@curveto{-\the\pgf@y}{\the\pgf@x}{-\the\pgf@x}{\the\pgf@y}{-\the\pgf@x}{0pt}% diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex index b637ff10ded..558f715788c 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.26 2008/01/15 10:27:34 tantau Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.34 2010/09/08 15:07:18 tantau Exp $ % Globals @@ -31,82 +31,6 @@ -% Library files inclusion - - -% Include a library file. -% -% #1 = List of names of library file. -% -% Description: -% -% This command includes a list of library files. For each file X in the -% list, the file pgflibraryX.code.tex is included, provided this has -% not been done earlier. -% -% For the convenience of Context users, both round and square brackets -% are possible for the argument. -% -% Example: -% -% \usepgflibrary{arrows} -% \usepgflibrary[patterns,snakes] - -\def\usepgflibrary{\pgfutil@ifnextchar[{\use@pgflibrary}{\use@@pgflibrary}}%} -\def\use@pgflibrary[#1]{\use@@pgflibrary{#1}} -\def\use@@pgflibrary#1{% - \edef\pgf@list{#1}% - \pgfutil@for\pgf@temp:=\pgf@list\do{% - \expandafter\ifx\csname pgf@library@\pgf@temp @loaded\endcsname\relax% - \expandafter\let\csname pgf@library@\pgf@temp @loaded\endcsname=\pgfutil@empty% - \expandafter\edef\csname pgf@library@#1@atcode\endcsname{\the\catcode`\@} - \expandafter\edef\csname pgf@library@#1@barcode\endcsname{\the\catcode`\|} - \catcode`\@=11 - \catcode`\|=12 - \input pgflibrary\pgf@temp.code.tex - \catcode`\@=\csname pgf@library@#1@atcode\endcsname - \catcode`\|=\csname pgf@library@#1@barcode\endcsname - \fi% - }% -} - - -% Include a module file. -% -% #1 = List of names of module files. -% -% Description: -% -% This command includes a list of module files. For each file X in the -% list, the file pgfmoduleX.code.tex is included, provided this has -% not been done earlier. -% -% For the convenience of Context users, both round and square brackets -% are possible for the argument. -% -% Example: -% -% \usepgfmodule{matrix} - -\def\usepgfmodule{\pgfutil@ifnextchar[{\use@pgfmodule}{\use@@pgfmodule}}%} -\def\use@pgfmodule[#1]{\use@@pgfmodule{#1}} -\def\use@@pgfmodule#1{% - \edef\pgf@list{#1}% - \pgfutil@for\pgf@temp:=\pgf@list\do{% - \expandafter\ifx\csname pgf@module@\pgf@temp @loaded\endcsname\relax% - \expandafter\let\csname pgf@module@\pgf@temp @loaded\endcsname=\pgfutil@empty% - \expandafter\edef\csname pgf@module@#1@atcode\endcsname{\the\catcode`\@} - \expandafter\edef\csname pgf@module@#1@barcode\endcsname{\the\catcode`\|} - \catcode`\@=11 - \catcode`\|=12 - \input pgfmodule\pgf@temp.code.tex - \catcode`\@=\csname pgf@module@#1@atcode\endcsname - \catcode`\|=\csname pgf@module@#1@barcode\endcsname - \fi% - }% -} - - % Scopes @@ -268,6 +192,13 @@ \newif\ifpgfpicture +\def\pgfresetboundingbox{% + \global\pgf@picmaxx=-16000pt\relax% + \global\pgf@picminx=16000pt\relax% + \global\pgf@picmaxy=-16000pt\relax% + \global\pgf@picminy=16000pt\relax% +}% + \def\pgfpicture{% \begingroup% \pgfpicturetrue% @@ -306,7 +237,7 @@ \let\setlength=\pgf@setlength% \let\addtolength=\pgf@addtolength% \let\selectfont=\pgf@selectfont% - \nullfont\spaceskip\z@\xspaceskip\z@% + \nullfont\spaceskip0pt\xspaceskip0pt% \setbox\pgf@layerbox@main\hbox to0pt\bgroup% \begingroup% } @@ -325,7 +256,21 @@ % Shift baseline outside: \pgf@relevantforpicturesizefalse% \pgf@process{\pgf@baseline}% - \gdef\pgf@shift@baseline{\the\pgf@y}% + \xdef\pgf@shift@baseline{\the\pgf@y}% + % + \pgf@process{\pgf@trimleft}% + \global\advance\pgf@x by-\pgf@picminx + % prepare \hskip\pgf@trimleft@final. + % note that \pgf@trimleft@final is also queried + % by the pgf image externalization. + \xdef\pgf@trimleft@final{-\the\pgf@x}% + % + \pgf@process{\pgf@trimright}% + \global\advance\pgf@x by-\pgf@picmaxx + % prepare \hskip\pgf@trimright@final. + % note that \pgf@trimright@final is also queried + % by the pgf image externalization. + \xdef\pgf@trimright@final{\the\pgf@x}% \endgroup% \hss% \egroup% @@ -396,6 +341,7 @@ \pgfsetbaselinepointlater{\pgf@setter@baseline}% } +\def\pgf@default@text{default}% % Sets the baseline % @@ -407,11 +353,65 @@ % Example: % % \pgfsetbaseline{1cm+2pt} - -\def\pgfsetbaseline#1{\pgfsetbaselinepointlater{\pgfpoint{0pt}{#1}}} +% \pgfsetbaseline{default}% resets to default value + +\def\pgfsetbaseline#1{% + \def\pgf@temp{#1}% + \ifx\pgf@temp\pgf@default@text + \pgfsetbaseline{\pgf@picminy}% + \else + \pgfsetbaselinepointlater{\pgfpoint{0pt}{#1}}% + \fi +} \pgfsetbaseline{\pgf@picminy} +% controls how the image externalization implements trim: +\newif\ifpgf@trim@lowlevel +\pgfkeys{ + /pgf/trim lowlevel/.is if=pgf@trim@lowlevel, + /pgf/trim lowlevel/.default=true, +} +% Same as the y-baseline for horizontal alignment. +% The effect is different, though: it is some kind of trimming which +% leaves the bounding box intact. +\def\pgfsettrimleftpointlater#1{\def\pgf@trimleft{#1}} +\def\pgfsettrimleftpointnow#1{% + \pgf@process{#1}% + \edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + \pgfsettrimleftpointlater{\pgf@setter@baseline}% +} +% \pgfsettrimleft{<x coord>} +% or +% \pgfsettrimleft{default} +\def\pgfsettrimleft#1{% + \def\pgf@temp{#1}% + \ifx\pgf@temp\pgf@default@text + \pgfsettrimleft{\pgf@picminx} + \else + \pgfsettrimleftpointlater{\pgfpoint{#1}{0pt}}% + \fi +} +\pgfsettrimleft{\pgf@picminx} + +\def\pgfsettrimrightpointlater#1{\def\pgf@trimright{#1}} +\def\pgfsettrimrightpointnow#1{% + \pgf@process{#1}% + \edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + \pgfsettrimrightpointlater{\pgf@setter@baseline}% +} +% \pgfsettrimright{<x coord>} +% or +% \pgfsettrimright{default} +\def\pgfsettrimright#1{% + \def\pgf@temp{#1}% + \ifx\pgf@temp\pgf@default@text + \pgfsettrimright{\pgf@picmaxx}% + \else + \pgfsettrimrightpointlater{\pgfpoint{#1}{0pt}}% + \fi +} +\pgfsettrimright{\pgf@picmaxx} % Interrupt path @@ -489,6 +489,8 @@ \pgf@picminx=16000pt\relax% \pgf@picmaxy=-16000pt\relax% \pgf@picminy=16000pt\relax% + \pgf@size@hookedfalse% + \let\pgf@path@size@hook=\pgfutil@empty% } \def\endpgfinterruptboundingbox {% @@ -554,6 +556,7 @@ \fi% \pgfutil@selectfont% \pgfpicturefalse% + \let\pgf@positionnodelater@macro\relax% \pgf@savelayers% } \def\endpgfinterruptpicture diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex index e8225bb0225..d4b0e8bee74 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreshade.code.tex,v 1.9 2007/12/10 13:19:32 tantau Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreshade.code.tex,v 1.13 2008/11/23 16:07:47 ludewich Exp $ % % Parsing functions @@ -111,6 +111,14 @@ } +% Normalized a <color specification> argument for shadings into a +% series of rgb color specifications and writes the result into +% \pgf@rgbconv. +% +% Example: +% \pgf@convertrgbstring{rgb(0cm)=(1,0,0); rgb(2cm)=(0,1,0); rgb(4cm)=(0,0,1); gray(1cm)=(3); color(2cm)=(green); } +% -> +% \pgf@rgbconv = macro:->'rgb(0cm)=(1,0,0); rgb(2cm)=(0,1,0); rgb(4cm)=(0,0,1); rgb(1cm)=(3,3,3); rgb(2cm)=(0,1,0); ' \def\pgf@convertrgbstring#1{% \def\pgf@rgbconv{}% \pgf@converttorgb#1]% @@ -387,6 +395,12 @@ \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% \expandafter\pgfshading@rgb\pgf@rgbcolor\relax% \edef#2{\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@xc}\space}% + \c@pgf@counta\escapechar% + \escapechar-1\relax% + \expandafter\edef\csname\string#2red\endcsname{\pgf@sys@tonumber{\pgf@xa}\space}% + \expandafter\edef\csname\string#2green\endcsname{\pgf@sys@tonumber{\pgf@xb}\space}% + \expandafter\edef\csname\string#2blue\endcsname{\pgf@sys@tonumber{\pgf@xc}\space}% + \escapechar\c@pgf@counta% } \def\pgfshading@rgb#1,#2,#3\relax{% \pgf@xa=#1pt% @@ -531,8 +545,8 @@ \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% + \pgf@xc=.01992528\pgf@xc% + \pgf@yc=.01992528\pgf@yc% \pgfsyssoftpath@invokecurrentpath% \pgfsys@clipnext% \pgfsys@discardpath% diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex index caf5432b4d8..442531ffa6f 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoretransformations.code.tex,v 1.10 2008/02/04 17:19:54 tantau Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoretransformations.code.tex,v 1.11 2009/06/10 09:22:57 ludewich Exp $ % Position transformations @@ -37,6 +37,36 @@ \edef#1{{\pgf@pt@aa}{\pgf@pt@ab}{\pgf@pt@ba}{\pgf@pt@bb}{\the\pgf@pt@x}{\the\pgf@pt@y}} } +% Store the current transformation matrix in a set of macros, one for +% each single entry. +% +% #1-#4 are macro which store the matrix entries (0,0), (0,1), (1,0), +% (1,1) (in this order). It is the same order as for \pgftransformcm. +% +% #5 is a macro which will be filled with the x shift and +% #6 is a macro which will be filled with the y shift. +% +% Example: +% \pgfgettransform\aa\ab\ba\bb\shiftx\shifty +% +% -> +% +% \pgftransformcm\aa\ab\ba\bb{\pgfqpoint{\shiftx}{\shifty}} +% +% or +% +% \pgfsettransformentries\aa\ab\ba\bb\shiftx\shifty +\def\pgfgettransformentries#1#2#3#4#5#6{% + \edef#1{\pgf@pt@aa}% + \edef#2{\pgf@pt@ab}% + \edef#3{\pgf@pt@ba}% + \edef#4{\pgf@pt@bb}% + \edef#5{\the\pgf@pt@x}% + \edef#6{\the\pgf@pt@y}% +}% +\def\pgfsettransformentries#1#2#3#4#5#6{% + \pgfsettransform{{#1}{#2}{#3}{#4}{#5}{#6}}% +}% % Restore the current transformation matrix from a macro. % |