Degrafa 换色器
<degrafa:LinearGradientFill id="bluedream">
<degrafa:GradientStop color="#6ab5d0"/>
<degrafa:GradientStop color="#388aae"/>
</degrafa:LinearGradientFill>
<degrafa:GeometryComposition graphicsTarget="{[bgCanvas]}">
<degrafa:RoundedRectangle id="color_preset" fill="{bluedream}"/>
</degrafa:GeometryComposition>
我对 degrafa 代码有问题,我为 color_preset.fill 定义了一组不同的渐变,当用户在组合框中选择不同的颜色时,它会动态变化。
我将 fill="{bluedream}"
替换为 fill="using_variable"
并导致编译错误消息:Initializer for 'fill': values of type com. degrafa.core.IGraphicsFill
无法用文本表示。
有没有办法使用此代码作为换色器?
<degrafa:LinearGradientFill id="bluedream">
<degrafa:GradientStop color="#6ab5d0"/>
<degrafa:GradientStop color="#388aae"/>
</degrafa:LinearGradientFill>
<degrafa:GeometryComposition graphicsTarget="{[bgCanvas]}">
<degrafa:RoundedRectangle id="color_preset" fill="{bluedream}"/>
</degrafa:GeometryComposition>
I have issue with degrafa code which I have defined a set of different gradients for color_preset.fill to be dynamic change when user select different color in the combobox.
I replaced fill="{bluedream}"
with fill="using_variable"
and lead to error compiled message: Initializer for 'fill': values of type com.degrafa.core.IGraphicsFill
cannot be represented in text.
Is there a solution to use this code as a color changer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
示例中的 fill 属性指向 ID 为“bluedream”的 LinearGradientFill。 您可以用不同的渐变(或实心或其他填充)替换填充,也可以更改渐变填充本身的颜色:
我还没有运行该代码,但它应该可以工作。 这个想法是用下拉列表的 selectedItem 更改 GradientStop 的颜色(前提是它是一个字符串)。
此示例执行的操作非常相似,但使用颜色选择器而不是下拉菜单:
http://degrafa.org/source/CS4IconPreviewer/CS4IconPreviewer.html
The fill property in your example is pointing to the LinearGradientFill with id "bluedream". You can either replace the fill with a different gradient (or solid or other fill) or change the colors of the gradient fill itself:
I haven't run that code, but it should work. The idea is to change the color of the GradientStop with your dropdown's selectedItem (provided that is a string).
This example does something very similar, but with a color picker instead of a dropdown:
http://degrafa.org/source/CS4IconPreviewer/CS4IconPreviewer.html