简体   繁体   English

Tcl svg 梯度变换不起作用 - 梯度被忽略

[英]tcl svg gradient transformation not working - gradient silently ignored

I'm using tksvg 0.7.4 and noticed that the gradient transformation isn't working.我正在使用tksvg 0.7.4并注意到梯度变换不起作用。 Despite some features are not supported (yet) by , this feature is explicitly mentioned as supported in TIP 507 and as far as I know this package is just about to be included in tk 8.7.尽管 (还)不支持某些功能,但TIP 507中明确提到支持该功能,据我所知,这个 package 即将包含在 tk 8.7 中。

I use the following data:我使用以下数据:

 <svg width="120" height="240" version="1.1" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="Gradient1"> <stop offset="0%" stop-color="red" /> <stop offset="50%" stop-color="black" stop-opacity="0" /> <stop offset="95%" stop-color="blue" /> </linearGradient> <linearGradient id="Gradient2" x1="0" x2="0" y1="0" y2="1"> <stop offset="0%" stop-color="red" /> <stop offset="50%" stop-color="black" stop-opacity="0" /> <stop offset="95%" stop-color="blue" /> </linearGradient> </defs> <rect id="rect1" x="10" y="10" rx="15" ry="15" width="100" height="100" fill="url(#Gradient1)"/> <rect x="10" y="120" rx="15" ry="15" width="100" height="100" fill="url(#Gradient2)" /> </svg>

and tried unsuccessfully to alternate the data with the following line in the body and included it in the header as I found elsewhere in a tutorial.并尝试将数据与正文中的以下行交替,但没有成功,并将其包含在 header 中,正如我在教程的其他地方找到的那样。

<gradientTransform="rotate(90)" \>  

While the TIP is marked as done I think it should work already.虽然 TIP 标记为已done ,但我认为它应该已经可以使用了。 I'm using Windows 11 by the way.顺便说一句,我正在使用 Windows 11。

在此处输入图像描述


Update: All of the gradient attributes do not work更新:所有渐变属性都不起作用

As I've commented: use gradientTransform="rotate(90 0.5 0.5)" where 0.5 0.5 mark the rotation center in the middle正如我评论的那样:使用gradientTransform="rotate(90 0.5 0.5)"其中 0.5 0.5 标记中间的旋转中心

 <svg width="120" height="240" version="1.1" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="Gradient1"> <stop offset="0%" stop-color="red" /> <stop offset="50%" stop-color="black" stop-opacity="0" /> <stop offset="95%" stop-color="blue" /> </linearGradient> <linearGradient id="Gradient2" x1="0" x2="0" y1="0" y2="1" gradientTransform="rotate(90 0.5 0.5)"> <stop offset="0%" stop-color="red" /> <stop offset="50%" stop-color="black" stop-opacity="0" /> <stop offset="95%" stop-color="blue" /> </linearGradient> </defs> <rect id="rect1" x="10" y="10" rx="15" ry="15" width="100" height="100" fill="url(#Gradient1)"/> <rect x="10" y="120" rx="15" ry="15" width="100" height="100" fill="url(#Gradient2)" /> </svg>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM