<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Hello, </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> what's wrong with these codes (from pstricks manual (p223). It doesn't<br> work. Who can help me modify these codes. Thanks!<br>
<br><br>
<br>
\documentclass{article}<br>
\usepackage[dvipsnames,<wbr>x11names,svgnames]{pstricks}<br>
<br>
\makeatletter<br>
\define@key[psset]{}{SurfaceA}<wbr>{\def\PstColorSynthesis@<wbr>SurfaceA{#1}}<br>
\define@key[psset]{}{SurfaceB}<wbr>{\def\PstColorSynthesis@<wbr>SurfaceB{#1}}<br>
\define@key[psset]{}{SurfaceC}<wbr>{\def\PstColorSynthesis@<wbr>SurfaceC{#1}}<br>
\define@key[psset]{}{ColorA}{\<wbr>def\PstColorSynthesis@ColorA{#<wbr>1}}<br>
\define@key[psset]{}{ColorB}{\<wbr>def\PstColorSynthesis@ColorB{#<wbr>1}}<br>
\define@key[psset]{}{ColorC}{\<wbr>def\PstColorSynthesis@ColorC{#<wbr>1}}<br>
\def\PstColorSynthesis{\pst@<wbr>object{PstColorSynthesis}}%<br>
\def\PstColorSynthesis@i{{%<br>
                \psset{linestyle=none}%<br>
                \use@par% Assignment of local parameters<br>
                \bgroup<br>
                \psset{fillstyle=solid,<wbr>fillcolor=\PstColorSynthesis@<wbr>ColorA}%<br>
                \PstColorSynthesis@SurfaceA<br>
                \psset{fillcolor=\<wbr>PstColorSynthesis@ColorB}%<br>
                \PstColorSynthesis@SurfaceB<br>
                \psset{fillcolor=\<wbr>PstColorSynthesis@ColorC}%<br>
                \PstColorSynthesis@SurfaceC<br>
                \egroup<br>
                \PstColorSynthesis@<wbr>ClippedSurfaces{A}{B}{<wbr>NoSurface}%<br>
                \PstColorSynthesis@<wbr>ClippedSurfaces{A}{C}{<wbr>NoSurface}%<br>
                \PstColorSynthesis@<wbr>ClippedSurfaces{B}{C}{<wbr>NoSurface}%<br>
                \PstColorSynthesis@<wbr>ClippedSurfaces{A}{B}{C}}}<br>
<br>
\def\PstColorSynthesis@<wbr>ColorNoSurface{}<br>
% We draw the first surface #1 clipped by the one<br>
% or two others #2 and #3, computing it resulting color<br>
\def\PstColorSynthesis@<wbr>ClippedSurfaces#1#2#3{%<br>
        % We compute the ?mixed? color, component by component<br>
        \def\PstColorSynthesis@<wbr>MixedColorR{0}%<br>
        \def\PstColorSynthesis@<wbr>MixedColorG{0}%<br>
        \def\PstColorSynthesis@<wbr>MixedColorB{0}%<br>
        % \pst@dimd will contain the maximum value of the three<br>
        % components.<br>
        \pst@dimd=\z@<br>
        \PstColorSynthesis@MixedColor{<wbr>%<br>
                \csname PstColorSynthesis@Color#1\<wbr>endcsname}%<br>
        \PstColorSynthesis@MixedColor{<wbr>%<br>
                \csname PstColorSynthesis@Color#2\<wbr>endcsname}%<br>
        \PstColorSynthesis@MixedColor{<wbr>%<br>
                \csname PstColorSynthesis@Color#3\<wbr>endcsname}%<br>
        % We must test if the maximum of the new computed<br>
        % component is greater than 1, in which case we divide all<br>
        % the three components by this value for additive synthesis.<br>
        \ifdim\pst@dimd>\@ne\p@<br>
        \PstColorSynthesis@MixedColor@<wbr>iii{\PstColorSynthesis@<wbr>MixedColorR}%<br>
        \PstColorSynthesis@MixedColor@<wbr>iii{\PstColorSynthesis@<wbr>MixedColorG}%<br>
        \PstColorSynthesis@MixedColor@<wbr>iii{\PstColorSynthesis@<wbr>MixedColorB}%<br>
        \fi<br>
        % We draw the first surface, clipped by the other ones<br>
        \psclip{\csname PstColorSynthesis@Surface#2\<wbr>endcsname%<br>
                \csname PstColorSynthesis@Surface#3\<wbr>endcsname}<br>
        \definecolor{MixedColor}{rgb}{<wbr>\PstColorSynthesis@MixedColorR<wbr>,<br>
                \PstColorSynthesis@MixedColorG<wbr>,<br>
                \PstColorSynthesis@MixedColorB<wbr>}%<br>
        \psset{fillstyle=solid,<wbr>fillcolor=MixedColor}%<br>
        \csname PstColorSynthesis@Surface#1\<wbr>endcsname<br>
        \endpsclip}<br>
\def\PstColorSynthesis@<wbr>MixedColor#1{%<br>
        \edef\@tempa{#1}%<br>
        \ifx\@tempa\@empty<br>
        \else<br>
        \pst@expandafter\<wbr>PstColorSynthesis@MixedColor@<wbr>i{%<br>
                \csname\string\color@#1\<wbr>endcsname}\@nil<br>
        \fi}<br>
<br>
\def\PstColorSynthesis@<wbr>MixedColor@i#1 #2 #3 #4\@nil{%<br>
        % We receive the name of the color model (?rgb? is expected<br>
        % here and the three color components.)<br>
        % We add the values to the respective components of the new<br>
        % color to compute.<br>
        \PstColorSynthesis@MixedColor@<wbr>ii{%<br>
                \PstColorSynthesis@MixedColorR<wbr>}{#2}%<br>
        \PstColorSynthesis@MixedColor@<wbr>ii{%<br>
                \PstColorSynthesis@MixedColorG<wbr>}{#3}%<br>
        \PstColorSynthesis@MixedColor@<wbr>ii{%<br>
                \PstColorSynthesis@MixedColorB<wbr>}{#4}}<br>
<br>
\def\PstColorSynthesis@<wbr>MixedColor@ii#1#2{%<br>
        % As these values are real numbers, we use dimension<br>
        % registers, then we assign the computed value in a macro,<br>
        % converting it from a dimension to a number.<br>
        % We also keep in \pst@dimd the maximum of the values.<br>
        \pst@dimg=#1\p@<br>
        \advance\pst@dimg by #2\p@<br>
        \pst@dimtonum{\pst@dimg}{#1}%<br>
        \ifdim\pst@dimg>\pst@dimd<br>
        \pst@dimd=\pst@dimg<br>
        \fi}<br>
<br>
\def\PstColorSynthesis@<wbr>MixedColor@iii#1{%<br>
        \pst@divide{#1\p@}{\pst@dimd}{<wbr>#1}%<br>
        % We must take care of possible rounding problems with<br>
        % \pst@divide (for instance, 1.8/1.8 give 1.0001)<br>
        \ifdim#1\p@>\@ne\p@<br>
        \def#1{1}%<br>
        \fi}<br>
<br>
% We redefine Cyan, Magenta and Yellow in the ?rgb? model<br>
\definecolor{Cyan}{rgb}{0,1,1}<wbr>%<br>
\definecolor{Magenta}{rgb}{1,<wbr>0,1}%<br>
\definecolor{Yellow}{rgb}{1,1,<wbr>0}%<br>
\makeatother<br>
<br>
\begin{document}<br>
<br>
        \begin{pspicture}<br>
        \PstColorSynthesis[SurfaceA={\<wbr>pscircle{2}},<br>
        SurfaceB={\pscircle(2,0){2}},<wbr>SurfaceC={\pscircle(1,2){2}},<br>
        ColorA=Cyan,ColorB=Magenta,<wbr>ColorC=Yellow]<br>
        \PstColorSynthesis[SurfaceA={\<wbr>psccurve(-3,1)(0,2.5)(2,1.5)(<wbr>4,3)(4,-1)<br>
                (3,0)(1,-2.5)(-1,-1)(-3,-3)},<br>
        SurfaceB={\psellipticarc(0,-1)<wbr>(3,1.5){41}{-92}},<br>
        SurfaceC={\pstriangle(1,-2)(5,<wbr>5)},<br>
        ColorA=SlateBlue,ColorB=<wbr>Orange,ColorC=Pink]<br>
        \end{pspicture}<br>
\end{document}<br>
<br>
<br>
<br>
<br></blockquote></div></div></div>