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

Juergen Gilg gilg at acrotex.net
Wed Jun 10 19:48:39 CEST 2009

Dear Alexander,
> 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
I suppose it diesn't work the expected way, because with LINES there is
nothing to CLIP, although you blow up the line to a width of 5 pt. A
line is a line.

Here an approach to define a FAT line with the detour of a \psframe and
a linewidth of 0 pt. This works the way it should, however you have to
position the frames in a different way as you do with \psline...
Maybe you find a better approach. Herbert manages it with the opacity
and not with CLIPPING.

Try this:

\documentclass{article}
\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}

Regards,

Juergen

--
Jürgen Gilg
Austr. 59
70376 Stuttgart
-------------------------------------
Tel       0711.59 27 88
e-Mail    gilg at acrotex.net