%% $Id: pst-cie-doc.tex 531 2017-08-24 07:59:27Z herbert $
\errorcontextlines=100
\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{}
\documentclass[11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,headings=small,
    headinclude=false,footinclude=false,twoside,english]{pst-doc}
\listfiles

\usepackage{pst-cie}
\let\pstFV\fileversion
\def\bgImage{\resizebox{7cm}{!}{\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[Planck,bgcolor=yellow!100!black!20,textcolor=black!70,ColorSpace=Pal-Secam]
\rput(5.5,8){\textbf{Pal-Secam}}
\end{pspicture}}}
\lstset{explpreset={pos=l,width=-99pt,overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,rframe={}}}
\usepackage{biblatex}
\addbibresource{\jobname.bib}

\def\tabCIE{%
\begin{tabular}{|c|c|c|c|c|}
\cline{2-5} \multicolumn{1}{c|}{} & Red      & Green   & Blue  & White \\\hline
x&0.7355&0.2658&0.1669&0.3333\\\hline
y&0.2645&0.7243&0.0085&0.3333\\\hline
\end{tabular}%
}
\def\tabsRGB{%
\begin{tabular}{|c|c|c|c|c|}\cline{2-5} 
\multicolumn{1}{c|}{} & Red      & Green   & Blue  & White \\\hline
x&0.6400&0.3000&0.1500&0.3127\\\hline
y&0.3300&0.6000&0.0600&0.3290\\\hline
\end{tabular}%
}
\def\tabSMPTE{%
\begin{tabular}{|c|c|c|c|c|}\cline{2-5} 
\multicolumn{1}{c|}{} & Red      & Green   & Blue  & White \\\hline
x&0.6300&0.3100&0.1500&0.3127\\\hline
y&0.3400&0.5950&0.0700&0.3290\\\hline
\end{tabular}%
}
\def\tabAdobe{%
\begin{tabular}{|c|c|c|c|c|}\cline{2-5} 
\multicolumn{1}{c|}{} & Red      & Green   & Blue  & White \\\hline
x&0.6400&0.2100&0.1500&0.3127\\\hline
y&0.3300&0.7150&0.0600&0.3290\\\hline
\end{tabular}%
}
\def\tabColorMatch{%
\begin{tabular}{|c|c|c|c|c|}\cline{2-5} 
\multicolumn{1}{c|}{} & Red      & Green   & Blue  & White \\\hline
x&0.6300&0.2950&0.1500&0.3457\\\hline
y&0.3400&0.6050&0.0750&0.3585\\\hline
\end{tabular}%
}
\def\tabProPhoto{%
\begin{tabular}{|c|c|c|c|c|}\cline{2-5} 
\multicolumn{1}{c|}{} & Red      & Green   & Blue  & White \\\hline
x&0.7347&0.1596&0.0366&0.3457\\\hline
y&0.2653&0.8404&0.0001&0.3585\\\hline
\end{tabular}%
}
\def\tabPal-Secam{%
\begin{tabular}{|c|c|c|c|c|}\cline{2-5} 
\multicolumn{1}{c|}{} & Red      & Green   & Blue  & White \\\hline
x&0.6400&0.2900&0.1500&0.3127\\\hline
y&0.3300&0.6000&0.0600&0.3290\\\hline
\end{tabular}%
}
\def\tabNTSC{%
\begin{tabular}{|c|c|c|c|c|}\cline{2-5} 
\multicolumn{1}{c|}{} & Red      & Green   & Blue  & White \\\hline
x&0.6700&0.2100&0.1400&0.3101\\\hline
y&0.3300&0.7100&0.0800&0.3162\\\hline
\end{tabular}%
}

\begin{document}
\title{\texttt{pst-cie}: CIE xy chromaticity space\\
\small v.\pstFV}
%\docauthor{}
\author{Manuel Luque\\Herbert Voß}
\settitle


\section{Introduction}


Using data (CIE XYZ CIE XYZ 1931 and 1964)
from the International Commission on Illumination (Commission internationale de l’éclairage)
the package \LPack{pst-cie}  proposes to represent the color table and / or the chromaticity diagram for 
different color spaces. Web page devoted to studies and performances diagrams and chromaticity 
tables are numerous and it is difficult to distinguish one over another, 
however here are some important informations:  
\href{http://www.f-legrand.fr/scidoc/docmml/index.html}{Frédéric Legrand} 
devoted to colorimetry, and those of Daniel Metz. Yu-Chang Sung realized with the software 
\textsf{Mathematica} an interactive version of beauty: 
\href{http://demonstrations.wolfram.com/CIEChromaticityDiagram/}{CIEChromaticityDiagram}
as I do not own this software I tried to do pretty much the same with PSTricks, or at least 
having almost the same functionality.

The macro \Lcs{psChromaticityDiagram}\OptArgs supports the following optional arguments:

\bigskip
% \small\let\tbs\textbackslash
\newcommand*\titretab[1]{\multicolumn{1}{c}{\emph{#1}}}
\noindent
\begin{tabularx}{\linewidth}{@{}l>{\ttfamily}llX@{}}
  \toprule
  \titretab{Option} & \titretab{Type} & \titretab{Default}
& \titretab{Description}
\\\toprule
\Lkeyword{gamma}      & number   &2.2 & color correction\\
\Lkeyword{contrast} &number   &1  & 0<contrast<=1 \\
\Lkeyword{ColorSpace}        &name  & sRGB & colorspace \\
\Lkeyword{datas}        &name  &CIE1931 & CIE\\
\Lkeyword{primaries} &boolean & true & show primary points\\
\Lkeyword{trianglecolor}   & color & black & color of the triangle \\
\Lkeyword{bgcolor}   & color & black & background color \\
\Lkeyword{textcolor} & color & white & textcolor \\
\Lkeyword{Planck} & boolean & false & draw the Planck' locus \\ 
\Lkeyword{showcontour} & boolean & false & \sloppy show the contour of the color space, only useful for using \Lcs{pstPlanck}.\\
\Lkeyword{Tfontsize} & length & 4pt & fontsize for the temperature of the Planck curve\\
\Lkeyword{unit}      & number & 1 & unit depending to the default size of 10cm$\times$10cm\\
\Lkeyword{PSfont}    & PS font & Helvetica-Bold & \\
\Lkeyword{fontscale} & 5 & PS font scale in pt\\
\bottomrule
\end{tabularx}

\bigskip
The color spaces which are available are: \Lkeyval{Adobe}, 
\Lkeyval{CIE}, 
\Lkeyval{ColorMatch}, 
\Lkeyval{NTSC}, 
\Lkeyval{Pal-Secam}, 
\Lkeyval{ProPhoto}, 
\Lkeyval{SMPTE}, and 
\Lkeyval{sRGB}.

Tabulated values available are those of the CIE XYZ 1931 and the CIE XYZ 1964.
A low value of the contrast will highlight the work area of 
the system displayed the colors it can represent, it is the triangle 
with vertices the points of primary colors included in the 
\emph{Iron horse} which represents all the colors visible to the human eye.


\section{Examples}
\begin{center}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram
\rput(5.5,8){\white \textbf{Colorspace sRGB}}
\rput(4,10){\tabsRGB}
\end{pspicture}

\begin{verbatim}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram
\rput(5.5,8){\white \textbf{Colorspace sRGB}}
\rput(4,10){\tabsRGB}
\end{pspicture}
\end{verbatim}
\end{center}




\begin{center}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[Planck,trianglecolor=black]
\rput(5.5,8){\white \textbf{Colorspace sRGB}}
\rput(4,10){\tabsRGB}
\end{pspicture}

\begin{verbatim}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[Planck,trianglecolor=black]
\rput(5.5,8){\white \textbf{Colorspace sRGB}}
\rput(4,10){\tabsRGB}
\end{pspicture}
\end{verbatim}
\end{center}

\begin{center}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[datas=CIE1964,ColorSpace=Adobe,contrast=0.1]
\rput(5.5,8){\white \textbf{Colorspace Adobe}}
\rput(4,10){\tabAdobe}
\end{pspicture}

\begin{verbatim}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[datas=CIE1964,ColorSpace=Adobe,contrast=0.1]
\rput(5.5,8){\white \textbf{Colorspace Adobe}}
\rput(4,10){\tabAdobe}
\end{pspicture}
\end{verbatim}


\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[Planck,bgcolor=black!40,datas=CIE1964,
                       ColorSpace=Adobe,contrast=0.1]
\rput(5.5,8){\white \textbf{Colorspace Adobe}}
\rput(4,10){\tabAdobe}
\end{pspicture}

\begin{verbatim}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[Planck,bgcolor=black!40,datas=CIE1964,
                       ColorSpace=Adobe,contrast=0.1]
\rput(5.5,8){\white \textbf{Colorspace Adobe}}
\rput(4,10){\tabAdobe}
\end{pspicture}
\end{verbatim}


\end{center}

\begin{center}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[ColorSpace=ProPhoto,contrast=0.1]
\rput(5.5,8){\white \textbf{Colorspace ProPhoto}}
\rput(4,10){\tabProPhoto}
\end{pspicture}

\begin{verbatim}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[ColorSpace=ProPhoto,contrast=0.1]
\rput(5.5,8){\white \textbf{Colorspace ProPhoto}}
\rput(4,10){\tabProPhoto}
\end{pspicture}
\end{verbatim}
\end{center}

\begin{center}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[ColorSpace=ColorMatch,contrast=0.1]
\rput(5.5,8){\white \textbf{Colorspace ColorMatch}}
\rput(4,10){\tabColorMatch}
\end{pspicture}

\begin{verbatim}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[ColorSpace=ColorMatch,contrast=0.1]
\rput(5.5,8){\white \textbf{Colorspace ColorMatch}}
\rput(4,10){\tabColorMatch}
\end{pspicture}
\end{verbatim}
\end{center}

\begin{center}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[ColorSpace=NTSC,contrast=0.1]
\rput(5.5,8){\white \textbf{Colorspace NTSC}}
\rput(4,10){\tabNTSC}
\end{pspicture}

\begin{verbatim}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[ColorSpace=NTSC,contrast=0.1]
\rput(5.5,8){\white \textbf{Colorspace NTSC}}
\rput(4,10){\tabNTSC}
\end{pspicture}
\end{verbatim}
\end{center}

\begin{center}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[ColorSpace=CIE]
\rput(5.5,8){\white \textbf{Colorspace CIE}}
\rput(4,10){\tabCIE}
\end{pspicture}

\begin{verbatim}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[ColorSpace=CIE]
\rput(5.5,8){\white \textbf{Colorspace CIE}}
\rput(4,10){\tabCIE}
\end{pspicture}
\end{verbatim}
\end{center}

\begin{center}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[ColorSpace=Pal-Secam]
\rput(5.5,8){\white \textbf{Colorspace Pal-Secam}}
\rput(4,10){\tabPal-Secam}
\end{pspicture}

\begin{verbatim}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[ColorSpace=Pal-Secam]
\rput(5.5,8){\white \textbf{Colorspace Pal-Secam}}
\rput(4,10){\tabPal-Secam}
\end{pspicture
\end{verbatim}


\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[bgcolor=yellow!100!black!20,textcolor=black!70,ColorSpace=Pal-Secam]
\rput(5.5,8){\white\textbf{Colorspace Pal-Secam}}
\end{pspicture}


\begin{verbatim}
\begin{pspicture}(-1,-1)(8.5,11)
\psChromaticityDiagram[bgcolor=yellow!100!black!20,
               textcolor=black!70,ColorSpace=Pal-Secam]
\rput(5.5,8){\white\textbf{Colorspace Pal-Secam}}
\end{pspicture}
\end{verbatim}

\begin{pspicture}(-1,-1)(10,10)
\psaxes[Dx=0.1,dx=1,Dy=0.1,dy=1]{->}(0,0)(10,10)[$x$,-90][$y$,0]
\pstPlanck[showcontour]
\end{pspicture}

\begin{verbatim}
\begin{pspicture}(-1,-1)(10,10)
\psaxes[Dx=0.1,dx=1,Dy=0.1,dy=1]{->}(0,0)(10,10)[$x$,-90][$y$,0]
\pstPlanck[showcontour]
\end{pspicture}
\end{verbatim}


\clearpage

\makeatletter
\begin{pspicture}(-1,-1)(10,10)
\psaxes[Dx=0.1,dx=1,Dy=0.1,dy=1]{->}(0,0)(10,10)[$x$,-90][$y$,0]
\pstCIEcontour[linecolor=blue]%
\pstCIEcontour[datas=CIE1964,linestyle=dashed]%
\end{pspicture}
\makeatother

\begin{verbatim}
\makeatletter
\begin{pspicture}(-1,-1)(10,10)
\psaxes[Dx=0.1,dx=1,Dy=0.1,dy=1]{->}(0,0)(10,10)[$x$,-90][$y$,0]
\pstCIEcontour[linecolor=blue]%
\pstCIEcontour[datas=CIE1964,linestyle=dashed]%
\end{pspicture}
\makeatother
\end{verbatim}

\begin{pspicture}(-1,-1)(15,15)
\psChromaticityDiagram[unit=1.5,contrast=0.5]%
\pstPlanck[unit=1.5]
\end{pspicture}

\begin{verbatim}
\begin{pspicture}(-1,-1)(15,15)
\psChromaticityDiagram[unit=1.5,contrast=0.5]%
\pstPlanck[unit=1.5]
\end{pspicture}
\end{verbatim}


\begin{pspicture}(-1,-1)(15,15)
\psaxes[Dx=0.2,dx=3,Dy=0.2,dy=3,
  labelFontSize=\scriptscriptstyle]{->}(0,0)(15,15)[$x$,-90][$y$,0]
\pstCIEcontour[unit=1.5,linecolor=blue]%
\end{pspicture}

\begin{verbatim}
\begin{pspicture}(-1,-1)(15,15)
\psaxes[Dx=0.2,dx=3,Dy=0.2,dy=3,
  labelFontSize=\scriptscriptstyle]{->}(0,0)(15,15)[$x$,-90][$y$,0]
\pstCIEcontour[unit=1.5,linecolor=blue]%
\end{pspicture}
\end{verbatim}

\end{center}



\clearpage
\section{List of all optional arguments for \texttt{pst-cie}}
\xkvview{family=pst-cie,columns={key,type,default}}

\bgroup
\RaggedRight
\nocite{*}
\printbibliography
\egroup

\printindex


\end{document} 