[NTG-context] clipping in metafun has weird side effects

Tobias Columbus tobias.columbus at gmail.com
Thu Oct 30 20:56:34 CET 2014


Dear all,

I stumbled upon some very weird behaviour of clipping in metafun/context. When I
add some clipped pictures to currentpicture and draw something dashed, some
subsequent lines will also be drawn dashed.

This behaviour only shows up with context but not with mptopdf or mpost. I
attached a minimal example and the corresponding output of context and mptopdf.

I tried context versions 2014.05.21 22:04 and 2014.10.29 17:47, but the result
is the same in both.

Tobias




-- 
-------------- next part --------------

vardef mycircle =
  save c ; picture c ; c := nullpicture ;
  addto c contour fullcircle scaled 2mm ;
  c
enddef ;

def a expr p =
  path _p_ ; _p_ := p ;
  a_impl
enddef ;

def a_impl text t =
  begingroup
    save c ; picture c ; c := mycircle ;
    clip c to bbox c scaled 0.5 ;
    addto currentpicture also c t ;
    addto currentpicture doublepath _p_ t ;
  endgroup
enddef ;

def b expr p =
  path _p_ ; _p_ := p ;
  b_impl
enddef ;

def b_impl text t =
  begingroup
    save c; picture c ; c := mycircle ;
    addto currentpicture also c t ;
    addto currentpicture doublepath _p_ t ;
  endgroup
enddef ;
beginfig(1)

  a (0,0) -- (1cm,0) dashed evenly ;
  currentpicture := currentpicture shifted (2cm,0) ;
  a (0,0) -- (1cm,0) ;

  currentpicture := currentpicture shifted (-2cm, 0.5cm );

  b (0,0) -- (1cm,0) dashed evenly ;
  currentpicture := currentpicture shifted (2cm,0) ;
  b (0,0) -- (1cm,0) ;

endfig ;
end
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mwe-context.pdf
Type: application/pdf
Size: 3773 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20141030/baeb5de1/attachment.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mwe-mptopdf.pdf
Type: application/pdf
Size: 1843 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20141030/baeb5de1/attachment-0001.pdf>


More information about the ntg-context mailing list