Support

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

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

[RUBY} H, S, V colours

Post any examples or modules that you want to share here

[RUBY} H, S, V colours

Postby trogluddite » 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.

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

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!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: [RUBY} H, S, V colours

Postby Dimmak01 » Sat Sep 21, 2013 5:15 pm

Thanks trogluddite! :ugeek:
Dimmak01
 
Posts: 12
Joined: Mon Oct 19, 2009 11:38 am


Return to User Examples

Who is online

Users browsing this forum: Google [Bot] and 86 guests