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

Alexander Grahn A.Grahn at fzd.de
Thu Jun 11 16:52:38 CEST 2009

Thanks, Juergen and Herbert,

On Wed, Jun 10, 2009 at 07:48:39PM +0200, Juergen Gilg wrote:
> Try this:
> \documentclass{article}
> \usepackage{pstricks,pstricks-add}
> \makeatletter
> \def\ColoredOverlappedLines#1#2#3#4{%
> \psset{fillstyle=solid}%
> \psset{fillcolor=#2,linecolor=#2}#1
> \psclip{\psset{fillcolor=#4,linecolor=#4}#3}%
> \psset{fillcolor=#2!50!#4,linecolor=#2!50!#4}#1%
> \endpsclip%
> }
> \makeatother
> \pagestyle{empty}
> \begin{document}
> \psset{unit=2}
> \psset{linewidth=0pt}
> \psframebox*[fillcolor=black,fillstyle=solid]{%
> \begin{pspicture}(-2,-2)(2,2)
> \psrotate(0,0){45}{%
> \ColoredOverlappedLines{\psframe(-2,-0.2)(2,0.2)}{red}{\psframe(-0.2,2)(0.2,-2)}{blue}
> }
> \end{pspicture}}
> \end{document}

for your suggestions. Juergens approach gets closest to the desired
result. However it seems to be impracticable, because I cannot rewrite
PSTricks macros, especially those designed for data plotting, to use
filled polygons instead of lines. There is still one more deficiency of
Juergens approach, as the colour of the overlapping region is not rgb=1 0
1, but 0.5 0 0.5.

My intention is to produce a red-blue stereoscopic plot of a parametric
curve (depending one parameter only) in the x-y-z space, to be viewed
with a pair of red and blue glasses. As there are quite a few locations
where the blue and red graphs -- seen from slightly different viewpoints
-- overlap each other it would be nice if these locations were coloured
with rgb=1 0 1. Otherwise they appear darker through the glasses than
the non-overlapping sections of the graph. I am afraid it is impossible
to be done in Postscript.

Anyway, thank you once more and kind regards,

More information about the PSTricks mailing list