From 083fbf2fefcb875ba9b9beb8567cb71c282adb31 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 6 May 2012 21:53:00 +0200 Subject: beta 2012.05.06 21:53 --- metapost/context/base/mp-mlib.mpiv | 35 +++++++++++++++++------------------ metapost/context/base/mp-tool.mpiv | 17 ++++++++++++++--- 2 files changed, 31 insertions(+), 21 deletions(-) (limited to 'metapost') 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 ; -- cgit v1.2.3