[RUBY} H, S, V colours
Posted: Fri Aug 16, 2013 10:31 am
Somehow always found HSV much more intuitive than RGB for defining colours - and it's nice that we have HSV primitives in the toolbox in FS.
Here's the equivalent for Ruby - two new methods that tag onto the Color class of objects.
Now, doing stuff to the stock classes is a bit naughty really, so I've tried to make them conform to the same standards for arguments and values as the stock methods (and primitives) - so if Malc (hint, hint) ever added these methods to the stock Ruby, they would hopefully just be drop in replacements.
Two new methods...
Color.newHSV(alpha, H, S, V) - create a new colour using HSV values. like the regular Color.new, you don't have to give all the arguments.
<color>.getAHSV - get an array of the HSV values for an existing Color object.
NB) There's already an undocumented method <color>.getARGB to find out the RGB values of a color object!
Here's the equivalent for Ruby - two new methods that tag onto the Color class of objects.
Now, doing stuff to the stock classes is a bit naughty really, so I've tried to make them conform to the same standards for arguments and values as the stock methods (and primitives) - so if Malc (hint, hint) ever added these methods to the stock Ruby, they would hopefully just be drop in replacements.
Two new methods...
Color.newHSV(alpha, H, S, V) - create a new colour using HSV values. like the regular Color.new, you don't have to give all the arguments.
<color>.getAHSV - get an array of the HSV values for an existing Color object.
NB) There's already an undocumented method <color>.getARGB to find out the RGB values of a color object!