summaryrefslogtreecommitdiff
path: root/metapost/context/base/mpiv/mp-shap.mpiv
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-05-14 19:58:50 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-05-14 19:58:50 +0200
commitfd0c4577a4b6e85ca2db664906e1a03807ce133f (patch)
treefa23fcc04248d03ff82e34634b8ef1bb9cf28acb /metapost/context/base/mpiv/mp-shap.mpiv
parentdb581096187dc2d3cbdbe4cdc39d247c168b1607 (diff)
downloadcontext-fd0c4577a4b6e85ca2db664906e1a03807ce133f.tar.gz
2017-05-14 19:15:00
Diffstat (limited to 'metapost/context/base/mpiv/mp-shap.mpiv')
-rw-r--r--metapost/context/base/mpiv/mp-shap.mpiv16
1 files changed, 13 insertions, 3 deletions
diff --git a/metapost/context/base/mpiv/mp-shap.mpiv b/metapost/context/base/mpiv/mp-shap.mpiv
index 713656510..a511ef375 100644
--- a/metapost/context/base/mpiv/mp-shap.mpiv
+++ b/metapost/context/base/mpiv/mp-shap.mpiv
@@ -74,6 +74,8 @@ def stop_predefined_shape_definition =
enddef ;
+% this can be delayed
+
start_predefined_shape_definition ;
predefined_shapes[ 0] := (origin--cycle) ;
@@ -143,7 +145,7 @@ start_predefined_shape_definition ;
stop_predefined_shape_definition ;
vardef some_shape_path (expr type) =
- if known predefined_shapes[type] : predefined_shapes[type] else : predefined_shapes[0] fi
+ if known predefined_shapes[type] : predefined_shapes[type] else : predefined_shapes[24] fi
enddef ;
def some_shape (expr shape_type, shape_width, shape_height, shape_linewidth, shape_linecolor, shape_fillcolor) =
@@ -156,14 +158,22 @@ def some_shape (expr shape_type, shape_width, shape_height, shape_linewidth, sha
endgroup ;
enddef ;
+% maybe:
+%
+% if t>1 : % normal shape
+% path pp ; pp := some_shape_path(t) xyscaled(bbwidth(p), bbheight(p)) ;
+% pp := pp shifted - center pp shifted center p ;
+% fill pp withcolor fc ;
+% draw pp withpen pencircle scaled lw withcolor lc ;
+
vardef drawpredefinedshape (expr t, p, lw, lc, fc) =
save pp ;
- if t>1 : % normal shape
+ if t > 1 : % normal shape
path pp ;
pp := some_shape_path(t) xyscaled(bbwidth(p), bbheight(p)) shifted center p ;
fill pp withcolor fc ;
draw pp withpen pencircle scaled lw withcolor lc ;
- elseif t=1 : % background only
+ elseif t = 1 : % background only
path pp ;
pp := fullsquare xyscaled(bbwidth(p), bbheight(p)) shifted center p ;
fill pp withcolor fc ;