diff options
Diffstat (limited to 'Master/texmf-dist/metapost/context/base/mpiv/mp-abck.mpiv')
-rw-r--r-- | Master/texmf-dist/metapost/context/base/mpiv/mp-abck.mpiv | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/Master/texmf-dist/metapost/context/base/mpiv/mp-abck.mpiv b/Master/texmf-dist/metapost/context/base/mpiv/mp-abck.mpiv index abd7d8848ec..57c8f226b05 100644 --- a/Master/texmf-dist/metapost/context/base/mpiv/mp-abck.mpiv +++ b/Master/texmf-dist/metapost/context/base/mpiv/mp-abck.mpiv @@ -50,17 +50,6 @@ numeric boxfilloffset ; boxfilloffset := 0 ; numeric boxgriddistance ; boxgriddistance := .5cm ; numeric boxgridshift ; boxgridshift := 0 ; -def abck_show_path(expr p, r, c) = - draw p withpen pencircle scaled .5pt withcolor c ; - if length(p) > 2 : - begingroup ; save _c_ ; path _c_ ; _c_ := fullcircle scaled r ; - for i=0 upto length(p) if cycle p : -1 fi : - fill _c_ shifted point i of p withcolor white ; - draw _c_ shifted point i of p withpen pencircle scaled .5pt withcolor c ; - endfor ; - fi ; -enddef ; - vardef abck_draw_path(expr p) = if (length p > 2) and (bbwidth(p) > 1) and (bbheight(p) > 1) : save pp ; path pp ; @@ -160,7 +149,7 @@ enddef ; def show_multi_pars = for i=1 upto nofmultipars : - abck_show_path(multipars[i], 6pt, .5blue) ; + drawpathwithpoints multipars[i] withcolor .5blue ; endfor ; enddef ; @@ -267,3 +256,43 @@ enddef ; def anchor_box (expr n,x,y,w,h,d) = currentpicture := currentpicture shifted (-x,-y) ; enddef ; + +def draw_box = % for old times sake + draw pxy boxlineoptions withpen pencircle scaled boxlinewidth ; + draw lxy -- rxy boxlineoptions withpen pencircle scaled boxgridwidth ; +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 ; + |