diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-01-17 18:05:46 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-01-17 18:05:46 +0100 |
commit | 0cfeab235554eeee0dddd6c3f44d3939ab490ff1 (patch) | |
tree | fed70e9a3332741e5294a01197c716dff8556506 /metapost/context/base/mpiv/mp-abck.mpiv | |
parent | 72d161c0a522fd92f32edd3588fa126c453f4a3d (diff) | |
download | context-0cfeab235554eeee0dddd6c3f44d3939ab490ff1.tar.gz |
2017-01-17 17:43:00
Diffstat (limited to 'metapost/context/base/mpiv/mp-abck.mpiv')
-rw-r--r-- | metapost/context/base/mpiv/mp-abck.mpiv | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/metapost/context/base/mpiv/mp-abck.mpiv b/metapost/context/base/mpiv/mp-abck.mpiv index e0c5896e1..8b5f0a534 100644 --- a/metapost/context/base/mpiv/mp-abck.mpiv +++ b/metapost/context/base/mpiv/mp-abck.mpiv @@ -256,3 +256,38 @@ enddef ; def anchor_box (expr n,x,y,w,h,d) = currentpicture := currentpicture shifted (-x,-y) ; enddef ; + +def draw_free_region(expr width, height, depth, loffset, roffset, toffset, boffset) = + + begingroup ; save b, o, l ; path b, o, l[] ; save d ; + + b := fullsquare + xysized(width,height+depth) ; + o := b + topenlarged toffset + bottomenlarged boffset + leftenlarged loffset + rightenlarged roffset ; + d := max(PaperWidth,PaperHeight) ; + + fill o withcolor .5white ; + fill b withcolor .7white ; + + interim linecap := butt ; + + l[1] := topboundary (topboundary o leftenlarged d rightenlarged d) ; + l[2] := bottomboundary (bottomboundary o leftenlarged d rightenlarged d) ; + l[3] := leftboundary (leftboundary o topenlarged d bottomenlarged d) ; + l[4] := rightboundary (rightboundary o topenlarged d bottomenlarged d) ; + + for i=1 upto 4 : + draw l[i] withpen pencircle scaled 1bp withcolor white ; + draw l[i] withpen pencircle scaled 1bp dashed (evenly scaled 1bp) withcolor black ; + endfor ; + + setbounds currentpicture to b ; + + endgroup ; + +enddef ; + |