在 FXRuby 中制作渐变

Making a gradient in FXRuby

有没有办法在 FXRuby 中创建渐变?如果是这样,我将如何实施?

我试过查看 https://www.rubydoc.info/gems/fxruby/Fox/FXImage,但对我来说没有多大意义,如果我能详细说明 #gradient 的含义以及如何使用它,那就太好了。

根据 the docs 下面是您将如何使用该方法,但首先您需要安装并需要 gem

gem install fxruby

然后在你的代码中:

require 'fxruby'

# the arguments represent rgb colors:
# #gradient(topleft, topright, bottomleft, bottomright)

您需要传递要用于实际渐变的 RGB 颜色,但这是语法示例

FXImage.gradient(
  Fox.FXRGB(253, 245, 230), 
  Fox.FXRGB(253, 245, 230), 
  Fox.FXRGB(253, 245, 230), 
  Fox.FXRGB(253, 245, 230)
)

examples of colors

请看这里