-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
Hi, i have faced with rendering issues with some svg files. The embedded png image doesn’t rendered
Here is the file
File structure look like this
<svg width="80" height="80" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<rect width="80" height="80" rx="8" fill="white"/>
<rect x="2" y="10.7491" width="76" height="58.5017" fill="url(#pattern0_373_2050)"/>
<defs>
<pattern id="pattern0_373_2050" patternContentUnits="objectBoundingBox" width="1" height="1">
<use xlink:href="#image0_373_2050" transform="scale(0.00171821 0.00223214)"/>
</pattern>
<image id="image0_373_2050" width="582" height="448" xlink:href="data:image/png;base64,<image data>"/>
</defs>
</svg>
if i change file structure to more simple form (remove defs section) all renders correct
<svg width="80" height="80" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<rect width="80" height="80" rx="8" fill="white"/>
<image x="2" y="10.7491" width="76" height="58.5017" xlink:href="data:image/png;base64,<image data>"/>
</svg>
I don’t know exactly, but it’s looks like the issue occurs because image UIGraphicsImageRenderer initiated with svg size (defined at file beginning) and embedded image renders in more bigger rect width="582" height="448" by using CGRenderer.draw(image: CGImage, in rect: CGRect) and only after rendering its scaling
klemenkosir
Metadata
Metadata
Assignees
Labels
No labels