memononen / nanosvg

Simple stupid SVG parser
zlib License
1.69k stars 357 forks source link

Supporting rotation for the rasterizer #98

Open dZbear opened 7 years ago

dZbear commented 7 years ago

Hi all, I really love NanoSVG and was able to get everything going using our in-house OpenGL engine. I added some clamping logic so that when the rasterized image is bigger than the viewport, vertexes gets clamped, and the invoked call to nsvgRasterize reflects this by requesting only the visible portion, which in return makes zooming in extremely fast and efficient.

My issue comes when I rotate the resulting svg, I have no way of specifying an angle to the rasterizer. Does anyone have a good solution to cope up with rotation when working with svg that are exceeding the viewport's dimensions?

Thanks for any input!

doublex commented 6 years ago

+1

SergeySlice commented 6 years ago

There are two questions:

  1. Make rasterizing not only with tx,ty,scale, but with full matrix including rotation.
  2. Correct calculate image box after rotation to fit into view box. I have no these solutions.