summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex124
1 files changed, 102 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
index 5e13c6cb660..961c657e8cd 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoretransformations.code.tex,v 1.20 2015/08/07 10:17:34 cfeuersaenger Exp $
+\ProvidesFileRCS{pgfcoretransformations.code.tex}
% Position transformations
@@ -34,7 +34,7 @@
% \pgfgettransform\mytransform
\def\pgfgettransform#1{%
- \edef#1{{\pgf@pt@aa}{\pgf@pt@ab}{\pgf@pt@ba}{\pgf@pt@bb}{\the\pgf@pt@x}{\the\pgf@pt@y}}
+ \edef#1{{\pgf@pt@aa}{\pgf@pt@ab}{\pgf@pt@ba}{\pgf@pt@bb}{\the\pgf@pt@x}{\the\pgf@pt@y}}%
}
% Store the current transformation matrix in a set of macros, one for
@@ -50,7 +50,7 @@
% \pgfgettransform\aa\ab\ba\bb\shiftx\shifty
%
% ->
-%
+%
% \pgftransformcm\aa\ab\ba\bb{\pgfqpoint{\shiftx}{\shifty}}
%
% or
@@ -127,6 +127,18 @@
\advance#1 by\pgf@pt@x%
\advance#2 by\pgf@pt@y%
}
+\def\pgf@pos@transform@glob{%
+ \ifpgf@pt@identity%
+ \else%
+ \pgf@pt@temp=\pgf@x%
+ \global\pgf@x=\pgf@pt@aa\pgf@x%
+ \global\advance\pgf@x by\pgf@pt@ba\pgf@y%
+ \global\pgf@y=\pgf@pt@bb\pgf@y%
+ \global\advance\pgf@y by\pgf@pt@ab\pgf@pt@temp%
+ \fi%
+ \global\advance\pgf@x by\pgf@pt@x%
+ \global\advance\pgf@y by\pgf@pt@y%
+}
% Invert the current transformation matrix
@@ -135,7 +147,7 @@
%
% This command replaces the current transformation matrix by its
% inverse. The inversion is not very exact if the matrix is nearly
-% singular.
+% singular.
%
% Example:
%
@@ -196,7 +208,7 @@
% PGF-Level concatenation of the transformation matrix with a given
-% matrix.
+% matrix.
%
% #1 - #5 = a concatenation matrix (see pdf spec). Entry #5 is a
% translation point.
@@ -213,7 +225,7 @@
%
% \pgftransformcm{1}{0}{0}{1}{\pgfpoint{100pt}{0pt}} % 100pt to the right.
%
-% \pgftransformcm{2}{0}{0}{2}{\pgfpointorigin} % double in in size
+% \pgftransformcm{2}{0}{0}{2}{\pgfpointorigin} % double in size
% \pgfpathmoveto{\pgfpoint{0cm}{0cm}}
% \pgfpathlineto{\pgflineto{1cm}{1cm}} % actually 2cm/2cm
@@ -280,7 +292,7 @@
% triangle are called "origin", "x" and "y" are given. After this
% transformation has been applied, the canvas origin is at "origin",
% the vector (1pt,0pt) lies at "x" and the vector (0pt,1pt) lies at
-% "y".
+% "y".
%
% #1 = origin
% #2 = x
@@ -419,14 +431,14 @@
%
% \ifpgfallowupsidedowattime decides whether the transformation should
% be done in such a way that the text is always ``upright,'' that is,
-% text drawn in this coordiante system is never upside-down.
+% text drawn in this coordinate system is never upside-down.
%
% \ifpgfresetnontranslationattime decides whether the coordinate
% system of an xxxattime transformation command should be reset
% (concerning the non-translations) before a possible rotation is
% applied. This is useful, for example, if the main coordinate system
% is scaled by, say, a factor of 2 and you do not want that to apply
-% to the text, but you do want the rotation to applyu.
+% to the text, but you do want the rotation to apply.
\newif\ifpgfslopedattime
\newif\ifpgfallowupsidedownattime
@@ -469,7 +481,7 @@
\advance\pgf@yc by-\pgf@yb%
\ifpgfallowupsidedownattime%
\else%
- \ifdim\pgf@xc<0pt%
+ \ifdim\pgf@xc<0pt%
\pgf@xc=-\pgf@xc%
\pgf@yc=-\pgf@yc%
\fi%
@@ -503,7 +515,7 @@
% }
\def\pgftransformarcaxesattime#1#2#3#4#5#6{%
- \pgfpointarcaxesattime{#1}{#2}{#3}{#4}{#5}{#6}%
+ \pgfpointarcaxesattime{#1}{#2}{#3}{#4}{#5}{#6}%
\pgftransformshift{\pgfqpoint{\pgf@x}{\pgf@y}}%
\ifpgfresetnontranslationattime%
\pgftransformresetnontranslations%
@@ -612,10 +624,10 @@
% Computes transformations adjustments for the current transformation
-% matrix
+% matrix
%
% Description:
-%
+%
% This command is used when you install a transformation matrix that
% scales everything by a certain factor, but you still wish to draw
% something with "an absolute size". Suppose for instance that you
@@ -624,18 +636,18 @@
% if you do not reset the transformation matrix, you can draw a line
% of logical length 2.5mm, which will then get scaled to a line of
% 1cm.
-%
+%
% Things get more difficult in case you scale things only, say,
-% vertically. In this case, the adjustement necessary for horizontal
+% vertically. In this case, the adjustment necessary for horizontal
% lines is different from the one needed for vertical lines.
-%
+%
% This function computes the necessary scaling factors and puts them
% in the macros \pgfhorizontaltransformationadjustment and
% \pgfverticaltransformationadjustment.
-%
+%
% Note that the "right" way to draw a line of absolute length 1cm in a
% transformed coordinate system is to first compute the start point
-% and to then reset the transformation matrix. The transofmration
+% and to then reset the transformation matrix. The transformation
% adjustments computed here are important only in situations where you
% cannot do this, for instance when an "outer xsep" must be set.
@@ -660,7 +672,7 @@
\let\pgfhorizontaltransformationadjustment\pgf@temp@hori%
\let\pgfverticaltransformationadjustment\pgf@temp@vert%
\fi%
-}
+}
\let\pgfhorizontaltransformationadjustment\pgf@one@text
\let\pgfverticaltransformationadjustment\pgf@one@text
@@ -685,12 +697,12 @@
{\pgf@pt@x}{\pgf@pt@y}%
\pgftransformreset%
\pgf@relevantforpicturesizefalse%
-}
+}
% Causes a transformation command to be applied to the ``lowlevel''
-% transformation matrix.
+% transformation matrix.
%
% #1 - a high-level transformation command
%
@@ -706,7 +718,7 @@
%
% \pgflowlevel{\pgftransformcm{1}{0}{0}{1}{\pgfpoint{100pt}{0pt}}} % 100bp to the right.
%
-% \begin{pgflowlevelscope}{\pgftransformcm{2}{0}{0}{2}{\pgfpointorigin}} % double in in size
+% \begin{pgflowlevelscope}{\pgftransformcm{2}{0}{0}{2}{\pgfpointorigin}} % double in size
% \pgfmoveto{\pgfpoint{0cm}{0cm}}
% \pgflineto{\pgflineto{1cm}{1cm}} % actually 2cm/2cm
% \end{pgflowlevelscope}
@@ -727,6 +739,74 @@
+% View boxes
+
+% Establishes a view box scope
+%
+% #1 and #2 = two opposite corners of the source rectangle
+% #3 and #4 = two opposite corners of the target rectangle
+% #5 = "meet" or "slice"
+%
+% Description:
+%
+% Inside the viewbox scope, the source rectangle will be translated
+% and scaled so that it becomes centered on the target rectangle and
+% will, for "meet", be as large as possible so that it fits inside the
+% target and, for "slice", be as small as possible so that it
+% encompasses the target.
+
+\def\pgfviewboxscope#1#2#3#4#5{%
+ {% Compute rectangle corners
+ \pgf@process{#1}%
+ \pgf@pos@transform@glob
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{#2}%
+ \pgf@pos@transform@glob
+ \ifdim\pgf@x<\pgf@xa%
+ \pgf@xb\pgf@x%
+ \pgf@xc\pgf@xa%
+ \else%
+ \pgf@xb\pgf@xa%
+ \pgf@xc\pgf@x%
+ \fi%
+ \ifdim\pgf@y<\pgf@ya%
+ \pgf@yb\pgf@y%
+ \pgf@yc\pgf@ya%
+ \else%
+ \pgf@yb\pgf@ya%
+ \pgf@yc\pgf@y%
+ \fi%
+ \pgf@process{#3}%
+ \pgf@pos@transform@glob
+ \pgf@xa=\pgf@x%
+ \pgf@ya=\pgf@y%
+ \pgf@process{#4}%
+ \pgf@pos@transform@glob
+ \ifdim\pgf@x<\pgf@xa%
+ \else%
+ \pgfutil@tempdima\pgf@x
+ \pgf@x\pgf@xa%
+ \pgf@xa\pgfutil@tempdima%
+ \fi%
+ \ifdim\pgf@y<\pgf@ya%
+ \else%
+ \pgfutil@tempdima\pgf@y
+ \pgf@y\pgf@ya%
+ \pgf@ya\pgfutil@tempdima%
+ \fi%
+ \pgfusetype{.view}%
+ \edef\pgf@marshal{\expandafter\noexpand\csname pgfsys@viewbox#5\endcsname{\the\pgf@x}{\the\pgf@y}{\the\pgf@xa}{\the\pgf@ya}{\the\pgf@xb}{\the\pgf@yb}{\the\pgf@xc}{\the\pgf@yc}}%
+ \pgf@marshal%
+ }%
+ \pgf@relevantforpicturesizefalse%
+}
+
+\def\endpgfviewboxscope{\pgfsys@endviewbox}
+
+\let\startpgfviewboxscope=\pgfviewboxscope
+\let\stoppgfviewboxscope=\endpgfviewboxscope
+
% Forward declarations for nonlinear stuff (have no effect till module
% nonlineartransformations is loaded)