JuliaGraphics / Luxor.jl

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

Shifting existing drawing to center #227

Closed kilacoda closed 2 years ago

kilacoda commented 2 years ago

Hi,

I have a figure like this, which is created by simply using poly in a loop: 1

I'd like to center the image produced at some coordinate of the polygons in that blob and scale the image a bit larger for more clarity (my ultimate goal is to export this SVG to a PNG and make a GIF out of multiple such images). Is there any way I can do this? I tried origin(<point>) but that seems to set the origin with which all new figures are drawn to be set to (0,0).

cormullion commented 2 years ago

Hi. I suppose the way Luxor/Cairo does the drawing can be awkward for some workflows like this - it's more of a "paint on the canvas and move on" approach, rather than "build objects in memory and then render them" approach.

I've had some success with stored paths - you build a path on the drawing then store it in a variable rather than actually draw it immediately. Also, if you have a list of points you can transform them using polymove!, polyscale! et al. These sometimes can overcome the basic Cairo drawing model.

stale[bot] commented 2 years 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.