[pstricks] Real transparency hack
MLuque5130 at aol.com
MLuque5130 at aol.com
Thu Jul 14 21:31:29 CEST 2005
The problem of the transparency seems to arouse some interest and if
according to the message of Jan Steffan, the problem seems to be solved in the new
versions of GhostScript, it is a good news.
However, if you want to arrange it by yourself, it is possible.
This problem can be dealt with by the use of coding CMYK. When two surfaces
of different colors are superimposed, the resulting color has as components the
addition of the respective colors as in the example below.
It is the result of the superposition, on an overhead projector, of three
transparencies.
Each transparency contains only diagram.
Is it possible to build something of more general? I subject this problem to
you...
%%%%%%%%%%%%%%%%%%%%%%%%%
% 14 juillet 2005
\documentclass{article}
\usepackage{pstricks}
\SpecialCoor
\newcommand{\CyanA}{0.5}
\newcommand{\MagentaA}{0}
\newcommand{\YellowA}{0.1}
\newcommand{\CyanB}{0.05}
\newcommand{\MagentaB}{0.4}
\newcommand{\YellowB}{0.1}
\newcommand{\CyanC}{0.2}
\newcommand{\MagentaC}{0.1}
\newcommand{\YellowC}{0.5}
\newcommand{\VeenA}{%
\psccurve(4;30)(4.2;90)(4.1;150)(4.2;210)(3.9;270)(4.2;330)}
\newcommand{\VeenB}{%
\psccurve(4.5;30)(4.3;90)(4.1;150)(4;210)(4.2;270)(4;330)}
\newcommand{\VeenC}{%
\psccurve(4;30)(4.1;90)(4.2;150)(4.3;210)(4.2;270)(4.1;330)}
% Denis Girou
\makeatletter
\newcommand{\NewColorCMYK}[2]{\@newcolor{#1}{#2 setcmykcolor}}
\makeatother
%
\newcommand{\VeenDiagramTransparency}{%
\NewColorCMYK{A}{\CyanA\space \MagentaA\space \YellowA\space 0}
\NewColorCMYK{B}{\CyanB\space \MagentaB\space \YellowB\space 0}
\NewColorCMYK{C}{\CyanC\space \MagentaC\space \YellowC\space 0}
\NewColorCMYK{AB}{\CyanA\space \CyanB\space add
\MagentaA\space \MagentaB\space add
\YellowA\space \YellowB\space add 0}
\NewColorCMYK{BC}{\CyanB\space \CyanC\space add
\MagentaB\space \MagentaC\space add
\YellowB\space \YellowC\space add 0}
\NewColorCMYK{AC}{\CyanA\space \CyanC\space add
\MagentaA\space \MagentaC\space add
\YellowA\space \YellowC\space add 0}
\NewColorCMYK{ABC}{\CyanA\space \CyanB\space add \CyanC\space add
\MagentaA\space \MagentaB\space add \MagentaC\space add
\YellowA\space \YellowB\space add \YellowC\space add 0}
\rput(1,-1){\psset{fillstyle=solid,fillcolor=B}\VeenB}
\rput(-2,0){\psset{fillstyle=solid,fillcolor=A}\VeenA}
\rput(2,2){\psset{fillstyle=solid,fillcolor=C}\VeenC}
% A inter B
\psclip{\rput(-2,0){\VeenA}}
\rput(1,-1){\psset{fillstyle=solid,fillcolor=AB}\VeenB}
\endpsclip%
% B inter C
\psclip{\rput(1,-1){\VeenB}}
\rput(2,2){\psset{fillstyle=solid,fillcolor=BC}\VeenC}
\endpsclip%
% A inter C
\psclip{%
\rput(-2,0){\VeenA}}
\rput(2,2){\psset{fillstyle=solid,fillcolor=AC}\VeenC}
\endpsclip%
% A inter B inter C
\psclip{\rput(-2,0){\VeenA}}
\psclip{\rput(1,-1){\VeenB}}
\rput(2,2){\psset{fillstyle=solid,fillcolor=ABC}\VeenC}
\endpsclip%
\endpsclip%
\rput(1,-1){\VeenB}
\rput(-2,0){\VeenA}
\rput(2,2){\VeenC}}
\begin{document}
\begin{center}
\begin{pspicture}(-4,-5)(4,4)
\VeenDiagramTransparency
\end{pspicture}
\renewcommand{\CyanA}{0.3}
\renewcommand{\MagentaA}{0.2}
\renewcommand{\YellowA}{0.1}
\renewcommand{\CyanB}{0.1}
\renewcommand{\MagentaB}{0.3}
\renewcommand{\YellowB}{0.3}
\renewcommand{\CyanC}{0.1}
\renewcommand{\MagentaC}{0}
\renewcommand{\YellowC}{0.6}
\renewcommand{\VeenA}{%
\psccurve(4;30)(4.2;90)(4.3;150)(3.9;210)(4.1;270)(3.7;330)}
\renewcommand{\VeenB}{%
\psccurve(4.2;30)(3.9;90)(4;150)(4.1;210)(4.2;270)(4;330)}
\renewcommand{\VeenC}{%
\psccurve(4.1;30)(3.8;90)(4.2;150)(3.9;210)(3.7;270)(4.1;330)}
\begin{pspicture}(-4,-4)(4,6)
\VeenDiagramTransparency
\end{pspicture}
\end{center}
\end{document}
Manuel Luque
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/pstricks/attachments/20050714/2a40b26a/attachment.html
More information about the PSTricks
mailing list