A utility for storing, accessing and converting colors in an RGBA (red, green, blue, alpha) color format.

var color:RGBA = 0x883300FF;
trace (color.r); // 0x88
trace (color.g); // 0x33
trace (color.b); // 0x00
trace (color.a); // 0xFF

var convert:ARGB = color; // 0xFF883300

Static variables

statica:Int

Accesses the alpha component of the color

staticb:Int

Accesses the blue component of the color

staticg:Int

Accesses the green component of the color

staticr:Int

Accesses the red component of the color

Static methods

staticinlinecreate(r:Int, g:Int, b:Int, a:Int):RGBA

Creates a new RGBA instance from component values

Parameters:

r

A red component value

g

A green component value

b

A blue component value

a

An alpha component value

Returns:

A new RGBA instance

staticinlinemultiplyAlpha(this:Int):Void

Multiplies the red, green and blue components by the current alpha component

@:value({ premultiplied : false, format : RGBA32 })staticinlinereadUInt8(this:Int, data:UInt8Array, offset:Int, format:PixelFormat = RGBA32, premultiplied:Bool = false):Void

Reads a value from a UInt8Array into the current RGBA color

Parameters:

data

A UInt8Array instance

offset

An offset into the UInt8Array to read

format

(Optional) The PixelFormat represented by the UInt8Array data

premultiplied

(Optional) Whether the data is stored in premultiplied alpha format

staticinlineset(this:Int, r:Int, g:Int, b:Int, a:Int):Void

Sets the current RGBA color to new component values

Parameters:

r

The red component value to set

g

The green component value to set

b

The blue component vlaue to set

a

The alpha component value to set

staticinlineunmultiplyAlpha(this:Int):Void

Divides the current red, green and blue components by the alpha component

@:value({ premultiplied : false, format : RGBA32 })staticinlinewriteUInt8(this:Int, data:UInt8Array, offset:Int, format:PixelFormat = RGBA32, premultiplied:Bool = false):Void

Writes the current RGBA color into a UInt8Array

Parameters:

data

A UInt8Array instance

offset

An offset into the UInt8Array to write

format

(Optional) The PixelFormat represented by the UInt8Array data

premultiplied

(Optional) Whether the data is stored in premultiplied alpha format