Friday, April 28, 2006

Colour Space Conversion Class

Download:Here

Notes:

The colour space conversion isn't 100% automated in this class. In order to convert from RGB to LAB you need to convert from RGB to XYZ then to LAB. Eventually I will create a wrapper class that will allow you to convert from anything to anything. Without messy calls like:

var rgbColour:Object = {r:100, g:231, b:16}; //Super sweet colour
var labColour:Object = ColourSpace.XYZtoLAB(ColourSpace.RGBtoXYZ(rgbColour));

However, for now you'll have to make due.

Return Format:
All the methods return objects that contain the respecitve prop names of what they're converted to in lower case. I did this so all the output is somewhat uniform ex. {l:val, a:val, b:val} and {x:val, y:val, z:val}.

HSV and HSL Notes:
The hue in HSV and HSL are returned in degrees not percentiles.

1 Comments:

Blogger Age said...

Sup fellow nerd. Blogger for the win!

Friday, April 28, 2006 8:51:00 AM  

Post a Comment

<< Home