# [pstricks] mixing colours of overlapping objects while disregarding paper background colour

Herbert Voss Herbert.Voss at FU-Berlin.DE
Wed Jun 10 16:56:36 CEST 2009

Alexander Grahn schrieb:

> Now I'd like to do the same with lines. For this purpose I modified your
> example (see below). However, it does not work as expected. Any Idea?

\documentclass{article}
\usepackage{pstricks}

\def\ColoredOverlappedSurfaces#1#2#3#4{%
\psset{fillstyle=solid,fillcolor=white}#1#3%
\psset{linecolor=#2,fillcolor=#2,opacity=1,strokeopacity=1}#1
\psset{linecolor=#4,fillcolor=#4,opacity=0.5,strokeopacity=0.5}#3}
\pagestyle{empty}

\begin{document}

\psset{unit=2}
\psframebox[fillcolor=black,fillstyle=solid]{%
\begin{pspicture}(-2,-2)(2,2)

\ColoredOverlappedSurfaces{\pscircle{1}}{red}{\psellipse(0.3,-0.7)(1.5,1)}{blue}
\end{pspicture}}

\begin{pspicture}(-2,-2)(2,2)

\ColoredOverlappedSurfaces{\pscircle{1}}{red}{\psellipse(0.3,-0.7)(1.5,1)}{blue}
\end{pspicture}

\psset{linewidth=5pt}
\psframebox*[fillcolor=black,fillstyle=solid]{%
\begin{pspicture}(-2,-2)(2,2)

\ColoredOverlappedSurfaces{\psline(-2,-2)(2,2)}{red}{\psline(-2,2)(2,-2)}{blue}
\end{pspicture}}

\begin{pspicture}(-2,-2)(2,2)

\ColoredOverlappedSurfaces{\psline(-2,-2)(2,2)}{red}{\psline(-2,2)(2,-2)}{blue}
\end{pspicture}

\end{document}

Herbert