blob: fd12c5d9146a7b883a1ff331a8b4f14a2b474b61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
\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 <tantau@cs.tu-berlin.de>.
%
% 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
|