summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/spotcolor/spotcolor.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-11-01 00:33:23 +0000
committerKarl Berry <karl@freefriends.org>2008-11-01 00:33:23 +0000
commitda2201da373d92a00f259d9723c62e4b7c156148 (patch)
tree245245b6add4b65f5a9ba6edfb31dc2e58df6244 /Master/texmf-dist/tex/latex/spotcolor/spotcolor.sty
parent91add38d05c06e6af30a692a296edef5eb03a539 (diff)
spotcolor*.tex should be in the runtime; report from Enrico Gregorio, 30 Oct 2008 22:14:32
git-svn-id: svn://tug.org/texlive/trunk@11143 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/spotcolor/spotcolor.sty')
-rw-r--r--Master/texmf-dist/tex/latex/spotcolor/spotcolor.sty82
1 files changed, 82 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/spotcolor/spotcolor.sty b/Master/texmf-dist/tex/latex/spotcolor/spotcolor.sty
new file mode 100644
index 00000000000..9783dca37fc
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/spotcolor/spotcolor.sty
@@ -0,0 +1,82 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{spotcolor}
+ [2006/11/15 v1.2 Package for adding Spot Color support to pdfLaTeX.]
+
+\newif\ifhks\hksfalse
+\newif\ifpantone\pantonefalse
+\DeclareOption{hks}{\hkstrue} % preload hks color values into "hks" colorspace
+\DeclareOption{pantone}{\pantonetrue} % preload pantone color values into "pantone" colorspace
+\ProcessOptions
+
+\RequirePackage[pdftex]{graphics}
+%\RequirePackage{color}
+
+%
+% Erzeugt neuen Colorspace
+%
+\newcommand\NewSpotColorSpace[1]{%
+ \expandafter\newtoks\csname #1\endcsname%
+ \csname #1\endcsname{}%
+}
+
+%
+% Colorspace variable, color name, CMYK representation
+% Adds a new spot color with the CMYK representation in the 2nd parameter (HEX with values from 00-FF)
+%
+\catcode`\#=12%
+\def\SpotSpace{#20}
+\catcode`\#=6%
+\gdef\csgrab#1#2{#2\expandafter{\the#2 #1}}%
+\newcount{\thecolorprofile}
+\newcount{\thecolor}
+\newcommand\AddSpotColor[4]{%
+ \def\obj{ 0 R}%
+ \pdfobj{<</C0[0 0 0 0]/FunctionType 2/C1[#4]/Domain[0 1]/N 1>>}%
+ \thecolorprofile=\the\pdflastobj%
+ \pdfobj{[/Separation/#3 /DeviceCMYK \the\thecolorprofile \obj]}% output color space Info
+ \thecolor=\the\pdflastobj%
+ \edef\tempcs{/#2 \the\pdflastobj \obj}%
+ \expandafter\csgrab\expandafter{\tempcs}{\csname #1\endcsname}%
+ \pdfrefobj\thecolorprofile%
+ \pdfrefobj\thecolor%
+}%
+
+%
+% Sets a color space for the current page
+%
+\def\SetPageColorResource#1{%
+ \edef\act{\noexpand\pdfpageresources={\the\pdfpageresources\space
+ /ColorSpace<<#1>>}}
+ \act}
+\newcommand\SetPageColorSpace[1]{%
+ \expandafter\SetPageColorResource\expandafter{\the\csname #1\endcsname}%
+}%
+
+%
+% Sets the spot color
+%
+\def\SpotColor#1#2{%
+ \pdfliteral{/#1 cs}%
+ \pdfliteral{/#1 CS}%
+ \pdfliteral{#2 sc}%
+ \pdfliteral{#2 SC}%
+}%
+
+%
+% Defines a new color space called spotcolor
+% The spotcolor has to be set first by using AddSpotColor
+% The code is taken and modified from color.sty's pdftex.def
+%
+\makeatletter
+\def\color@spotcolor#1#2{\c@lor@@spotcolor#2\@@#1}
+\def\c@lor@@spotcolor#1,#2\@@#3{%
+ \c@lor@arg{#2}%
+ \edef#3{/#1 cs /#1 CS #2 sc #2 SC}%
+}
+\makeatother
+
+%
+% If pantone or hks option specified then load corresponding color tables
+%
+\ifhks\input{spotcolorhks}\fi
+\ifpantone\input{spotcolorpantone}\fi