Monday, May 08, 2006

Basic ColourData Class --Updated--

Note: Requires ColourSpace class.

You may also need to change the import line and the class name dependant on where you put it in your classpath.

I made this class so I'd have an easier time managing many 32bit and 16bit colour values at once. It works rather nicely so I decided to put it up here for anyone else in need it.

Obligatory sample syntax:

var myColour:ColourData = new ColourData( 127, 166, 223, 16 );

var myColourHSL:Object = myColour.convert("RGB", "HSL");
for(var i in myColourHSL){

trace(i+": "+myColourHSL[i]);

myBitmap.setPixel32( _xmouse, _ymouse, myColour.toHex());

For 16 bit colour values simply replace the alpha param with null:

//16 Bit Colour
var myColour:ColourData = new ColourData(null, 100, 233, 87);

Any comments on what to add/remove would be greatly appreciated.


Post a Comment

<< Home