Expose <svg> tags
008v opened this issue · 9 comments
I want to get some attributes of the SVG tag, such as viewbox.
Same here
There are dozens of SVG tags (https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute), so please specify which ones you'd like to see exposed.
@arielelkin, I think @008v already has mentioned one such property viewBox
. Others may include height
, width
, x
, y
, etc
@arielelkin
width
, height
and viewBox
.
I used Metal to render SVG. The first thing is transform the coordinate, convert svg coordinate to screen coordinate, and then to NDC. I need to get the viewBox
, width
, and height
of <svg>
tag to generate the matrix.
You're rendering NSBezierPaths using Metal?
@arielelkin
width
,height
andviewBox
.I used Metal to render SVG. The first thing is transform the coordinate, convert svg coordinate to screen coordinate, and then to NDC. I need to get the
viewBox
,width
, andheight
of<svg>
tag to generate the matrix.
Have you found a solution?
I have taken a second look at this and realise it's not clear what the issue is.
The SVG tags are readily available to you as you're already providing the SVG file. Getting the original SVG attributes themselves is outside the scope of PocketSVG, as that can (and should) be done by a generic XML parser.
Another reason it doesn't make sense for PocketSVG types to expose the original SVG's width
height
and viewBox
is because these values make little sense in a Core Graphics context, and could lead to confusion with SVGLayer
's native width
and height
properties or SVGImageView
's bounds
property.
@zzyspace @008v @vaibhav-jhaveri-ds if you had something different in mind, could you please elaborate on what you are trying to achieve?
Closing due to issue not seemingly applicable, but feel free to reopen with further elaboration if need be.