JuliaGraphics / Luxor.jl

Simple drawings using vector graphics; Cairo "for tourists!"
http://juliagraphics.github.io/Luxor.jl/
Other
576 stars 72 forks source link

rotated `placeimage` broken #267

Closed yha closed 9 months ago

yha commented 11 months ago

Placing an svg after rotate often clips the svg or draws nothing, and sometimes messes up subsequent draws as well. Some examples with this file: strip-tmp

s = readsvg("strip-tmp.svg")
@svg let
    rotate(-0.2)
    placeimage(s)
end 200 200

tmp

@svg for angle in 1.2:-0.2:-1.2
    @layer let
        rotate(angle)
        placeimage(s; centered=true)
        translate(50, 0)
        text(string(angle))
    end
end 800 800

tmp

cormullion commented 11 months ago

It appears that the Rsvg.handle_render_cairo() call inside placesvg() modifies the coordinate system in such a way that, although it's enclosed in @layer ...end, changes can "leak" out into surrounding code and upset subsequent graphics.

You could try enclosing the placeimage() in another @layer ... end to see if that can really isolate the changes introduced by the Rsvg action...

stale[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.