From c377e90e2d18fa6d299c75f668fab4e4ca0c2f16 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 5 Sep 2011 23:49:00 +0200 Subject: beta 2011.09.05 23:49 --- metapost/context/base/mp-mlib.mpiv | 27 +++++++++++++++++++++++++++ metapost/context/base/mp-tool.mp | 14 ++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) (limited to 'metapost') diff --git a/metapost/context/base/mp-mlib.mpiv b/metapost/context/base/mp-mlib.mpiv index 5b88c3159..c7240e127 100644 --- a/metapost/context/base/mp-mlib.mpiv +++ b/metapost/context/base/mp-mlib.mpiv @@ -583,3 +583,30 @@ def bitmapimage(expr xresolution, yresolution, data) = withpostscript data ; ) enddef ; + +% TODO: + +let property = picture ; + +vardef properties(text t) = + image(draw unitcircle t) +enddef ; + +def withproperties expr p = + if colormodel p = 3 : + withcolor graypart p + elseif colormodel p = 5 : + withcolor (redpart p,greenpart p,bluepart p) + elseif colormodel p = 7 : + withcolor (cyanpart p,magentapart p,yellowpart p,blackpart p) + fi + % todo, when available in mp: + % + % withprescript prescript p + % withpostscript postscript p + % + % todo, penpart +enddef ; + +% property p ; p = properties(withcolor (1,1,0,1)) ; +% fill fullcircle scaled 20cm withproperties p ; diff --git a/metapost/context/base/mp-tool.mp b/metapost/context/base/mp-tool.mp index 4ada54429..480d9d186 100644 --- a/metapost/context/base/mp-tool.mp +++ b/metapost/context/base/mp-tool.mp @@ -2438,8 +2438,18 @@ enddef ; % new -vardef colorpart(expr i) = - (redpart i, greenpart i,bluepart i) +% vardef colorpart(expr i) = +% (redpart i, greenpart i,bluepart i) +% enddef ; + +vardef colorpart(expr c) = + if colormodel c = 3 : + graypart c + elseif colormodel c = 5 : + (redpart c,greenpart c,bluepart c) + elseif colormodel c = 7 : + (cyanpart c,magentapart c,yellowpart c,blackpart c) + fi enddef ; % for david arnold: -- cgit v1.2.3