summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/colo-ini.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/colo-ini.lua')
-rw-r--r--tex/context/base/mkiv/colo-ini.lua54
1 files changed, 54 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/colo-ini.lua b/tex/context/base/mkiv/colo-ini.lua
index 473427198..c7b1d4de4 100644
--- a/tex/context/base/mkiv/colo-ini.lua
+++ b/tex/context/base/mkiv/colo-ini.lua
@@ -109,6 +109,8 @@ colors.pushset = pushset
colors.popset = popset
colors.setlist = setlist
+-- todo: set at the lua end
+
local ctx_colordefagc = context.colordefagc
local ctx_colordefagt = context.colordefagt
local ctx_colordefalc = context.colordefalc
@@ -508,6 +510,56 @@ local function defineprocesscolor(name,str,global,freeze) -- still inconsistent
colorset[name] = true-- maybe we can store more
end
+local function defineprocesscolordirect(settings)
+ if settings then
+ local name = settings.name
+ if name then
+ local r = settings.r
+ local g = settings.g
+ local b = settings.b
+ if r or g or b then
+ -- we can consider a combined rgb cmyk s definition
+ register_color(name,'rgb', r or 0, g or 0, b or 0)
+ else
+ local c = settings.c
+ local m = settings.m
+ local y = settings.y
+ local k = settings.k
+ if c or m or y or k then
+ register_color(name,'cmyk',c or 0, m or 0, y or 0, k or 0)
+ else
+ local h = settings.h
+ local s = settings.s
+ local v = settings.v
+ if v then
+ r, g, b = colors.hsvtorgb(h or 0, s or 1, v or 1) -- maybe later native
+ register_color(name,'rgb',r,g,b)
+ else
+ local x = settings.x or h
+ if x then
+ r, g, b = lpegmatch(hexpattern,x) -- can be inlined
+ if r and g and b then
+ register_color(name,'rgb',r,g,b)
+ else
+ register_color(name,'gray',r or 0)
+ end
+ else
+ register_color(name,'gray',s or 0)
+ end
+ end
+ end
+ end
+ local a = settings.a
+ local t = settings.t
+ if a and t then
+ transparencies.register(name,transparent[a] or a or 1,t or 1)
+ end
+ colorset[name] = true-- maybe we can store more
+ valid[name] = true
+ end
+ end
+end
+
local function isblack(ca) -- maybe commands
local cv = ca > 0 and colorvalues[ca]
return (cv and cv[2] == 0) or false
@@ -657,6 +709,8 @@ colors.defineprocesscolor = defineprocesscolor
colors.definespotcolor = definespotcolor
colors.definemultitonecolor = definemultitonecolor
+colors.defineprocesscolordirect = defineprocesscolordirect -- test for mp
+
-- will move to mlib-col as colors in mp are somewhat messy due to the fact
-- that we cannot cast .. so we really need to use (s,s,s) for gray in order
-- to be able to map onto 'color'