I'm been playing around with [reverseclip] from How can I invert a 'clip' selection within TikZ?. It works quite well. When you apply [reverseclip] it seems to add another part to your path---a clockwise traversal of the current page. However, I am having trouble understanding how the interior of a multi-part path is determined. An example:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
% A path that follows the edges of the current page, CW
\tikzstyle{reverseclip}=[insert path={(current page.north east) --
(current page.south east) --
(current page.south west) --
(current page.north west) --
(current page.north east)}
]
\coordinate (A) at (0,0);
\coordinate (B) at (1,0);
\coordinate (C) at (1,1);
\begin{pgfinterruptboundingbox}
\path [clip] (A) -- (B) -- (C) [reverseclip]; % good, CCW
% \path [clip] (C) -- (B) -- (A) [reverseclip]; % bad, CW
\end{pgfinterruptboundingbox}
\fill[red!30] (A) circle (3cm);
%\fill[red!30,even odd rule] (A) circle (3cm); % does not make bad good
\end{tikzpicture}
\end{document}
So what happens is that I only get the desired reverse clipping if the orientation of my path is counter-clockwise. When I make the orientation clockwise, everything is undesirably filled.
In the documentation, Section 15.4.2 Graphic Parameters: Interior Rules, I learned about the nonzero and even odd rules. I rationalized this behavior by imagining the circle drawn in a CW fashion. Then, the first clip path is CCW and everything should work. With the nonzero rule, it made sense why a CW clip path would not clip anything. But then, I tried specifying the even odd rule, expecting that this would make the result independent of the orientation of the clip path. My expectations were wrong.
It seems that the interior rules are not applying in the way I understood they would.
- When (reverse) clipping, how is the interior region determined?
- How can I reverse a path saved via \pgfsyssoftpath@getcurrentpath{\mypath}?
- Besides defining [reverseclipCW] and [reverseclipCCW], is there a way to make the reverseclip concept more robust to the orientation of paths?
- What is the orientation of basic shapes (circle, rectangle, etc)? Clockwise?