generated from napi-rs/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Description
The popular online SVG editor BoxySVG output files like:
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<defs>
<radialGradient gradientUnits="userSpaceOnUse" cx="50" cy="50" r="25" id="gradient-0">
<stop offset="0" style="stop-color: rgb(84.706% 84.706% 84.706%)"/>
<stop offset="1" style="stop-color: rgb(48.42% 48.42% 48.42%)"/>
</radialGradient>
</defs>
<rect x="25" y="25" width="50" height="50"
style="stroke: rgb(0, 0, 0); fill: url("#gradient-0");"
/>
</svg>
Please notice the:
fill: url("#gradient-0")
which is apparently valid SVG code although it is not valid CSS code.
Problem:
If we
loadImage(svgPath)
thendrawImage(image)
we get a black square i.e no gradient.
Changing url("#gradient-0")
to url(#gradient-0)
, the gradient works as expected.
Request:
Handle this valid syntax in
loadImage
.
Technically, we can load SVG contents, remove such "character references" then construct a data-url. Preferably this would be handled automatically by @napi-rs/canvas
, just like the npm module canvas
.
Metadata
Metadata
Assignees
Labels
No labels