summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryspy.code.tex
blob: b23cf08caf2349b633302eb4eb8188a7f3fd5139 (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
% Copyright 2008 by Till Tantau
%
% 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.

\ProvidesFileRCS{tikzlibraryspy.code.tex}



% Spy styles

\tikzset{
  spy using outlines/.style={
    spy scope={
      every spy on node/.style={very thin,draw},
      every spy in node/.style={thick,draw},
      #1
    }
  },
  spy using overlays/.style={
    spy scope={
      every spy on node/.style={fill,fill opacity=0.2,text opacity=1},
      every spy in node/.style={fill,fill opacity=0.2,text opacity=1},
      #1
    }
  },
  connect spies/.style={
    spy connection path={\draw[thin] (tikzspyonnode) -- (tikzspyinnode);}
  }
}%

\newbox\tikz@lib@spybox

\let\tikz@lib@spy@collection=\pgfutil@empty%

\tikzset{spy scope/.style={
    size/.style={minimum size=##1},
    height/.style={minimum height=##1},
    width/.style={minimum width=##1},
    execute at begin scope={%
      \let\tikz@lib@spy@save=\tikz@lib@spy@collection%
      \setbox\tikz@lib@spybox=\hbox\bgroup\bgroup%
      \let\spy=\tikz@lib@spy@parse},
    execute at end scope={%
      \egroup\egroup%
      {%
        \copy\tikz@lib@spybox%
        \tikz@lib@spy@collection%
      }%
      \global\let\tikz@lib@spy@collection=\tikz@lib@spy@save%
    },%
    tikz@lib@spy@style/.style={#1},
    tikz@lib@reset@gs
  },
  lens/.store in=\tikz@lib@spy@lens,
  lens=,
  magnification/.style={lens={scale=#1}},
  spy connection path/.store in=\tikz@lib@spy@path,
  spy connection path=
}%

\tikzset{
  tikz@lib@reset@gs/.style={black,thin,solid,opaque,line cap=butt,line join=miter}
}%

\def\tikz@lib@spy@parse{%
  \pgfutil@ifnextchar[{\tikz@lib@spy@parse@opt}{\tikz@lib@spy@parse@opt[]}%]
}%
\def\tikz@lib@spy@parse@opt[#1]{
  \pgfutil@ifnextchar x{\tikz@lib@spy@parse@opta[#1]}{\tikz@lib@spy@parse@opta[#1]}%]
}%
\def\tikz@lib@spy@parse@opta[#1]on#2in node#3;{%
  \pgfutil@g@addto@macro\tikz@lib@spy@collection{\tikz@lib@spy@do{#1}{#2}{#3}}%
}%

\def\tikz@lib@spy@do#1#2#3{%
  \scope[tikz@lib@spy@style,#1]
    \node [alias=tikzspyonnode,inner sep=0pt,outer sep=0pt,every spy on node/.try,
    /utils/exec={
      {%
        \let\tikz@transform=\relax
        \pgftransformreset%
        \expandafter\tikzset\expandafter{\tikz@lib@spy@lens}
        \pgftransforminvert%
        \pgfgettransformentries\a\b\c\d\e\f%
        \global\let\pgf@lib@svg@a=\a%
        \global\let\pgf@lib@svg@b=\b%
        \global\let\pgf@lib@svg@c=\c%
        \global\let\pgf@lib@svg@d=\d%
      }%
      \tikz@addtransform{%
        \tikz@scan@one@point\pgftransformshift#2%
        \pgftransformcm{\pgf@lib@svg@a}{\pgf@lib@svg@b}{\pgf@lib@svg@c}{\pgf@lib@svg@d}{\pgfpointorigin}%
      }
    }]{};
    \node [alias=tikzspyinnode,inner sep=0pt,outer sep=0pt,at={#2},every spy in node/.try,
    path picture={\node[anchor=center,tikz@lib@reset@gs]{\nullfont%
        \pgfpicture\relax\pgfsetbaseline{default}\pgfsettrimleft{default}\pgfsettrimright{default}%
        \pgftransformreset%
        \let\tikz@transform=\relax%
        \expandafter\tikzset\expandafter{\tikz@lib@spy@lens}%
        \pgflowlevelsynccm%
        \tikz@scan@one@point\tikz@lib@spy@shift#2%
        \pgflowlevelsynccm%
        \copy\tikz@lib@spybox%
        \endpgfpicture};}]#3{};
    \tikz@lib@spy@path
  \endscope
}%

\def\tikz@lib@spy@shift#1{%
  \pgf@process{#1}%
  \pgf@x=-\pgf@x%
  \pgf@y=-\pgf@y%
  \pgftransformshift{}%
}%



\endinput