summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-05-06 23:00:14 +0300
committerMarius <mariausol@gmail.com>2012-05-06 23:00:14 +0300
commit3470f9c8287a1a28fba72a83038cd54ab64c6da9 (patch)
treeb1e4db45722707489512c3a46b4762cd0c1f880e /metapost
parenta45b55349d166c2e4eb46ef431617c9ce7183dc0 (diff)
downloadcontext-3470f9c8287a1a28fba72a83038cd54ab64c6da9.tar.gz
beta 2012.05.06 21:53
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mp-mlib.mpiv35
-rw-r--r--metapost/context/base/mp-tool.mpiv17
2 files changed, 31 insertions, 21 deletions
diff --git a/metapost/context/base/mp-mlib.mpiv b/metapost/context/base/mp-mlib.mpiv
index f89e7a491..ef3408198 100644
--- a/metapost/context/base/mp-mlib.mpiv
+++ b/metapost/context/base/mp-mlib.mpiv
@@ -596,22 +596,21 @@ enddef ;
primarydef t asgroup s = % s = isolated|knockout
begingroup
- save savedpicture ;
- picture savedpicture ;
- save currentbounds ;
- path currentbounds ;
- savedpicture := if picture t : t else : image(draw t) fi ;
- currentbounds := boundingbox savedpicture ;
- image (
- draw currentbounds
- withprescript "gr_state=start"
- withprescript "gr_type=" & s
- withprescript "gr_llx=" & decimal xpart llcorner currentbounds
- withprescript "gr_lly=" & decimal ypart llcorner currentbounds
- withprescript "gr_urx=" & decimal xpart urcorner currentbounds
- withprescript "gr_ury=" & decimal ypart urcorner currentbounds ;
- draw savedpicture ;
- draw currentbounds
- withprescript "gr_state=stop" ;
- ) endgroup
+ save grouppicture, wrappedpicture, groupbounds ;
+ picture grouppicture, wrappedpicture ; path groupbounds ;
+ grouppicture := if picture t : t else : image(draw t) fi ;
+ groupbounds := boundingbox grouppicture ;
+ wrappedpicture:= nullpicture ;
+ addto wrappedpicture contour groupbounds
+ withprescript "gr_state=start"
+ withprescript "gr_type=" & s
+ withprescript "gr_llx=" & decimal xpart llcorner groupbounds
+ withprescript "gr_lly=" & decimal ypart llcorner groupbounds
+ withprescript "gr_urx=" & decimal xpart urcorner groupbounds
+ withprescript "gr_ury=" & decimal ypart urcorner groupbounds ;
+ addto wrappedpicture also grouppicture ;
+ addto wrappedpicture contour groupbounds
+ withprescript "gr_state=stop" ;
+ wrappedpicture
+ endgroup
enddef ;
diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv
index d52820d13..39449b511 100644
--- a/metapost/context/base/mp-tool.mpiv
+++ b/metapost/context/base/mp-tool.mpiv
@@ -1144,15 +1144,26 @@ enddef ;
%D The next two macros are adapted versions of plain
%D \METAPOST\ definitions.
+vardef arrowpath expr p = % patch by Peter Rolf: supports squared pen and shifting (hh: maybe just use center of head as first)
+ (p cutafter makepath(pencircle scaled 2(ahlength*cosd(.5ahangle)) shifted point length p of p))
+enddef;
+
+% def _finarr text t =
+% if autoarrows : set_ahlength (t) fi ;
+% draw arrowpath _apth t ; % arrowpath added
+% filldraw arrowhead _apth t ;
+% enddef;
+
def _finarr text t =
if autoarrows : set_ahlength (t) fi ;
- draw _apth t ;
- filldraw arrowhead _apth t ;
+ draw arrowpath _apth t ; % arrowpath added
+ fill arrowhead _apth t ;
+ draw arrowhead _apth t ;
enddef;
def _findarr text t =
if autoarrows : set_ahlength (t) fi ;
- draw _apth t ;
+ draw arrowpath _apth t ;
fill arrowhead _apth withpen currentpen t ;
fill arrowhead reverse _apth withpen currentpen t ;
enddef ;