summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/colo-ext.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/colo-ext.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/colo-ext.mkiv104
1 files changed, 49 insertions, 55 deletions
diff --git a/Master/texmf-dist/tex/context/base/colo-ext.mkiv b/Master/texmf-dist/tex/context/base/colo-ext.mkiv
index 771974d4d4f..af6c3830ecc 100644
--- a/Master/texmf-dist/tex/context/base/colo-ext.mkiv
+++ b/Master/texmf-dist/tex/context/base/colo-ext.mkiv
@@ -5,7 +5,7 @@
%D subtitle=Extras,
%D author=Hans Hagen,
%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
@@ -29,86 +29,80 @@
%D
%D will negate the colors in box zero.
-\def\negatecolorbox#1%
+% \unexpanded\def\negatecolorbox#1%
+% {\setbox#1\hbox
+% {\startnegative % might change
+% \startcolor[\s!white]\vrule\!!height\ht#1\!!depth\dp#1\!!width\wd#1\stopcolor
+% \hskip-\wd#1%
+% \box#1%
+% \stopnegative}}
+
+\unexpanded\def\negatecolorbox#1%
{\setbox#1\hbox
- {\startnegativeproperty % might change
- \startcolor[white]\vrule\!!height\ht#1\!!depth\dp#1\!!width\wd#1\stopcolor
+ {\startnegative % might change
+% \startcolor[\s!white]\vrule\!!height\ht#1\!!depth\dp#1\!!width\wd#1\stopcolor
+ \blackrule[\c!color=\s!white,\c!height=\ht#1,\c!depth=\dp#1,\c!width=\wd#1]%
\hskip-\wd#1%
\box#1%
- \stopnegativeproperty}}
+ \stopnegative}}
%D There are in principle two ways to handle overprint: bound to colors
%D or independent. For the moment we only support independent overprint
%D handling. Here we deal with a per-document setting.
+%D We can move the stack and attribute setting to the \LUA\ end.
+
+\installcorenamespace{colorintent}
+
+\unexpanded\def\registercolorintent#1#2%
+ {\setevalue{\??colorintent#1}{\attribute\colorintentattribute\ctxcommand{registercolorintent('#2')} }}
+
+\unexpanded\def\colo_intents_set
+ {\ctxcommand{enablecolorintents()}%
+ \unexpanded\gdef\colo_intents_set##1{\csname\??colorintent##1\endcsname}%
+ \colo_intents_set}
+
+\registercolorintent{knockout} {knockout}
+\registercolorintent{overprint}{overprint}
+
+\installattributestack\colorintentattribute
+
+\setevalue{\??colorintent\v!none}{\attribute\colorintentattribute\attributeunsetvalue} % or reset? used at all?
+
\unexpanded\def\startcolorintent[#1]%
{\pushattribute\colorintentattribute
- \dotriggercolorintent{#1}}
+ \colo_intents_set{#1}}
\unexpanded\def\stopcolorintent
{\popattribute\colorintentattribute}
\unexpanded\def\startoverprint{\startcolorintent[\v!overprint]}
-\unexpanded\def\stopoverprint {\stopcolorintent}
-
\unexpanded\def\startknockout {\startcolorintent[\v!knockout ]}
-\unexpanded\def\stopknockout {\stopcolorintent}
+
+\let\stopoverprint\stopcolorintent
+\let\stopknockout \stopcolorintent
\let\starttextcolorintent\relax
\let\stoptextcolorintent \relax
-\setupcolors
- [\c!overprint=\v!no]
-
\appendtoks
- \dosettextcolorintent
+ \colo_intents_set_text
\to \everysetupcolors
-\def\dosettextcolorintent
- {\doifnot\@@clintent\v!none
- {\xdef\starttextcolorintent{\noexpand\dotriggercolorintent{\@@clintent}}%
- \glet\dosettextcolorintent\relax
- \dotriggercolorintent\@@clintent}}
+\let\p_colo_intent\empty
+
+\def\colo_intents_set_text
+ {\edef\p_colo_intent{\colorsparameter\c!intent}%
+ \ifx\p_colo_intent\v!none \else
+ \unexpanded\xdef\starttextcolorintent{\colo_intents_set{\p_colo_intent}}%
+ \glet\colo_intents_set_text\relax
+ \colo_intents_set\p_colo_intent
+ \fi}
\appendtoks \starttextcolorintent \to \everystarttextproperties
\appendtoks \stoptextcolorintent \to \everystoptextproperties
-\setupcolors[\c!intent=\v!none]
-
-% A goodie that replaces the startMPcolor hackery
-
-% \definecolor[red-t] [r=1,t=0.5,a=1]
-% \definecolor[green-t][g=1,t=0.5,a=1]
-%
-% \defineintermediatecolor[mycolora][0.5,red,green]
-% \defineintermediatecolor[mycolorb][0.5,red-t,green-t]
-%
-% \definecolor[mycolorc][.5(blue,red)]
-% \definecolor[mycolord][.5(blue)]
-%
-% \enabledirectives[colors.pgf]
-% \definecolor[mycolorx][magenta!50!yellow]
-%
-% \starttext
-% test {\mycolora OEPS} test
-% test {\mycolorb OEPS} test
-% test {\mycolorc OEPS} test
-% test {\mycolord OEPS} test
-% test {\mycolorx OEPS} test
-% \stoptext
-
-\unexpanded\def\defineintermediatecolor
- {\dotripleempty\dodefineintermediatecolor}
-
-\def\dodefineintermediatecolor[#1][#2][#3]% \dotripleempty adds {} inside []
- {\dododefineintermediatecolor[#1][#2][#3]}
-
-\def\dododefineintermediatecolor[#1][#2,#3,#4][#5]%
- {\ifconditional\collectcolorsinlist\collectcolorinlist{#1}\fi
- \ctxcommand{defineintermediatecolor("#1","#2",
- \thecolorattribute{#3},\thecolorattribute{#4},
- \thetransparencyattribute{#3},\thetransparencyattribute{#4},
- "#5",false,\iffreezecolors true\else false\fi)}% not global
- \dodefinecolorcommand\setvalue{#1}}
+\setupcolors
+ [\c!intent=\v!none]
\protect \endinput