I'm trying to overlay a picture with a semiopaque rectangle, then cut out some shapes (rectangles and circles) so the image is clear in those, then point to the cutouts with something like tikz \pin
command.
My problem is that the only examples i could find for cutouts use \fill
and then simply pile on the cutout shapes. Is there a way to create those cutouts directly from nodes so i can later reference those nodes? Currently i am simply defining another node with the same coordinates later, to refer to that, but it would be a lot cleaner if it was possible to use the nodes for cutting directly.
MWE (without nodes, from an example in the answer by Alex Recuenco in this Q: How to create a rectangle with a transparent hole):
\documentclass{article}
\usepackage{tikz}
\begin{document}
\section{Non Zero Rule}
\begin{tikzpicture}
\draw[black, fill = black, fill opacity = 0.5, semithick]
(0,0) rectangle (5,5) (2.5,2.5) circle (0.5);
\end{tikzpicture}
\section{Even Odd Rule}
\begin{tikzpicture}
% \node (image) {\includegraphics{somepic_with_cool_features}}
\draw[black, fill = black, fill opacity = 0.5, semithick, even odd rule]
(0,0) rectangle (5,5) (2.5,2.5) circle (0.5);
\end{tikzpicture}
\end{document}
To clarify: My dream would be to have something like
% \node (image) {\includegraphics{somepic_with_cool_features}}
\draw[black, fill = black, fill opacity = 0.5, semithick, even odd rule]
(0,0) rectangle (5,5) {%
\node[pin={[red]60:Cool feature one!}] (circ1) (2.5,2.5) circle (0.5);
\node[pin={[red]60:Wow another one!}] (circ2) (4,4) circle (0.5);
\node[pin={[red]60:A whole bunch!}] (rect1) (5,6) rectangle (7,9);%
}