diff options
author | Marius <mariausol@gmail.com> | 2011-08-18 17:40:23 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-08-18 17:40:23 +0300 |
commit | 5463542d926a6ca73d86251154cabc00a9333fa5 (patch) | |
tree | 33c0104835277e96d6b0474466e75963fef16de4 /metapost | |
parent | ee4f24d635e0db2029f026a1c098ae76d1e537d3 (diff) | |
download | context-5463542d926a6ca73d86251154cabc00a9333fa5.tar.gz |
beta 2011.08.18 16:00
Diffstat (limited to 'metapost')
-rw-r--r-- | metapost/context/base/mp-page.mp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/metapost/context/base/mp-page.mp b/metapost/context/base/mp-page.mp index a4f0a86ef..0c2f41f03 100644 --- a/metapost/context/base/mp-page.mp +++ b/metapost/context/base/mp-page.mp @@ -477,17 +477,21 @@ enddef ; % Crop stuff -vardef crop_marks_lines (expr box, length, offset) = - save p ; picture p ; +vardef crop_marks_lines (expr box, length, offset, nx, ny) = + save p ; picture p ; save w, h, x, y ; numeric w, h, x, y ; p := image ( - draw ((llcorner box) -- (llcorner box) shifted (-length,0)) shifted (-offset,0) ; - draw ((llcorner box) -- (llcorner box) shifted (0,-length)) shifted (0,-offset) ; - draw ((lrcorner box) -- (lrcorner box) shifted ( length,0)) shifted ( offset,0) ; - draw ((lrcorner box) -- (lrcorner box) shifted (0,-length)) shifted (0,-offset) ; - draw ((ulcorner box) -- (ulcorner box) shifted (-length,0)) shifted (-offset,0) ; - draw ((ulcorner box) -- (ulcorner box) shifted (0, length)) shifted (0, offset) ; - draw ((urcorner box) -- (urcorner box) shifted ( length,0)) shifted ( offset,0) ; - draw ((urcorner box) -- (urcorner box) shifted (0, length)) shifted (0, offset) ; + x := if nx = 0 : 1 else : nx - 1 fi ; + y := if ny = 0 : 1 else : ny - 1 fi ; + w := bbwidth (box) / x ; + h := bbheight(box) / y ; + for i=0 upto y : + draw ((llcorner box) -- (llcorner box) shifted (-length,0)) shifted (-offset,i*h) ; + draw ((lrcorner box) -- (lrcorner box) shifted ( length,0)) shifted ( offset,i*h) ; + endfor ; + for i=0 upto x : + draw ((llcorner box) -- (llcorner box) shifted (0,-length)) shifted (i*w,-offset) ; + draw ((ulcorner box) -- (ulcorner box) shifted (0, length)) shifted (i*w, offset) ; + endfor ; ) ; setbounds p to box ; p @@ -627,12 +631,12 @@ def page_marks_add_marking(expr width, height, length, offset) = % todo: namespa enddef ; -def page_marks_add_lines(expr width, height, length, offset) = % todo: namespace +def page_marks_add_lines(expr width, height, length, offset, nx, ny) = % todo: namespace path page ; page := fullsquare xscaled width yscaled height ; path more ; more := page enlarged (offset+length/2,offset+length/2) ; - draw crop_marks_lines(page,length,offset) ; + draw crop_marks_lines(page,length,offset,nx,ny) ; setbounds currentpicture to page ; |