% !TeX spellcheck = en_US
% !TeX root = tikz-ext-manual.tex
% Copyright 2022 by Qrrbrbirlbel
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Free Documentation License.
%
\section{Shape: Heatmark}
\begin{pgflibrary}{ext.shapes.heatmark}
  A circular shape that has customizable rings around it.
  \inspiration{ShapeHeat-Q}{ShapeHeat-A}
\end{pgflibrary}

\begin{ext_shape}{heatmark}
  \begin{key}{/\pgfext/heatmark arcs=\meta{arcs num} (initially 3)}\keycompat{pgf}
  Sets the number of arc around the circle to \meta{arcs num}.
  \end{key}
  \begin{key}{/\pgfext/heatmark arc width=\meta{arc width} (initially 4pt)}\keycompat{pgf}
  Sets the width of the rings around the circle to \meta{arc width}.
  \end{key}
  \begin{key}{/\pgfext/heatmark arc sep=\meta{sep length} (initially 1pt)}\keycompat{pgf}
  Sets the whitespace between the rings to \meta{sep length}.
  \end{key}
  \begin{key}{/\pgfext/heatmark arc rings=\meta{rings num} (initially 3)}\keycompat{pgf}
  Sets the number of rings around the circle to \meta{rings num}
  \end{key}
  \begin{key}{/\pgfext/heatmark arc sep angle=\meta{sep angle} (initially 20)}\keycompat{pgf}
  Sets the whitespace angle between the arcs in one ring to \meta{sep angle}.
  \end{key}
  \begin{key}{/\pgfext/heatmark inner opacity=\meta{inner opacity} (initially 0.8)}\keycompat{pgf}
  Sets the opacity of the inner ring to \meta{inner opacity}.
  \end{key}
  \begin{key}{/\pgfext/heatmark outer opacity=\meta{low opacity} (initially 0.2)}\keycompat{pgf}
  Sets the opacity of the outer ring to \meta{outer opacity}.
  
  The opacity of the rings between the outer and the inner ring will be interpolated by these two opacities.
  \end{key}

This shape takes the value of |/pgf/shape border rotate|%
\indexKeyO[/pgf/]{shape border rotate} into consideration.

For every ring and for every arc the following styke keys are tried.
\begin{stylekey}{/\pgfext/heatmark ring \meta{ring number}}
\end{stylekey}
\begin{stylekey}{/\pgfext/heatmark arc \meta{arc number}}
\end{stylekey}
\begin{stylekey}{/\pgfext/heatmark ring \meta{ring number} arc \meta{arc number}}
\end{stylekey}

The \pgfname shape is setup in a way that even \tikzname\space
styles can be used with a little bit work:
\begin{codeexample}[preamble=\usetikzlibrary{ext.shapes.heatmark}]
\tikz[
  shape border rotate=90,
  /pgf/ext/heatmark ring 1/.append style={/tikz/fill=green},
  /pgf/ext/heatmark arc 1/.append style={/tikz/fill=blue},
  /pgf/ext/heatmark ring 2 arc 2/.append style={/tikz/fill=yellow!70!black}
] \node[ext_heatmark, fill=red] (n) {100};
\end{codeexample}

It is best to use this shape with no actual border (|draw = none|) and the |outer sep| set to zero.
\begin{codeexample}[preamble=\usetikzlibrary{ext.shapes.heatmark},width=16cm]
\begin{tikzpicture}\Huge
\node[name=s, shape=ext_heatmark, shape example,
  fill=blue!25, draw=none, outer sep=0pt]
  {Heatmark\vrule width 1pt height 2cm};
\foreach \anchor/\placement in
  {north west/above left, north/above,
                          north east/above right,
         west/left, center/above,      east/right,
     mid west/right,   mid/above,  mid east/left,
    base west/left,   base/below, base east/right,
   south west/below left, south/below,
                          south east/below right,
   text/left, 10/right, 130/above}
   \draw[shift=(s.\anchor)] plot[mark=x] coordinates{(0,0)}
     node[\placement] {\scriptsize\texttt{(s.\anchor)}};
\end{tikzpicture}
\end{codeexample}
\end{ext_shape}
\endinput