diff options
author | Karl Berry <karl@freefriends.org> | 2019-01-05 22:40:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-01-05 22:40:38 +0000 |
commit | 22536bb2b5257046d271b1eaa11b4a275d5ec041 (patch) | |
tree | 2500eaf5c26b11e00ebd33a64fccfa332cd5a66c /Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex | |
parent | cf794f0e2db6857972a9d48d4466a4f03a7057a0 (diff) |
pgf (5jan19)
git-svn-id: svn://tug.org/texlive/trunk@49607 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex index 8cf75a739bd..6b1571518b6 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\usepgfmodule{decorations} +\usepgfmodule{decorations}% % Options for shape decorations @@ -44,9 +44,9 @@ shape start height=#1, shape end height=#1 } -} +}% -\def\pgf@lib@shapedecoration@sep{.25cm, between centers} +\def\pgf@lib@shapedecoration@sep{.25cm, between centers}% \newif\ifpgfshapedecorationsloped \pgfshapedecorationslopedtrue \newif\ifpgfshapedecorationscaled @@ -57,13 +57,13 @@ % triangle decoration \pgfdeclaredecoration{triangles}{init} -{ +{% \state{init}[width=+0pt,next state=triangle,persistent precomputation={ \pgfmathparse{\pgfkeysvalueof{/pgf/decoration/shape start width}} \edef\pgf@lib@dec@ssw{\pgfmathresult pt} \pgfmathparse{\pgfkeysvalueof{/pgf/decoration/shape start height}/2} \edef\pgf@lib@dec@ssh{\pgfmathresult pt} - }]{} + }]{}% \state{triangle}[switch if less than=+\pgfdecorationsegmentlength to last, width=+\pgfdecorationsegmentlength] { @@ -71,7 +71,7 @@ \pgfpathlineto{\pgfqpoint{\pgf@lib@dec@ssw}{0pt}} \pgfpathlineto{\pgfqpoint{0pt}{-\pgf@lib@dec@ssh}} \pgfpathclose - } + }% \state{last}[switch if less than=\pgf@lib@dec@ssw to skip, width=\pgfdecoratedremainingdistance,next state=final] { @@ -79,14 +79,14 @@ \pgfpathlineto{\pgfqpoint{\pgf@lib@dec@ssw}{0pt}} \pgfpathlineto{\pgfqpoint{0pt}{-\pgf@lib@dec@ssh}} \pgfpathclose - } + }% \state{skip}[width=\pgfdecoratedremainingdistance] - {} + {}% \state{final} { \pgfpathmoveto{\pgfpointdecoratedpathlast} - } -} + }% +}% @@ -94,13 +94,13 @@ % crosses decoration \pgfdeclaredecoration{crosses}{init} -{ +{% \state{init}[width=+0pt,next state=crosses,persistent precomputation={ \pgfmathparse{\pgfkeysvalueof{/pgf/decoration/shape start width}/2} \edef\pgf@lib@dec@ssw{\pgfmathresult pt} \pgfmathparse{\pgfkeysvalueof{/pgf/decoration/shape start height}/2} \edef\pgf@lib@dec@ssh{\pgfmathresult pt} - }]{} + }]{}% \state{crosses}[switch if less than=+\pgfdecorationsegmentlength to last, width=+\pgfdecorationsegmentlength] { @@ -108,18 +108,18 @@ \pgfpathlineto{\pgfqpoint{\pgf@lib@dec@ssw}{-\pgf@lib@dec@ssh}} \pgfpathmoveto{\pgfqpoint{-\pgf@lib@dec@ssw}{-\pgf@lib@dec@ssh}} \pgfpathlineto{\pgfqpoint{\pgf@lib@dec@ssw}{\pgf@lib@dec@ssh}} - } + }% \state{last}[width=+\pgfdecoratedremainingdistance] { \pgfpathmoveto{\pgfqpoint{-\pgf@lib@dec@ssw}{\pgf@lib@dec@ssh}} \pgfpathlineto{\pgfqpoint{\pgf@lib@dec@ssw}{-\pgf@lib@dec@ssh}} \pgfpathmoveto{\pgfqpoint{-\pgf@lib@dec@ssw}{-\pgf@lib@dec@ssh}} \pgfpathlineto{\pgfqpoint{\pgf@lib@dec@ssw}{\pgf@lib@dec@ssh}} - } + }% \state{final}{ \pgfpathmoveto{\pgfpointdecoratedpathlast} - } -} + }% +}% @@ -128,14 +128,14 @@ % The shape background decoration % -% The shape background decoration adds repeated instances of +% The shape background decoration adds repeated instances of % the background path of a specified shape along the path. The shape % must have been declared by \pgfdeclareshape. If a shape has % specialized keys (e.g. the number of points on a star, or the apex -% angle the isosceles triangle), these can be specified in the usual manner. +% angle the isosceles triangle), these can be specified in the usual manner. % -% The sepatation between shapes in the path can be specified and can -% be between the center of the shape or the border of the shape. +% The separation between shapes in the path can be specified and can +% be between the center of the shape or the border of the shape. % % The height and width of the shape can be independently or % simultaneously scaled (linearly) along the path. It is also @@ -148,52 +148,52 @@ \edef\pgf@lib@shapedecoration@initialise{0pt}% \pgfdeclaredecoration{shape backgrounds}{initialise} -{ +{% \state{initialise} [ width=+\pgf@lib@shapedecoration@initialise, next state=shape, persistent precomputation= { - % + % % \egroup ends the group started by the automaton before executing - % a decoration state. This prevents the need for (most) \global variables. - % - % + % a decoration state. This prevents the need for (most) \global variables. + % + % % Check the shape exists. - % + % \pgfutil@ifundefined{pgf@sh@bg@\pgfkeysvalueof{/pgf/decoration/shape}}{% \pgferror{I do not know the shape `\pgfkeysvalueof{/pgf/decoration/shape}', - so I cannot use it in a decoration. Check if its library been loaded or if you + so I cannot use it in a decoration. Check if its library been loaded or if you simply mistyped the name}}{}% - % + % % Calculate a `default' path size. - % + % \pgfinterruptpath% \pgfinterruptboundingbox% \pgftransformreset% \pgf@relevantforpicturesizetrue% - % + % % This size of this shape is unimportant, but it should % be just large/small enough to avoid huge errors when - % calculting the scaling factors later on. - % + % calculating the scaling factors later on. + % \pgfkeys{/pgf/inner sep=50pt, /pgf/minimum size=1pt}% Arbitrary lengths. \setbox\pgfnodeparttextbox\hbox{}% Assume shape does nothing special if box is empty. - \let\pgf@sh@savedmacros\pgfutil@empty% + \let\pgf@sh@savedmacros\pgfutil@empty% \let\pgf@sh@savedpoints\pgfutil@empty% \csname pgf@sh@s@\pgfkeysvalueof{/pgf/decoration/shape}\endcsname% \pgf@sh@savedpoints% \pgf@sh@savedmacros% - % - % Save the macros and pionts. - % + % + % Save the macros and points. + % \expandafter\gdef\expandafter\pgf@lib@shapedecoration@points\expandafter{\pgf@sh@savedpoints}% \expandafter\gdef\expandafter\pgf@lib@shapedecoration@macros\expandafter{\pgf@sh@savedmacros}% - \csname pgf@sh@bg@\pgfkeysvalueof{/pgf/decoration/shape}\endcsname% - % + \csname pgf@sh@bg@\pgfkeysvalueof{/pgf/decoration/shape}\endcsname% + % % Save the dimensions of the shape path. - % + % \pgf@x\pgf@picmaxx% \pgf@y\pgf@picmaxy% \advance\pgf@x-\pgf@picminx% @@ -204,52 +204,52 @@ }% \endpgfinterruptboundingbox% \endpgfinterruptpath% - % + % \edef\pgf@lib@shapedecoration@beforeshape{0pt}% \edef\pgf@lib@shapedecoration@aftershape{0pt}% - % + % \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/decoration/shape start width}}% \edef\pgf@lib@shapedecoration@startwidth{\the\pgf@x}% \edef\pgf@lib@shapedecoration@width{\the\pgf@x}% \pgf@x-\pgf@x% \pgfmathaddtolength\pgf@x{\pgfkeysvalueof{/pgf/decoration/shape end width}}% \edef\pgf@lib@shapedecoration@widthchange{\the\pgf@x}% - % + % \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/decoration/shape start height}}% \edef\pgf@lib@shapedecoration@initialheight{\the\pgf@y}% \edef\pgf@lib@shapedecoration@height{\the\pgf@y}% \pgf@y-\pgf@y% \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/decoration/shape end height}}% \edef\pgf@lib@shapedecoration@heightchange{\the\pgf@y}% - % + % % Calculate the sep. - % + % \ifx\pgf@lib@shapedecoration@spread\pgfutil@empty% - % + % % Not spreading, so easy: - % + % \def\pgf@lib@shapedecoration@borderstext{between borders}% \afterassignment\pgf@lib@shapedecoration@setkeyword% \expandafter\pgf@x\pgf@lib@shapedecoration@sep,\pgf@stop% \edef\pgf@lib@shapedecoration@sep{\the\pgf@x}% \else% - % + % % Spreading (a bit of a nuiscence actually). - % + % \def\pgf@lib@shapedecoration@borderstext{by borders}% \afterassignment\pgf@lib@shapedecoration@setkeyword% \expandafter\c@pgf@counta\pgf@lib@shapedecoration@spread,\pgf@stop% \ifpgf@lib@shapedecoration@betweenborders% - % + % % Ok. The required sep between borders is: - % + % % (r -(n-1)((a+b)/2))/(n-1) - % + % % r = decoration length (here, the remaining distance) % a = initial width % b = end width % n = the number of shapes - % + % \ifnum\c@pgf@counta>1\relax% \advance\c@pgf@counta-1\relax% \pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/decoration/shape start width}}% @@ -263,11 +263,11 @@ \advance\pgf@x\pgfdecoratedremainingdistance% \divide\pgf@x\c@pgf@counta% \pgf@x.9999\pgf@x% Hackery to control some native TeX inaccuracies. - % + % % Unfortunately if the shape is scaled, and evenly spread by borders, - % it is necessary to do something a bit different to control for + % it is necessary to do something a bit different to control for % (most) inaccuracies. - % + % \ifpgfshapedecorationscaled% \pgf@xa\pgf@lib@shapedecoration@widthchange\relax% \divide\pgf@xa\c@pgf@counta% @@ -285,9 +285,9 @@ \fi% \fi% \else% - % + % % Between centers. - % + % \pgf@x\pgfdecoratedremainingdistance% \ifnum\c@pgf@counta>1\relax% \advance\c@pgf@counta-1\relax% @@ -305,7 +305,7 @@ \edef\pgf@lib@shapedecoration@sep{\the\pgf@x}% \fi% }] - {} + {}% \state{before shape} [ width=\pgf@lib@shapedecoration@beforeshape-1sp, @@ -315,50 +315,50 @@ \ifpgfshapedecorationscaled% \ifpgf@lib@shapedecoration@betweenborders% \ifx\pgf@lib@shapedecoration@spread\pgfutil@empty% - % + % % Not so straightforward. The required ratio is given by - % + % % R = (c+W/2)/(c+r-.5*w) - % + % % c = completed distance % r = remaining distance % W = initial width % w = the change in width (i.e., end - start) - % + % \pgf@x\pgfdecoratedcompleteddistance% \advance\pgf@x\pgfdecoratedremainingdistance% \pgf@xa\pgf@lib@shapedecoration@startwidth\relax% \pgf@xa.5\pgf@xa% \advance\pgf@xa\pgfdecoratedcompleteddistance% c+W/2 - % + % \pgf@xb\pgf@lib@shapedecoration@widthchange\relax% \pgf@xb-.5\pgf@xb% \advance\pgf@xb\pgf@x% c+r-.5*w - % + % \pgfmathdivide@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@xb}}% \fi% \else% - % - % Easy peasy. The required ratio is - % + % + % Easy peasy. The required ratio is + % % R = c / (c+r) - % + % \pgf@y\pgfdecoratedcompleteddistance% \advance\pgf@y\pgfdecoratedremainingdistance% \pgfmathdivide@{\pgfmath@tonumber{\pgfdecoratedcompleteddistance}}{\pgfmath@tonumber{\pgf@y}}% \fi% - % + % % Get the new width. - % + % \ifx\pgf@lib@shapedecoration@spread\pgfutil@empty% \pgf@x\pgf@lib@shapedecoration@widthchange\relax% \pgf@x\pgfmathresult\pgf@x% \advance\pgf@x\pgf@lib@shapedecoration@startwidth\relax% \else% \ifpgf@lib@shapedecoration@betweenborders% - % - % Specical case when decoration is scaled, and evenly spread by borders. - % + % + % Special case when decoration is scaled, and evenly spread by borders. + % \pgf@x\pgf@lib@shapedecoration@width\relax% \advance\pgf@x\pgf@lib@shapedecoration@specialwidth\relax% \pgf@xa\pgf@x% @@ -372,15 +372,15 @@ \fi% \fi% \edef\pgf@lib@shapedecoration@width{\the\pgf@x}% - % + % % New height = R*h + H - % + % \pgf@y\pgf@lib@shapedecoration@heightchange\relax% \pgf@y\pgfmathresult\pgf@y% \advance\pgf@y\pgf@lib@shapedecoration@initialheight\relax% \edef\pgf@lib@shapedecoration@height{\the\pgf@y}% \fi% - % + % \ifpgf@lib@shapedecoration@betweenborders% \pgf@x\pgf@lib@shapedecoration@width\relax% \pgf@x.5\pgf@x% @@ -389,16 +389,16 @@ \def\pgf@lib@shapedecoration@beforeshape{0pt}% \fi% }] - {} + {}% \state{shape}[width=+0sp,next state=after shape] { \ifpgfshapedecorationsloped% \else% \pgftransformrotate{-\pgfdecoratedangle}% \fi% - % + % % Scale the path when it is actually drawn. - % + % \pgf@lib@shapedecoration@shapepathsize% \pgfutil@tempdima\pgf@x% \pgfutil@tempdimb\pgf@y% @@ -406,14 +406,14 @@ \pgf@xb\pgfutil@tempdima% \pgfmathdivide@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@xb}}% \expandafter\pgftransformxscale\expandafter{\pgfmathresult}% - % + % \pgf@ya\pgf@lib@shapedecoration@height\relax% \pgf@yb\pgfutil@tempdimb% \pgfmathdivide@{\pgfmath@tonumber{\pgf@ya}}{\pgfmath@tonumber{\pgf@yb}}% \expandafter\pgftransformyscale\expandafter{\pgfmathresult}% - % + % % Move to the center anchor. - % + % \pgf@lib@shapedecoration@points% \pgf@lib@shapedecoration@macros% \pgftransformshift{% @@ -421,11 +421,11 @@ \pgf@x-\pgf@x% \pgf@y-\pgf@y% }% - % + % % And draw the shape path. - % + % \csname pgf@sh@bg@\pgfkeysvalueof{/pgf/decoration/shape}\endcsname% - } + }% \state{after shape} [ width=\pgf@lib@shapedecoration@aftershape-1sp, @@ -441,28 +441,28 @@ \fi% } ] - {} + {}% \state{sep}[width=\pgf@lib@shapedecoration@sep,next state=before shape, persistent precomputation=\def\pgf@lib@shapedecoration@beforeshape{0pt}] - {} + {}% \state{final} { \pgfpathmoveto{\pgfpointdecoratedpathlast}% - } -} + }% +}% \def\pgf@lib@shapedecoration@setkeyword,{% \pgfutil@ifnextchar\pgf@stop{\def\pgf@temp{}\pgf@lib@@@shapedecoration@setkeyword}{\pgf@lib@@shapedecoration@setkeyword}% -} -\def\pgf@lib@@shapedecoration@setkeyword#1,{\def\pgf@temp{#1}\pgf@lib@@@shapedecoration@setkeyword} +}% +\def\pgf@lib@@shapedecoration@setkeyword#1,{\def\pgf@temp{#1}\pgf@lib@@@shapedecoration@setkeyword}% \def\pgf@lib@@@shapedecoration@setkeyword\pgf@stop{% \ifx\pgf@temp\pgf@lib@shapedecoration@borderstext% \pgf@lib@shapedecoration@betweenborderstrue% \else% \pgf@lib@shapedecoration@betweenbordersfalse% \fi% -} +}% -\endinput
\ No newline at end of file +\endinput |