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

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

var convert:BGRA = color; // 0x003388FF

Static methods

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

Creates a new ARGB instance from component values

Parameters:

a

An alpha component value

r

A red component value

g

A green component value

b

A blue component value

Returns:

A new ARGB instance

Variables

@:impla:Int

Accesses the alpha component of the color

@:implb:Int

Accesses the blue component of the color

@:implg:Int

Accesses the green component of the color

@:implr:Int

Accesses the red component of the color

Methods

@:implinlinemultiplyAlpha():Void

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

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

Reads a value from a UInt8Array into the current ARGB 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

@:implinlineset(a:Int, r:Int, g:Int, b:Int):Void

Sets the current ARGB color to new component values

Parameters:

a

The alpha component value to set

r

The red component value to set

g

The green component value to set

b

The blue component vlaue to set

@:implinlineunmultiplyAlpha():Void

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

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

Writes the current ARGB 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