summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-09-06 01:00:13 +0300
committerMarius <mariausol@gmail.com>2011-09-06 01:00:13 +0300
commitbacc6b247ea105554e09ff5071211bc5366c4e39 (patch)
tree94784c83bccb2df6785dfb2f534e279fffa261a6 /metapost
parent1f5a3bdc52b216a40a44fa6e1b309b7b4305ac3d (diff)
downloadcontext-bacc6b247ea105554e09ff5071211bc5366c4e39.tar.gz
beta 2011.09.05 23:49
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mp-mlib.mpiv27
-rw-r--r--metapost/context/base/mp-tool.mp14
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: