| 1 |
% Copyright 2022 by Qrrbrbirlbel |
| 2 |
% |
| 3 |
% This file may be distributed and/or modified |
| 4 |
% |
| 5 |
% 1. under the LaTeX Project Public License and/or |
| 6 |
% 2. under the GNU Free Documentation License. |
| 7 |
% |
| 8 |
\unless\ifcsname pgfextset\endcsname |
| 9 |
\input tikzext-util.tex |
| 10 |
\fi |
| 11 |
|
| 12 |
\pgfextset{ |
| 13 |
heatmark arc width/.initial=+4pt, |
| 14 |
heatmark arc sep/.initial=+1pt, |
| 15 |
heatmark arc rings/.initial=3, |
| 16 |
heatmark arcs/.initial=3, |
| 17 |
heatmark arc sep angle/.initial=20, |
| 18 |
heatmark inner opacity/.initial=.8, |
| 19 |
heatmark outer opacity/.initial=.2 |
| 20 |
} |
| 21 |
\pgfdeclareshape{ext_heatmark} |
| 22 |
% |
| 23 |
% Draws a circle around the text |
| 24 |
% |
| 25 |
{ |
| 26 |
\savedanchor\centerpoint{% |
| 27 |
\pgf@x=.5\wd\pgfnodeparttextbox% |
| 28 |
\pgf@y=.5\ht\pgfnodeparttextbox% |
| 29 |
\advance\pgf@y by-.5\dp\pgfnodeparttextbox% |
| 30 |
} |
| 31 |
|
| 32 |
\saveddimen\innerradius{% |
| 33 |
% |
| 34 |
% Calculate ``height radius'' |
| 35 |
% |
| 36 |
\pgf@ya=.5\ht\pgfnodeparttextbox% |
| 37 |
\advance\pgf@ya by.5\dp\pgfnodeparttextbox% |
| 38 |
\pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}% |
| 39 |
\advance\pgf@ya by\pgf@yb% |
| 40 |
% |
| 41 |
% Calculate ``width radius'' |
| 42 |
% |
| 43 |
\pgf@xa=.5\wd\pgfnodeparttextbox% |
| 44 |
\pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}% |
| 45 |
\advance\pgf@xa by\pgf@xb% |
| 46 |
% |
| 47 |
% Calculate length of radius vector: |
| 48 |
% |
| 49 |
\pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}% |
| 50 |
\ifdim\pgf@x>\pgf@y% |
| 51 |
\c@pgf@counta=\pgf@x% |
| 52 |
\ifnum\c@pgf@counta=0\relax% |
| 53 |
\else% |
| 54 |
\divide\c@pgf@counta by 255\relax% |
| 55 |
\pgf@xa=16\pgf@xa\relax% |
| 56 |
\divide\pgf@xa by\c@pgf@counta% |
| 57 |
\pgf@xa=16\pgf@xa\relax% |
| 58 |
\fi% |
| 59 |
\else% |
| 60 |
\c@pgf@counta=\pgf@y% |
| 61 |
\ifnum\c@pgf@counta=0\relax% |
| 62 |
\else% |
| 63 |
\divide\c@pgf@counta by 255\relax% |
| 64 |
\pgf@ya=16\pgf@ya\relax% |
| 65 |
\divide\pgf@ya by\c@pgf@counta% |
| 66 |
\pgf@xa=16\pgf@ya\relax% |
| 67 |
\fi% |
| 68 |
\fi% |
| 69 |
\pgf@x=\pgf@xa% |
| 70 |
% |
| 71 |
% If necessary, adjust radius so that the size requirements are |
| 72 |
% met: |
| 73 |
% |
| 74 |
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}% |
| 75 |
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}% |
| 76 |
\ifdim\pgf@x<.5\pgf@xb% |
| 77 |
\pgf@x=.5\pgf@xb% |
| 78 |
\fi% |
| 79 |
\ifdim\pgf@x<.5\pgf@yb% |
| 80 |
\pgf@x=.5\pgf@yb% |
| 81 |
\fi% |
| 82 |
}% |
| 83 |
|
| 84 |
\saveddimen\radius{% |
| 85 |
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% |
| 86 |
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% |
| 87 |
\ifdim\pgf@xb<\pgf@yb% |
| 88 |
\advance\pgf@x by\pgf@yb% |
| 89 |
\else% |
| 90 |
\advance\pgf@x by\pgf@xb% |
| 91 |
\fi% |
| 92 |
\pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/ext/heatmark arc rings}}% |
| 93 |
\pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/ext/heatmark arc width}+\pgfkeysvalueof{/pgf/ext/heatmark arc sep}}% |
| 94 |
\multiply\pgf@xa\c@pgf@counta |
| 95 |
\advance\pgf@x\pgf@xa |
| 96 |
}% |
| 97 |
% |
| 98 |
% Anchors |
| 99 |
% |
| 100 |
\inheritanchor[from=circle]{north} |
| 101 |
\inheritanchor[from=circle]{north west} |
| 102 |
\inheritanchor[from=circle]{north east} |
| 103 |
\inheritanchor[from=circle]{center} |
| 104 |
\inheritanchor[from=circle]{west} |
| 105 |
\inheritanchor[from=circle]{east} |
| 106 |
\inheritanchor[from=circle]{mid} |
| 107 |
\inheritanchor[from=circle]{mid west} |
| 108 |
\inheritanchor[from=circle]{mid east} |
| 109 |
\inheritanchor[from=circle]{base} |
| 110 |
\inheritanchor[from=circle]{base west} |
| 111 |
\inheritanchor[from=circle]{base east} |
| 112 |
\inheritanchor[from=circle]{south} |
| 113 |
\inheritanchor[from=circle]{south west} |
| 114 |
\inheritanchor[from=circle]{south east} |
| 115 |
\inheritanchorborder[from=circle] |
| 116 |
% |
| 117 |
% Background path |
| 118 |
% |
| 119 |
\backgroundpath{ |
| 120 |
\pgfutil@tempdima=\innerradius% |
| 121 |
\pgfpathcircle{\centerpoint}{\pgfutil@tempdima}% |
| 122 |
}% |
| 123 |
% |
| 124 |
% |
| 125 |
% |
| 126 |
\behindbackgroundpath{% |
| 127 |
\pgfmathsetcount\c@pgf@counta{\pgfkeysvalueof{/pgf/ext/heatmark arc rings}}% heat arc rings |
| 128 |
\pgfmathsetcount\c@pgf@countb{\pgfkeysvalueof{/pgf/ext/heatmark arcs}}% heat arcs |
| 129 |
\pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/ext/heatmark arc width}}% heat arc width |
| 130 |
\pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/ext/heatmark arc sep}}% heat arc sep |
| 131 |
\pgfmathsetmacro\pgf@tempb{360/\c@pgf@countb-(\pgfkeysvalueof{/pgf/ext/heatmark arc sep angle})}% heat arc |
| 132 |
\pgfmathsetmacro\pgf@tempc{\pgfkeysvalueof{/pgf/shape border rotate}}% heat rotate |
| 133 |
% |
| 134 |
\pgfmathsetmacro\pgf@tempd{\pgfkeysvalueof{/pgf/ext/heatmark inner opacity}}% heat opacity high |
| 135 |
\ifnum\c@pgf@counta=1 |
| 136 |
\def\tikzext@heatmark@opacity@seps{0}% |
| 137 |
\else |
| 138 |
\pgfmathsetmacro\tikzext@heatmark@opacity@seps |
| 139 |
{(\pgf@tempd-(\pgfkeysvalueof{/pgf/ext/heatmark outer opacity}))% |
| 140 |
/(\c@pgf@counta-1)}% |
| 141 |
\fi |
| 142 |
\pgfutil@tempcnta=0 |
| 143 |
\pgfutil@tempcntb=0 |
| 144 |
\pgf@ya\innerradius\relax |
| 145 |
\pgftransformshift{\centerpoint}% |
| 146 |
\pgfutil@loop % ring loop |
| 147 |
\advance\pgf@ya\pgf@xb % current radius + heat arc sep |
| 148 |
\pgf@yb\pgf@ya |
| 149 |
\advance\pgf@yb\pgf@xa % current radius + heat arc sep + heat arc width |
| 150 |
\pgfsetfillopacity{\pgf@tempd}% |
| 151 |
\begingroup |
| 152 |
\edef\pgf@marshal{\noexpand\pgfset{ext/heatmark ring \the\numexpr\pgfutil@tempcnta+1\relax/.try}}% |
| 153 |
\pgf@marshal |
| 154 |
\csname tikz@options\endcsname |
| 155 |
{% |
| 156 |
\pgfutil@loop |
| 157 |
\pgfmathsetmacro\tikzext@heatmark@start@angle{\[email protected]*\pgf@tempb+\pgfutil@tempcntb*(360/\c@pgf@countb)}% |
| 158 |
% path |
| 159 |
\begingroup |
| 160 |
\edef\pgf@marshal{\noexpand\pgfset{ext/heatmark arc \the\numexpr\pgfutil@tempcntb+1\relax/.try}% |
| 161 |
\noexpand\pgfset{ext/heatmark ring \the\numexpr\pgfutil@tempcnta+1\relax\space arc \the\numexpr\pgfutil@tempcntb+1\relax/.try}}% |
| 162 |
\pgf@marshal |
| 163 |
\csname tikz@options\endcsname |
| 164 |
\pgfpathmoveto{\pgfpointpolar{\tikzext@heatmark@start@angle}{\pgf@ya}}% |
| 165 |
\pgfpatharc{\tikzext@heatmark@start@angle}{\tikzext@heatmark@start@angle+\pgf@tempb}{\pgf@ya}% |
| 166 |
\pgfpathlineto{\pgfpointpolar{\tikzext@heatmark@start@angle+\pgf@tempb}{\pgf@yb}}% |
| 167 |
\pgfpatharc{\tikzext@heatmark@start@angle+\pgf@tempb}{\tikzext@heatmark@start@angle}{\pgf@yb}% |
| 168 |
\pgfpathclose |
| 169 |
\pgfusepathqfill |
| 170 |
\endgroup |
| 171 |
\advance\pgfutil@tempcntb\@ne |
| 172 |
\ifnum\pgfutil@tempcntb<\c@pgf@countb |
| 173 |
\pgfutil@repeat |
| 174 |
}% |
| 175 |
\endgroup |
| 176 |
\advance\pgfutil@tempcnta\@ne |
| 177 |
\ifnum\pgfutil@tempcnta<\c@pgf@counta |
| 178 |
\pgf@ya\pgf@yb |
| 179 |
\pgfmathsetmacro\pgf@tempd{\pgf@tempd-\tikzext@heatmark@opacity@seps}% |
| 180 |
\pgfutil@repeat |
| 181 |
\pgftransformshift{\pgfqpointscale{-1}{\centerpoint}}% |
| 182 |
} |
| 183 |
} |
| 184 |
%%% Compatibility |
| 185 |
\pgfkeysifdefined{/tikz/ext/compat/shapes/.@cmd}{}{\pgfextset{/tikz-ext/compat/add library={shapes}{pre 0.6}}} |
| 186 |
\tikzextset{ |
| 187 |
compat/shapes/warn/.append style=/tikz/ext/compat/shapes.heatmark/warn, |
| 188 |
compat/shapes/pre 0.6/.append style=/tikz/ext/compat/shapes.heatmark/pre 0.6, |
| 189 |
compat/shapes.heatmark/warn/.code={% |
| 190 |
\tikzextutil@compatwarning@valuekey{shapes}{pre 0.6}{/pgf/heatmark arc width}{/pgf/ext/heatmark arc width}% |
| 191 |
\tikzextutil@compatwarning@valuekey{shapes}{pre 0.6}{/pgf/heatmark arc sep}{/pgf/ext/heatmark arc sep}% |
| 192 |
\tikzextutil@compatwarning@valuekey{shapes}{pre 0.6}{/pgf/heatmark arc rings}{/pgf/ext/heatmark arc rings}% |
| 193 |
\tikzextutil@compatwarning@valuekey{shapes}{pre 0.6}{/pgf/heatmark arcs}{/pgf/ext/heatmark arcs}% |
| 194 |
\tikzextutil@compatwarning@valuekey{shapes}{pre 0.6}{/pgf/heatmark arc sep angle}{/pgf/ext/heatmark arc sep angle}% |
| 195 |
\tikzextutil@compatwarning@valuekey{shapes}{pre 0.6}{/pgf/heatmark inner opacity}{/pgf/ext/heatmark inner opacity}% |
| 196 |
\tikzextutil@compatwarning@valuekey{shapes}{pre 0.6}{/pgf/heatmark outer opacity}{/pgf/ext/heatmark outer opacity}% |
| 197 |
\tikzextutil@compat@cloneshape{heatmark}{text,north,north west,north east,center,west,east,mid,mid west,mid east,base,base west,base east,south,south west,south east,center}% |
| 198 |
\def\tikzext@temp{\tikzextutil@compatmaybewarning{shape 'heatmark'}{'ext_heatmark'}{shapes = pre 0.6}}% |
| 199 |
\tikzextutil@prefix@macrotomacro\pgf@sh@s@heatmark\tikzext@temp |
| 200 |
}, |
| 201 |
compat/shapes.heatmark/pre 0.6/.code={% |
| 202 |
\pgfkeysdef{/pgf/heatmark arc width}{\pgfkeyssetvalue{/pgf/ext/heatmark arc width{##1}}}% |
| 203 |
\pgfkeysdef{/pgf/heatmark arc sep}{\pgfkeyssetvalue{/pgf/ext/heatmark arc sep{##1}}}% |
| 204 |
\pgfkeysdef{/pgf/heatmark arc rings}{\pgfkeyssetvalue{/pgf/ext/heatmark arc rings{##1}}}% |
| 205 |
\pgfkeysdef{/pgf/heatmark arcs}{\pgfkeyssetvalue{/pgf/ext/heatmark arcs{##1}}}% |
| 206 |
\pgfkeysdef{/pgf/heatmark arc sep angle}{\pgfkeyssetvalue{/pgf/ext/heatmark arc sep angle{##1}}}% |
| 207 |
\pgfkeysdef{/pgf/heatmark inner opacity}{\pgfkeyssetvalue{/pgf/ext/heatmark inner opacity{##1}}}% |
| 208 |
\pgfkeysdef{/pgf/heatmark outer opacity}{\pgfkeyssetvalue{/pgf/ext/heatmark outer opacity{##1}}}% |
| 209 |
\pgfkeyssetvalue{/pgf/heatmark arc width}{\pgfkeysvalueof{/pgf/ext/heatmark arc width}}% |
| 210 |
\pgfkeyssetvalue{/pgf/heatmark arc sep}{\pgfkeysvalueof{/pgf/ext/heatmark arc sep}}% |
| 211 |
\pgfkeyssetvalue{/pgf/heatmark arc rings}{\pgfkeysvalueof{/pgf/ext/heatmark arc rings}}% |
| 212 |
\pgfkeyssetvalue{/pgf/heatmark arcs}{\pgfkeysvalueof{/pgf/ext/heatmark arcs}}% |
| 213 |
\pgfkeyssetvalue{/pgf/heatmark arc sep angle}{\pgfkeysvalueof{/pgf/ext/heatmark arc sep angle}}% |
| 214 |
\pgfkeyssetvalue{/pgf/heatmark inner opacity}{\pgfkeysvalueof{/pgf/ext/heatmark inner opacity}}% |
| 215 |
\pgfkeyssetvalue{/pgf/heatmark outer opacity}{\pgfkeysvalueof{/pgf/ext/heatmark outer opacity}}% |
| 216 |
\tikzextutil@compat@cloneshape{heatmark}{text,north,north west,north east,center,west,east,mid,mid west,mid east,base,base west,base east,south,south west,south east,center}% |
| 217 |
}, |
| 218 |
compat/shapes.heatmark/\pgfkeysvalueof{/tikz/ext/compat/shapes}% |
| 219 |
} |
| 220 |
\endinput |