If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
[RUBY} H, S, V colours
2 posts
• Page 1 of 1
[RUBY} H, S, V colours
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!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 67 guests