How to invert even-odd filling?
The Postscript Language Reference does not provide, for example, an Odd-Even Rule (oefill
) counterpart to the Even-Odd Rule (eofill
). So, you have to find a way to retrace the entire area - specific to the shape - so that "odd" regions become "even", and "even" ones become "odd".
\documentclass[pstricks,border=5pt]{standalone}
\usepackage{pstricks}% http://tug.org/PSTricks/main.cgi/
\begin{document}
\begin{pspicture}[linewidth=2pt](6,4)
\pscustom[fillcolor=blue,fillstyle=eofill,linestyle=none,linewidth=0pt]
{%
\psellipticarc(2,2)(2,2){60}{-300}% Left (complete) ellipse/circle
\psellipticarc(4,2)(2,2){120}{-240}% Right (complete) ellipse/circle
\psellipticarc(2,2)(2,2){60}{-60}% Left (incomplete) segment
\psellipticarc(4,2)(2,2){-120}{120}% Right (incomplete) segment
}%
\psellipse[linecolor=yellow](4,2)(2,2)
\psellipse[linecolor=green](2,2)(2,2)
\end{pspicture}
\end{document}
The 4 stages of construction to recreate and retrace the shape is presented requires some explanation:
- The bizarre angles from which the shapes are drawn (say, from 60 to -300, spanning 360 degrees) is to fool TeX to draw a full revolution. Drawing an arc from 60 to 60 makes it non-existent.
- The choice for drawing these arcs based around the intersection is because the pen movement may cause some artifacts to show in the output (thin lines that have zero width, yet still show at certain zoom levels). Focusing on the intersection point as an interchange between shapes removes this annoying artifact.