diff options
author | Hans Hagen <pragma@wxs.nl> | 2011-09-05 23:49:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2011-09-05 23:49:00 +0200 |
commit | c377e90e2d18fa6d299c75f668fab4e4ca0c2f16 (patch) | |
tree | 86d48d3c8abc694a6d2fe521dbccf0bf0a30a4a8 /metapost | |
parent | 2d1ce8d51e5781cc3bbf14150aa29695da7371ee (diff) | |
download | context-c377e90e2d18fa6d299c75f668fab4e4ca0c2f16.tar.gz |
beta 2011.09.05 23:49
Diffstat (limited to 'metapost')
-rw-r--r-- | metapost/context/base/mp-mlib.mpiv | 27 | ||||
-rw-r--r-- | metapost/context/base/mp-tool.mp | 14 |
2 files changed, 39 insertions, 2 deletions
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: |