summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tcolorbox/tcbskinsjigsaw.code.tex
blob: ca7f86882762e8e911af92099ec0d4709bd622dd (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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
%% The LaTeX package tcolorbox - version 4.31 (2020/07/31)
%% tcbskinsjigsaw.code.tex: Code for colorboxes with different skins
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2020 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
\tcb@set@library@version{4.31}

\tcbuselibrary{skins}

\def\tcb@drawframe@pathjigsaw{%
  \tcb@pathboundary{tcb fill frame}{\tcb@boundaryframe@standardjigsaw}%
}

\def\tcb@boundary@pathfirstjigsaw@A{%
  \tcbdimto\tcb@xa{\tcb@width-\kvtcb@right@rule}%
  \tcbdimto\tcb@ya{\tcb@height-\kvtcb@top@rule}%
  \pgfpathmoveto{\pgfpointorigin}%
  \tcb@arc@out@NW\pgfpathlineto{\pgfqpoint{0pt}{\tcb@height}}%
  \tcb@arc@out@NE\pgfpathlineto{\pgfqpoint{\tcb@width}{\tcb@height}}%
  \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{\tcb@width}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{0pt}}%
  \tcb@arc@ins@NE\pgfpathlineto{\pgfqpoint{\tcb@xa}{\tcb@ya}}%
  \tcb@arc@ins@NW\pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{\tcb@ya}}%
  \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{0pt}}%
  \pgfpathclose%
}

\def\tcb@boundary@pathfirstjigsaw@B{%
  \tcbdimto\tcb@xa{\tcb@width-\kvtcb@right@rule}%
  \tcbdimto\tcb@ya{\kvtcb@bottom@rule+\tcb@innerheight}%
  \pgfpathmoveto{\pgfpointorigin}%
  \tcb@arc@out@NW\pgfpathlineto{\pgfqpoint{0pt}{\tcb@height}}%
  \tcb@arc@out@NE\pgfpathlineto{\pgfqpoint{\tcb@width}{\tcb@height}}%
  \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{\tcb@width}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{\tcb@ya}}%
  \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{\tcb@ya}}%
  \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{0pt}}%
  \pgfpathclose%
}

\def\tcb@drawframe@pathfirstjigsaw{%
  \tcb@pathboundary{tcb fill frame}{%
    \pgfseteorule%
    \iftcb@hasTitle%
      \iftcb@titlefilled%
        \ifdim\dimexpr\kvtcb@title@rule>0pt\relax%
          \tcb@boundary@pathfirstjigsaw@B%
          \tcb@boundarytitle@standard%
        \else%
          \tcb@boundary@pathfirstjigsaw@A%
        \fi%
      \else%
        \tcb@boundary@pathfirstjigsaw@B%
      \fi%
    \else%
      \tcb@boundary@pathfirstjigsaw@A%
    \fi%
  }%
}

\def\tcb@boundary@pathmiddlejigsaw@A{%
  \tcbdimto\tcb@xa{\tcb@width-\kvtcb@right@rule}%
  \pgfpathrectangle{\pgfpointorigin}{\pgfqpoint{\kvtcb@left@rule}{\tcb@height}}%
  \pgfpathrectangle{\pgfqpoint{\tcb@xa}{0pt}}{\pgfqpoint{\kvtcb@right@rule}{\tcb@height}}%
}

\def\tcb@boundary@pathmiddlejigsaw@B{%
  \tcbdimto\tcb@xa{\tcb@width-\kvtcb@right@rule}%
  \tcbdimto\tcb@ya{\tcb@height-\kvtcb@top@rule}%
  \pgfpathmoveto{\pgfpointorigin}%
  \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{0pt}{\tcb@height}}%
  \pgfpathlineto{\pgfqpoint{\tcb@width}{\tcb@height}}%
  \pgfpathlineto{\pgfqpoint{\tcb@width}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{\tcb@ya}}%
  \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{\tcb@ya}}%
  \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{0pt}}%
  \pgfpathclose%
}

\def\tcb@boundary@pathmiddlejigsaw@C{%
  \tcbdimto\tcb@xa{\tcb@width-\kvtcb@right@rule}%
  \tcbdimto\tcb@ya{\kvtcb@bottom@rule+\tcb@innerheight}%
  \pgfpathmoveto{\pgfpointorigin}%
  \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{0pt}{\tcb@height}}%
  \pgfpathlineto{\pgfqpoint{\tcb@width}{\tcb@height}}%
  \pgfpathlineto{\pgfqpoint{\tcb@width}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{\tcb@ya}}%
  \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{\tcb@ya}}%
  \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{0pt}}%
  \pgfpathclose%
}

\def\tcb@drawframe@pathmiddlejigsaw{%
  \tcb@pathboundary{tcb fill frame}{%
    \pgfseteorule%
    \iftcb@hasTitle%
      \iftcb@titlefilled%
        \ifdim\dimexpr\kvtcb@title@rule>0pt\relax%
          \tcb@boundary@pathmiddlejigsaw@C%
          \tcb@arc@zpt%
          \tcbdimto\tcb@ya{\kvtcb@bottom@rule+\tcb@innerheight+\kvtcb@title@rule}%
          \tcbdimto\tcb@xb{\tcb@width-\kvtcb@right@rule}%
          \tcbdimto\tcb@yb{\tcb@height-\kvtcb@top@rule}%
          \pgfpathrectanglecorners{\pgfqpoint{\kvtcb@left@rule}{\tcb@ya}}{\pgfqpoint{\tcb@xb}{\tcb@yb}}%
        \else%
          \tcb@boundary@pathmiddlejigsaw@B%
        \fi%
      \else%
        \tcb@boundary@pathmiddlejigsaw@C%
      \fi%
    \else%
      \tcb@boundary@pathmiddlejigsaw@A%
    \fi%
  }%
}

\def\tcb@drawframe@pathlastjigsaw{%
  \tcb@pathboundary{tcb fill frame}{%
    \pgfseteorule%
    \iftcb@hasTitle%
      \iftcb@titlefilled%
        \ifdim\dimexpr\kvtcb@title@rule>0pt\relax%
          \tcb@boundaryframe@pathlast%
          \tcb@arc@zpt%
          \tcbdimto\tcb@ya{\kvtcb@bottom@rule+\tcb@innerheight+\kvtcb@title@rule}%
          \tcbdimto\tcb@xb{\tcb@width-\kvtcb@right@rule}%
          \tcbdimto\tcb@yb{\tcb@height-\kvtcb@top@rule}%
          \pgfpathrectanglecorners{\pgfqpoint{\kvtcb@left@rule}{\tcb@ya}}{\pgfqpoint{\tcb@xb}{\tcb@yb}}%
          \tcb@boundaryinterior@title@standard%
        \else%
          \tcb@boundaryframe@pathlast%
          \tcb@boundary@base{\kvtcb@left@rule}{\kvtcb@bottom@rule}%
            {\tcb@width-\kvtcb@right@rule}{\tcb@height-\kvtcb@top@rule}%
            {\tcb@arc@ins@SW}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@ins@SE}%
        \fi%
      \else%
        \tcb@boundaryframe@pathlast%
      \fi%
    \else%
      \tcbdimto\tcb@xa{\tcb@width-\kvtcb@right@rule}%
      \pgfpathmoveto{\pgfpointorigin}%
      \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{0pt}{\tcb@height}}%
      \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{\tcb@height}}%
      \tcb@arc@ins@SW\pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{\kvtcb@bottom@rule}}%
      \tcb@arc@ins@SE\pgfpathlineto{\pgfqpoint{\tcb@xa}{\kvtcb@bottom@rule}}%
      \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{\tcb@xa}{\tcb@height}}%
      \pgfpathlineto{\pgfqpoint{\tcb@width}{\tcb@height}}%
      \tcb@arc@out@SE\pgfpathlineto{\pgfqpoint{\tcb@width}{0pt}}%
      \tcb@arc@out@SW\pgfpathclose%
    \fi%
  }%
}


\def\tcb@draw@shadowjigsaw@unbroken{%
  \let\tcb@shadow=\tcb@shadow@unbroken%
  \begin{tcbinvclipframe}%
  \kvtcb@shadow%
  \end{tcbinvclipframe}%
}

\def\tcb@draw@shadowjigsaw@first{%
  \let\tcb@shadow=\tcb@shadow@first%
  \begin{tcbinvclipframe}%
  \kvtcb@shadow%
  \end{tcbinvclipframe}%
}

\def\tcb@draw@shadowjigsaw@middle{%
  \let\tcb@shadow=\tcb@shadow@middle%
  \begin{tcbinvclipframe}%
  \kvtcb@shadow%
  \end{tcbinvclipframe}%
}

\def\tcb@draw@shadowjigsaw@last{%
  \let\tcb@shadow=\tcb@shadow@last%
  \begin{tcbinvclipframe}%
  \kvtcb@shadow%
  \end{tcbinvclipframe}%
}

\tcb@new@skin{enhanced jigsaw}{base@unbroken,%
  frame engine=pathjigsaw,interior titled engine=path,interior engine=path,segmentation engine=path,title engine=path,%
  set@extensions@preframe={\tcb@draw@shadowjigsaw@unbroken},%
  skin first=enhancedfirst jigsaw,skin middle=enhancedmiddle jigsaw,skin last=enhancedlast jigsaw}

\tcb@new@skin{enhancedfirst jigsaw}{base@first,%
  frame engine=pathfirstjigsaw,interior titled engine=pathfirst,interior engine=pathfirst,segmentation engine=path,title engine=pathfirst,%
  set@extensions@preframe={\tcb@draw@shadowjigsaw@first},%
  skin first=enhancedfirst jigsaw,skin middle=enhancedmiddle jigsaw,skin last=enhancedmiddle jigsaw}

\tcb@new@skin{enhancedmiddle jigsaw}{base@middle,%
  frame engine=pathmiddlejigsaw,interior titled engine=pathmiddle,interior engine=pathmiddle,segmentation engine=path,title engine=pathmiddle,%
  set@extensions@preframe={\tcb@draw@shadowjigsaw@middle},%
  skin first=enhancedmiddle jigsaw,skin middle=enhancedmiddle jigsaw,skin last=enhancedmiddle jigsaw}

\tcb@new@skin{enhancedlast jigsaw}{base@last,%
  frame engine=pathlastjigsaw,interior titled engine=pathlast,interior engine=pathlast,segmentation engine=path,title engine=pathlast,%
  set@extensions@preframe={\tcb@draw@shadowjigsaw@last},%
  skin first=enhancedmiddle jigsaw,skin middle=enhancedmiddle jigsaw,skin last=enhancedlast jigsaw}

\tcbset{%
  enhanced jigsaw/.style={skin=enhanced jigsaw},%
  enhanced standard jigsaw/.style={skin=enhanced jigsaw,
    skin first=enhanced jigsaw,skin middle=enhanced jigsaw,skin last=enhanced jigsaw},%
  frame engine/pathjigsaw/.style={frame code=\tcb@drawframe@pathjigsaw},
  frame engine/pathfirstjigsaw/.style={frame code=\tcb@drawframe@pathfirstjigsaw},
  frame engine/pathmiddlejigsaw/.style={frame code=\tcb@drawframe@pathmiddlejigsaw},
  frame engine/pathlastjigsaw/.style={frame code=\tcb@drawframe@pathlastjigsaw},
}