Sujet : Re: Radial gradient rendering issue in SVG photo images in tk 9
De : wortkarg3 (at) *nospam* yahoo.com (Harald Oehlmann)
Groupes : comp.lang.tclDate : 14. May 2025, 09:37:07
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <1001knk$2btj2$1@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
Am 14.05.2025 um 09:37 schrieb Eric Brunel:
Hello all,
I've encountered what looks like a rendering problem in SVG photo images
with radial gradients. For example, with the following SVG specification:
<?xml version="1.0" encoding="UTF-8"?>
<svg width="600" height="300" xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs>
<radialGradient id="g" gradientUnits="objectBoundingBox"
cx="50%" cy="50%" r="50%">
<stop offset="0" stop-color="#0000FF"/>
<stop offset="1" stop-color="#FF0000"/>
</radialGradient>
</defs>
<rect x="0" y="0" width="600" height="300" stroke="none" fill="url(#g)"/>
</svg>
all the tools supporting SVG I could try render the gradient based on an
ellipse enclosed in the 600x300 rectangle.
But that's not what appears in a SVG photo image in tk 9: the gradient is
based on a circle with a diameter set to the maximum size of the object's
bounding box (here 600 points).
In the man page for photo images, it is explicitly specified that setting
gradientUnits to "objectBoundingBox" is supported, so it looks like a
rendering issue. Or maybe there is a limitation on radial gradients in
this case?
Thanks!
Eric,
a bar nanosvg is used for interpretation and rendering:
https://github.com/memononen/nanosvgThe issue on radient gradients often pops-up there.
Proposals to improve the documentation is welcomed.
It is not that chertain drawing features are not supported, but also certain syntax constructs...
AFAIK, there is a full svg renderer in the TkImg package.
Take care,
Harald