class org.aswing.ASColor

ASColor object to set color and alpha.

Authors firdosh, paling, n0rthwood, ngrebenshikov

Class Fields

static var BLACK:ASColor

static var BLUE:ASColor

static var CYAN:ASColor

static var DARK_GRAY:ASColor

static var GRAY:ASColor

static var GREEN:ASColor

static var HALO_BLUE:ASColor

static var HALO_GREEN:ASColor

static var HALO_ORANGE:ASColor

static var LIGHT_GRAY:ASColor

static var MAGENTA:ASColor

static var ORANGE:ASColor

static var PINK:ASColor

static var RED:ASColor

static var WHITE:ASColor

static var YELLOW:ASColor

static function getASColor(r:Int, g:Int, b:Int, ?a:Float = 1): ASColor

Returns a ASColor with the specified red, green, blue values in the range [0 - 255] and alpha value in range[0, 1].

r

red channel

g

green channel

b

blue channel

a

alpha channel

static function getASColorWithHLS(h:Float, l:Float, s:Float, ?a:Float = 1): ASColor

Returns a ASColor with with the specified hue, luminance, saturation and alpha values in the range [0 - 1].

h

hue channel

l

luminance channel

s

saturation channel

a

alpha channel

static function getColorBetween(begin:ASColor, end:ASColor, distance:Float): ASColor

static function getRGBWith(rr:Int, gg:Int, bb:Int): Int

Returns the RGB value representing the red, green, and blue values.

rr

red channel

gg

green channel

bb

blue channel

static function getWithARGB(argb:Int): ASColor

Returns a ASColor with specified ARGB uint value.

argb

ARGB value representing the color

returns

the ASColor

Instance Fields

var rgb:Int

function new(?rgb:Int = 0, ?alpha:Float = 1): Void

Create a ASColor

function brighter(?factor:Float = 0.7f): ASColor

Creates a new ASColor that is a brighter version of this ASColor. @see #darker()

factor

the birghter factor 0 to 1, default is 0.7

returns

a new ASColor object that is a brighter version of this ASColor.

function changeAlpha(newAlpha:Float): ASColor

Create a new ASColor with another alpha but same rgb.

newAlpha

the new alpha

returns

the new ASColor

function changeHue(newHue:Float): ASColor

Create a new ASColor with just change hue channel value.

newHue

the new hue value

returns

the new ASColor

function changeLuminance(newLuminance:Float): ASColor

Create a new ASColor with just change luminance channel value.

newLuminance

the new luminance value

returns

the new ASColor

function changeSaturation(newSaturation:Float): ASColor

Create a new ASColor with just change saturation channel value.

newSaturation

the new saturation value

returns

the new ASColor

function clone(): ASColor

Clone a ASColor, most time you dont need to call this because ASColor is un-mutable class, but to avoid UIResource, you can call this.

function darker(?factor:Float = 0.7f): ASColor

Creates a new ASColor that is a darker version of this ASColor. @see #brighter()

factor

the darker factor(0, 1), default is 0.7

returns

a new ASColor object that is a darker version of this ASColor.

function equals(o:Dynamic): Bool

Compare if compareTo object has the same value as this ASColor object does

compareTo

the object to compare with

returns

a Boolean value that indicates if the compareTo object's value is the same as this one

function getARGB(): Int

Returns the ARGB value representing the color.

function getBlue(): Int

Returns the blue component in the range 0-255.

returns

the blue component.

function getGreen(): Int

Returns the green component in the range 0-255.

returns

the green component.

function getHue(): Float

Returns the hue component in the range [0, 1].

returns

the hue component.

function getLuminance(): Float

Returns the luminance component in the range [0, 1].

returns

the luminance component.

function getRed(): Int

Returns the red component in the range 0-255.

returns

the red component.

function getSaturation(): Float

Returns the saturation component in the range [0, 1].

returns

the saturation component.

function offsetHLS(hOffset:Float, lOffset:Float, sOffset:Float): ASColor

Create a new ASColor with just offset the hue luminace and saturation channel values.

hOffset

offset for hue

lOffset

offset for luminance

sOffset

offset for saturation

returns

the new ASColor offseted

function scaleHLS(hScale:Float, lScale:Float, sScale:Float): ASColor

Create a new ASColor with just scale the hue luminace and saturation channel values.

hScale

scale for hue

lScale

scale for luminance

sScale

scale for saturation

returns

the new ASColor scaled

function toString(): String