cppfw / svgren

:camera: SVG rendering library in C++
MIT License
206 stars 41 forks source link

root matrix is not considered #47

Closed Papirosnik closed 6 years ago

Papirosnik commented 6 years ago

Hello there. Transform matrix in root element has no effect. Thank for the coming fix. root_matrix.svg.zip

igagis commented 6 years ago

@Papirosnik what would be your expected result? I found that root transformations in SVG is an unclear question (see https://github.com/w3c/csswg-drafts/issues/894). And Firefox, Chromium and Inkscape all treat it in a different way. So, I'm a bit confused now how it actually should work. Of course it should be implemented in accordanse to some specs, if some mention about that is found in any specs.

igagis commented 6 years ago

Also, I tried InternetExplorer, it seems to ignore the root transformation as well... In some draft spec of SVG 2 (https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute) I found that transformations should be applied before viewBox, but then transformations will affect the final size of the image, and it's not very clear how it should affect the raster image dimensions in case the transformation is rotation or translation. @Papirosnik what is your actual use case? As I understand you have this attached SVG generated by some editor program and it is rendered smaller than you'd expect by svgren right?

igagis commented 6 years ago

Ok, the other thing is that looks like the svg element cannot have transform attribute at all, see https://www.w3.org/TR/SVG/struct.html#SVGElement. So, the request for this looks invalid. But still, I would like to hear about your use case, @Papirosnik .

Papirosnik commented 6 years ago

Yeah, it appears smaller than expected. But having your info in mind I have to rethink our expectation.

Papirosnik commented 6 years ago

I have to agree with you and withdraw my request. Thanks a lot for the clarification.

igagis commented 6 years ago

Thanks. It looks like in SVG v2 there will be transform attribute for svg element, but we're not there yet. So, closing the issue.