diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-actions.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-actions.tex | 86 |
1 files changed, 82 insertions, 4 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-actions.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-actions.tex index 95d941bd5db..77172602df0 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-actions.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-actions.tex @@ -254,9 +254,9 @@ command is described in Section~\ref{section-transparency}. \subsubsection{Graphic Parameter: Arrows} After a path has been drawn, \pgfname\ can add arrow tips at the -ends. Currently, it will only add arrows correctly at the end of paths -that consist of a single open part. For other paths, like closed paths -or path consisting of multiple parts, the result is not defined. +ends. It will only add arrows at the beginning of the first subpath +and at the end of the last subpath. For closed paths the result is not +defined, that is, it may change without notice in the future. \begin{command}{\pgfsetarrowsstart\marg{arrow kind}} Sets the arrow tip kind used at the start of a (possibly curved) @@ -337,6 +337,84 @@ or path consisting of multiple parts, the result is not defined. \end{command} +\subsubsection{Inner Lines} + +When a path is stroked, it is possible to request that it is stroked +twice, the second time with a different line width and a different +color. This is a useful effect for creating ``double'' lines, for +instance by setting the line width to 2pt and stroking a black line +and then setting the inner line width to 1pt and stroking a white +line on the same path as the original path. This results in what looks +like two lines, each of thickness 0.5pt, spaces 1pt apart. + +You may wonder why there is direct support for this ``double +stroking'' in the basic layer. After all, this effect is easy to +achieve ``by hand''. The main reason is that arrow tips must be +treated in a special manner when such ``double lines'' are +present. First, the order of actions is important: First, the (thick) +main line should be stroked, then the (thin) inner line, and only then +should the arrow tip be drawn. Second, the way an arrow tip looks +typically depends strongly on the width of the inner line, so the +arrow tip code, which is part of the basic layer, needs access to the +inner line thickness. + +Two commands are used to set the inner line width and color. + +\begin{command}{\pgfsetinnerlinewidth\marg{dimension}} + This command sets the width of the inner line. Whenever a path is + stroked (and only then), it will be stroked normally and, afterward, + it is stroked once more with the color set to the inner line color + and the line width set to \meta{dimension}. + + In case arrow tips are added to a path, the path is first stroked + normally, then the inner line is stroked, and then the arrow tip is + added. In case the main path is shortened because of the added arrow + tip, this shortened path is double stroked, not the original path + (which is exactly what you want). + + When the inner line width is set to 0pt, which is the default, no + inner line is stroked at all (not even a line of width 0pt). So, in + order to ``switch off'' double stroking, set \meta{dimension} + to~|0pt|. + + The setting of the inner line width is local to the current \TeX\ + group and \emph{not} to the current \pgfname\ scope. + + Note that inner lines will \emph{not} be drawn for paths that are + also used for clipping. However, this may change in the future, so + you should not depend on this. + +\begin{codeexample}[] +\begin{pgfpicture} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{1cm}{1cm}} + \pgfpathlineto{\pgfpoint{1cm}{0cm}} + \pgfsetlinewidth{2pt} + \pgfsetinnerlinewidth{1pt} + \pgfusepath{stroke} +\end{pgfpicture} +\end{codeexample} +\end{command} + + +\begin{command}{\pgfsetinnerstrokecolor\marg{color}} + This command sets the \meta{color} that is to be used when the inner + line is stroked. The effect of this command is also local to the + current \TeX\ group. + +\begin{codeexample}[] +\begin{pgfpicture} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{1cm}{1cm}} + \pgfpathlineto{\pgfpoint{1cm}{0cm}} + \pgfsetlinewidth{2pt} + \pgfsetinnerlinewidth{1pt} + \pgfsetinnerstrokecolor{red!50} + \pgfusepath{stroke} +\end{pgfpicture} +\end{codeexample} +\end{command} + \subsection{Filling a Path} \label{section-fill} @@ -419,7 +497,7 @@ When you add the |use as bounding box| option, the bounding box of the picture will be enlarged such that the path in encompassed, but any \emph{subsequent} paths of the current \TeX\ scope will not have any effect on the size of the bounding box. Typically, you use this -command at the very beginning of a |{pgfpicture}| environment. +command at the very beginning of a |{pgfpicture}| environment. Alternatively, you can use |\pgfresetboundingbox|, followed by |\pgfusepath{use as bounding box}| to overrule the picture's bounding box completely. \begin{codeexample}[] Left |