Page 1 of 1

[RUBY} H, S, V colours

PostPosted: Fri Aug 16, 2013 10:31 am
by trogluddite
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.

RGB and HSB.fsm
(documentation inside the download)
(126.86 KiB) Downloaded 1221 times

NB) There's already an undocumented method <color>.getARGB to find out the RGB values of a color object!

Re: [RUBY} H, S, V colours

PostPosted: Sat Sep 21, 2013 5:15 pm
by Dimmak01
Thanks trogluddite! :ugeek: