% Copyright 2008 by Mark Wibrow % % 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. \usepgfmodule{decorations} % % Path replacing decorations % % These decorations change the path by replacing it by another path. % For instance, a line in the path might be replaced by small % ticks or unconnected curves or crosses. Applying a chopping % decoration to a path means that the path can no longer be used for % filling in the original manner. % % % % Kind 1: Path chopping with open subpaths % % % ticks decoration % % Parameters: \pgfdecorationsegmentlength, \pgfdecorationsegmentamplitude \pgfdeclaredecoration{ticks}{ticks} { \state{ticks}[width=+\pgfdecorationsegmentlength] { \pgfpathmoveto{\pgfqpoint{0pt}{\pgfdecorationsegmentamplitude}} \pgfpathlineto{\pgfqpoint{0pt}{-\pgfdecorationsegmentamplitude}} } \state{final} { \pgfpathmoveto{\pgfqpoint{0pt}{\pgfdecorationsegmentamplitude}} \pgfpathlineto{\pgfqpoint{0pt}{-\pgfdecorationsegmentamplitude}} \pgfpathmoveto{\pgfpointdecoratedpathlast} } } % expanding waves decoration % % Parameters: \pgfdecorationsegmentangle, \pgfdecorationsegmentlength \pgfdeclaredecoration{expanding waves}{initial} { \state{initial}[width=+\pgfdecorationsegmentlength,next state=wave] {} \state{wave}[switch if less than=+\pgfdecorationsegmentlength to last, width=+\pgfdecorationsegmentlength] { \pgfpathmoveto{ \pgfpointadd {\pgfqpoint{-\pgfdecoratedcompleteddistance}{0pt}}% {\pgfpointpolar{\pgfdecorationsegmentangle}{+\pgfdecoratedcompleteddistance}}}% \pgfpatharc{\pgfdecorationsegmentangle}{-\pgfdecorationsegmentangle}{+\pgfdecoratedcompleteddistance}% } \state{last}[width=+0pt,next state=final] { \pgfpathmoveto{ \pgfpointadd {\pgfqpoint{-\pgfdecoratedcompleteddistance}{0pt}}% {\pgfpointpolar{\pgfdecorationsegmentangle}{+\pgfdecoratedcompleteddistance}}}% \pgfpatharc{\pgfdecorationsegmentangle}{-\pgfdecorationsegmentangle}{+\pgfdecoratedcompleteddistance}% } \state{final} { \pgfpathmoveto{\pgfpointdecoratedpathlast} } } % waves decoration \pgfdeclaredecoration{waves}{wave} { \state{wave}[width=\pgfdecorationsegmentlength] { \pgftransformxshift{+\pgfdecorationsegmentlength} \pgfpathmoveto{ \pgfpointadd {\pgfqpoint{-\pgfkeysvalueof{/pgf/decoration/start radius}}{0pt}}% {\pgfpointpolar{\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/start radius}}}}% \pgfpatharc{\pgfdecorationsegmentangle}{-\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/start radius}}% } \state{final} { \pgfpathmoveto{\pgfpointdecoratedpathlast} } } % border decoration % % Parameters: \pgfdecorationsegmentlength, \pgfdecorationsegmentamplitude, \pgfdecorationsegmentangle \pgfdeclaredecoration{border}{tick} { \state{tick}[switch if less than=+\pgfdecorationsegmentlength to last, width=+\pgfdecorationsegmentlength] { \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpointpolar{\pgfdecorationsegmentangle}{+\pgfdecorationsegmentamplitude}} } \state{last}[width=+\pgfdecorationsegmentamplitude,next state=final] { \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpointpolar{\pgfdecorationsegmentangle}{+\pgfdecorationsegmentamplitude}} } \state{final} { \pgfpathmoveto{\pgfpointdecoratedpathlast} } } % brace decorations % % Parameters: \pgfdecorationsegmentamplitude \pgfdeclaredecoration{brace}{brace} { \state{brace}[width=+\pgfdecoratedremainingdistance,next state=final] { \pgfpathmoveto{\pgfpointorigin} \pgfpathcurveto {\pgfqpoint{.15\pgfdecorationsegmentamplitude}{.3\pgfdecorationsegmentamplitude}} {\pgfqpoint{.5\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} {\pgfqpoint{\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} { \pgftransformxshift{+\pgfdecorationsegmentaspect\pgfdecoratedremainingdistance} \pgfpathlineto{\pgfqpoint{-\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} \pgfpathcurveto {\pgfqpoint{-.5\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} {\pgfqpoint{-.15\pgfdecorationsegmentamplitude}{.7\pgfdecorationsegmentamplitude}} {\pgfqpoint{0\pgfdecorationsegmentamplitude}{1\pgfdecorationsegmentamplitude}} \pgfpathcurveto {\pgfqpoint{.15\pgfdecorationsegmentamplitude}{.7\pgfdecorationsegmentamplitude}} {\pgfqpoint{.5\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} {\pgfqpoint{\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} } { \pgftransformxshift{+\pgfdecoratedremainingdistance} \pgfpathlineto{\pgfqpoint{-\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} \pgfpathcurveto {\pgfqpoint{-.5\pgfdecorationsegmentamplitude}{.5\pgfdecorationsegmentamplitude}} {\pgfqpoint{-.15\pgfdecorationsegmentamplitude}{.3\pgfdecorationsegmentamplitude}} {\pgfqpoint{0pt}{0pt}} } } \state{final} {} } \endinput