Closed Reputeless closed 4 years ago
Added but not tested : https://github.com/sammycage/lunasvg/commit/7c0ddbf547285d06935571f883e505ac3ac28982.
The problem is that viewBox
is not specified in these file. But i am currently working on a way to specify the viewBox
without modifying the content of the file. Like this.
...
SVGView view(document.getBbox());
document.render(bitmap, view, dpi, bgColor);
...
Now it works fine! Thank you.
Added renderToBitmap : https://github.com/sammycage/lunasvg/commit/fc6eaff2785a550aaed34550a095accbf00829bf
SVGDocument document;
document.loadFromFile("filename.svg");
Bitmap bitmap = document.renderToBitmap();
Hi, @sammycage.
When I changed
documentWidth
anddocumentHeight
in the svg2png example as follows, the image content was cropped in some cases.scaled:
cropped:
Is there a consistent way to scale the content to fit the
lunasvg::Bitmap
size without cropping?svgren has a option to request a size, and it works as I expect. https://github.com/igagis/svgren/blob/ca45437ab6b89430c8336404889b00bc5f0147ef/src/svgren/render.hpp#L12-L27
Here are the test files.