<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Myriad Pro">Dear Alexander,<br>
<br>
try this:<br>
<br>
\makeatletter<br>
% Draw two overlapped surfaces, with computation of the mixed color for<br>
% the intersection of the surfaces<br>
% #1=first surface, #2=color of first surface,<br>
% #3=second surface, #4=color of second surface<br>
\def\ColoredOverlappedSurfaces#1#2#3#4{%<br>
\psset{fillstyle=solid}%<br>
% Decode the three components of the first RGB color<br>
\psset{fillcolor=#2}% % Draw first surface<br>
#1<br>
% Decode the three components of the second RGB color<br>
% Draw second surface<br>
\psclip{\psset{fillcolor=#4}#3}%<br>
\psset{fillcolor=#2!50!#4}%<br>
% Redraw overlapped surface in the mixed color<br>
#1%<br>
\endpsclip%<br>
}<br>
\makeatother<br>
<br>
<br>
Regards,<br>
<br>
Juergen<br>
</font><br>
Alexander Grahn wrote:
<blockquote cite="mid:20090610125357.GA20796@fzd.de" type="cite">
<pre wrap="">Hi,
I wish it were possible to mix the colour of overlapping objects but,
at the same time, to prevent the background colour from being mixed in.
Consider the example below where I have a red (rgb=1 0 0) circle and a
blue (rgb=0 0 1) ellipse, overlapping each other. It would be extremely
nice to have the overlapping region to be filled with colour rgb=1 0 1
and the non-overlapping regions to be filled with fully saturated red
and blue colours.
Unfortunately, neither black nor white backgrounds give the desired
result.
Is there a way to achieve this in the final ps2pdf generated PDF?
Thanks for your suggestions!
Regards,
Alexander
\documentclass{article}
\usepackage{pstricks}
\def\ColoredOverlappedSurfaces#1#2#3#4{%
\psset{fillstyle=solid,opacity=0.5}%
\psset{fillcolor=#2}#1
\psset{fillcolor=#4}#3}
\pagestyle{empty}
\begin{document}
\psset{unit=2}
\psframebox*[fillcolor=black,fillstyle=solid]{%
\begin{pspicture}(-2,-2)(2,2)
\rput(0,0){%
\ColoredOverlappedSurfaces{\pscircle{1}}{red}{\psellipse(0.3,-0.7)(1.5,1)}{blue}}
\end{pspicture}}
\begin{pspicture}(-2,-2)(2,2)
\rput(0,0){%
\ColoredOverlappedSurfaces{\pscircle{1}}{red}{\psellipse(0.3,-0.7)(1.5,1)}{blue}}
\end{pspicture}
\end{document}
_______________________________________________
PSTricks mailing list
<a class="moz-txt-link-abbreviated" href="mailto:PSTricks@tug.org">PSTricks@tug.org</a>
<a class="moz-txt-link-freetext" href="http://tug.org/mailman/listinfo/pstricks">http://tug.org/mailman/listinfo/pstricks</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="65">--
Jürgen Gilg
Austr. 59
70376 Stuttgart
-------------------------------------
Tel 0711.59 27 88
e-Mail <a class="moz-txt-link-abbreviated" href="mailto:gilg@acrotex.net">gilg@acrotex.net</a>
</pre>
</body>
</html>