Retour

transparence_cmyk.tex

Télécharger le fichier
\documentclass{article}
 
\usepackage[latin1]{inputenc}
\usepackage{arrayjob}
\usepackage[width=18cm]{geometry}
\usepackage{multido}
\usepackage{pstcol}
\usepackage[nomessages]{fp}
 
\input{random}
 
\setlength{\parindent}{0pt}
 
\SpecialCoor
 
% les couleurs du filtre
\def\Cyan{0.8}
\def\Magenta{0.1}
\def\Yellow{0.1}
\definecolor{colorFiltre}{cmyk}{\Cyan,\Magenta,\Yellow,0}
 
% les couleurs aléatoires des cases
\newdimen{\ValeurCouleurCyan}
\newdimen{\ValeurCouleurMagenta}
\newdimen{\ValeurCouleurYellow}
 
% leur stockage
\newarray\colorCyan
\newarray\colorMagenta
\newarray\colorYellow
\dataheight=5
\expandarrayelementtrue
 
\psset{dimen=middle}
 
\makeatletter
 
\def\DessinFond{%
\multido{\iLigne=1+1}{5}{%
  \multido{\iColonne=1+1}{5}{%
    \setrandim{\ValeurCouleurCyan}{0pt}{4pt}%
    \divide\ValeurCouleurCyan by 10
    \global\colorCyan(\iLigne,\iColonne)={\pointless\ValeurCouleurCyan}
    \setrandim{\ValeurCouleurMagenta}{0pt}{4pt}%
    \divide\ValeurCouleurMagenta by 10
    \global\colorMagenta(\iLigne,\iColonne)={\pointless\ValeurCouleurMagenta}
    \setrandim{\ValeurCouleurYellow}{0pt}{4pt}%
    \divide\ValeurCouleurYellow by 10
    \global\colorYellow(\iLigne,\iColonne)={\pointless\ValeurCouleurYellow}
    \definecolor{MyColor}{cmyk}%
       {\pointless\ValeurCouleurCyan,\pointless\ValeurCouleurMagenta,
        \pointless\ValeurCouleurYellow,0}%
    \psframe[fillstyle=solid,fillcolor=MyColor,linestyle=none]
            (!\iLigne\space 1 sub \iColonne\space 1 sub)(\iLigne,\iColonne)}}}
 
\def\DessinTransparent{%
\multido{\iLigne=1+1}{5}{%
  \multido{\iColonne=1+1}{5}{%
    \checkcolorCyan(\iLigne,\iColonne)%
    \pst@dimc=\cachedata pt
    \advance\pst@dimc by \Cyan pt
    \ifdim\pst@dimc >1pt \pst@dimc=1pt \fi
    \checkcolorMagenta(\iLigne,\iColonne)%
    \pst@dimd=\cachedata pt
    \advance\pst@dimd by \Magenta pt
    \ifdim\pst@dimd >1pt \pst@dimd=1pt \fi
    \checkcolorYellow(\iLigne,\iColonne)%
    \pst@dimg=\cachedata pt
    \advance\pst@dimg by \Yellow pt
    \ifdim\pst@dimg >1pt \pst@dimg=1pt \fi
    \definecolor{MyColor}{cmyk}{\pointless\pst@dimc,\pointless\pst@dimd,\pointless\pst@dimg,0}%
    \psframe[fillstyle=solid,fillcolor=MyColor,linestyle=none]
            (!\iLigne\space 1 sub \iColonne\space 1 sub)(\iLigne,\iColonne)}}}
 
\makeatother
 
\begin{document}
\begin{pspicture}(5,5)
  \randomi=574214204
  \DessinFond
  \psclip{\psframe[linestyle=none](0.5,0.5)(4.5,4.5)}
    \DessinTransparent
  \endpsclip
\end{pspicture}
\hfill
\begin{pspicture}(5,5)
  \randomi=574214204
  \DessinFond
\end{pspicture}
\hfill
\begin{pspicture}(5,5)
  \psframe*[linecolor=colorFiltre](0.5,0.5)(4.5,4.5)
\end{pspicture}
 
% les couleurs du filtre
\def\Cyan{0}
\def\Magenta{0}
\def\Yellow{0.8}
\definecolor{colorFiltre}{cmyk}{\Cyan,\Magenta,\Yellow,0}
 
\vspace{1cm}
\begin{pspicture}(5,5)
  \randomi=574214204
  \DessinFond
  \psclip{\psframe[linestyle=none](0.5,0.5)(4.5,4.5)}
    \DessinTransparent
  \endpsclip
\end{pspicture}
\hfill
\begin{pspicture}(5,5)
  \randomi=574214204
  \DessinFond
\end{pspicture}
\hfill
\begin{pspicture}(5,5)
  \psframe*[linecolor=colorFiltre](0.5,0.5)(4.5,4.5)
\end{pspicture}
 
% les couleurs du filtre
\def\Cyan{0.1}
\def\Magenta{0.8}
\def\Yellow{0}
\definecolor{colorFiltre}{cmyk}{\Cyan,\Magenta,\Yellow,0}
 
\vspace{1cm}
\begin{pspicture}(5,5)
  \randomi=574214204
  \DessinFond
  \psclip{\psframe[linestyle=none](0.5,0.5)(4.5,4.5)}
    \DessinTransparent
  \endpsclip
\end{pspicture}
\hfill
\begin{pspicture}(5,5)
  \randomi=574214204
  \DessinFond
\end{pspicture}
\hfill
\begin{pspicture}(5,5)
  \psframe*[linecolor=colorFiltre](0.5,0.5)(4.5,4.5)
\end{pspicture}
 
% les couleurs du filtre
\def\Cyan{0.8}
\def\Magenta{0.8}
\def\Yellow{0}
\definecolor{colorFiltre}{cmyk}{\Cyan,\Magenta,\Yellow,0}
 
\vspace{1cm}
\begin{pspicture}(5,5)
  \randomi=2568792
  \DessinFond
  \psclip{\psframe[linestyle=none](0.5,0.5)(4.5,4.5)}
    \DessinTransparent
  \endpsclip
\end{pspicture}
\hfill
\begin{pspicture}(5,5)
  \randomi=2568792
  \DessinFond
\end{pspicture}
\hfill
\begin{pspicture}(5,5)
  \psframe*[linecolor=colorFiltre](0.5,0.5)(4.5,4.5)
\end{pspicture}
 
% les couleurs du filtre
\def\Cyan{0}
\def\Magenta{0.5}
\def\Yellow{0.4}
\definecolor{colorFiltre}{cmyk}{\Cyan,\Magenta,\Yellow,0}
 
\vspace{1cm}
\begin{pspicture}(5,5)
  \randomi=2568792
  \DessinFond
  \psclip{\psframe[linestyle=none](0.5,0.5)(4.5,4.5)}
    \DessinTransparent
  \endpsclip
\end{pspicture}
\hfill
\begin{pspicture}(5,5)
  \randomi=2568792
  \DessinFond
\end{pspicture}
\hfill
\begin{pspicture}(5,5)
  \psframe*[linecolor=colorFiltre](0.5,0.5)(4.5,4.5)
\end{pspicture}
 
% les couleurs du filtre
\def\Cyan{1}
\def\Magenta{0}
\def\Yellow{1}
\definecolor{colorFiltre}{cmyk}{\Cyan,\Magenta,\Yellow,0}
 
\vspace{1cm}
\begin{pspicture}(5,5)
  \randomi=2568792
  \DessinFond
  \psclip{\psframe[linestyle=none](0.5,0.5)(4.5,4.5)}
    \DessinTransparent
  \endpsclip
\end{pspicture}
\hfill
\begin{pspicture}(5,5)
  \randomi=2568792
  \DessinFond
\end{pspicture}
\hfill
\begin{pspicture}(5,5)
  \psframe*[linecolor=colorFiltre](0.5,0.5)(4.5,4.5)
\end{pspicture}
 
\end{document}