\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreobjects.code.tex,v 1.1.1.1 2005/06/29 12:14:04 tantau Exp $ % Copyright 2005 by Till Tantau . % % This program can be redistributed and/or modified under the terms % of the GNU Public License, version 2. % Object reuse % Define a pgf object for reuse. Such objects will be stored % efficiently internally. % % #1 = name for later reuse % #2 = lower left corner point of bounding box % #3 = upper right left corner point of bounding box % #4 = pure pgf code (nothing too fancy!) % % Description: % % Used to define reusable objects. The object must be composed of % basic pgf graphic primitives. Nothing fancy can be used. The % created object will be stored as an xform object in pdf or as a % postscript procedure in postscript. % % Example: % % \pgfdefobject{myrect}{\pgfpoint{-1pt}{-1pt}}{\pgfpoint{11pt}{11pt}} % {\pgfpathqmoveto{0pt}{0pt} % \pgfpathqmoveto{10pt}{0pt} % \pgfpathqmoveto{10pt}{10pt} % \pgfpathqmoveto{0pt}{10pt} % \pgfpathclose % \pgfusepath{stroke}} % % \begin{pgfpicture}{0cm}{0cm}{1cm}{1cm} % \pgfuseobject{myrect} % \end{pgfpicture} \def\pgfdefobject#1#2#3#4{% \pgfinterruptpath% \pgf@relevantforpicturesizefalse% \pgfsys@defobject{#1}{#2}{#3}{#4}% \endpgfinterruptpath% \ignorespaces% } % Use an object that was previously defined using pgfdefobject % % #1 = name of previously defined object % % Example: % % \pgfdefobject{myrect}{\pgfpoint{-1pt}{-1pt}}{\pgfpoint{11pt}{11pt}} % {\pgfqmoveto{0}{0} % \pgfqmoveto{10}{0} % \pgfqmoveto{10}{10} % \pgfqmoveto{0}{10} % \pgfclosestroke} % % \begin{pgfpicture}{0cm}{0cm}{1cm}{1cm} % \pgfuseobject{myrect} % \end{pgfpicture} \def\pgfuseobject#1{\pgfsys@beginscope\pgfsys@useobject{#1}{}\pgfsys@endscope} % Use an object that was previously defined using pgfdefobject, but % magnify the object by the current x and y register values % % #1 = name of previously defined object % % Example: % % \pgfdefobject{myrect}{\pgfpoint{-1pt}{-1pt}}{\pgfpoint{11pt}{11pt}} % {\pgfqmoveto{0}{0} % \pgfqmoveto{10}{0} % \pgfqmoveto{10}{10} % \pgfqmoveto{0}{10} % \pgfclosestroke} % % \begin{pgfpicture}{0cm}{0cm}{1cm}{1cm} % \pgf@x=2pt% Scale by factor two in x-direction % \pgf@y=2pt% Scale by factor two in y-direction % \pgfuseobjectmagnify{myrect} % \end{pgfpicture} \def\pgfuseobjectmagnify#1{% \pgfsys@beginscope% \pgfsys@useobject{#1}{\pgfsys@transformxyscale{\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}}% \pgfsys@endscope% } \endinput