| Package | sekati.utils |
| Class | public class ColorUtil |
See also
| Method | Defined by | ||
|---|---|---|---|
|
ColorUtil Static Constructor
| ColorUtil | ||
|
averageBlue(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):int
[static]
Sample & average the Blue (RGB) value from a display object or one of its region.
| ColorUtil | ||
|
averageGreen(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):int
[static]
Sample & average the Green (RGB) value from a display object or one of its region.
| ColorUtil | ||
|
averageHue(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):int
[static]
Sample & average the Hue (HSL) value from a display object or one of its region.
| ColorUtil | ||
|
averageLightness(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):int
[static]
Sample & average the Lightness (HSL) value from a display object or one of its region.
| ColorUtil | ||
|
averageRed(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):int
[static]
Sample & average the Red (RGB) value from a display object or one of its region.
| ColorUtil | ||
|
averageSaturation(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):Number
[static]
Sample & average the Saturation (HSL) value from a display object or one of its region.
| ColorUtil | ||
|
averageValue(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):Number
[static]
Sample & average the Value (HSV) value from a display object or one of its region.
| ColorUtil | ||
|
changeContrast(hex:Number, inc:Number):Number
[static]
Change the contrast of a hexidecimal Number by a certain increment
| ColorUtil | ||
|
componentsFromHex(hex:uint):Object
[static]
Convert an RGB hexidecimal value to an object containing its R,G,B components.
| ColorUtil | ||
|
getColor(src:DisplayObject, x:uint = 0, y:uint = 0, getAlpha:Boolean = false):uint
[static]
Return the (A)RGB hexadecimal color value of a DisplayObject.
| ColorUtil | ||
|
getHSLComponent(src:DisplayObject, x:uint = 0, y:uint = 0):Object
[static]
Get the HSL components from a DisplayObject.
| ColorUtil | ||
|
getHSVComponent(src:DisplayObject, x:uint = 0, y:uint = 0):Object
[static]
Get the HSV components from a DisplayObject.
| ColorUtil | ||
|
getRGBComponent(src:DisplayObject, x:uint = 0, y:uint = 0):Object
[static]
Get the RGB components from a DisplayObject.
| ColorUtil | ||
|
getTransform(src:DisplayObject):Object
[static]
Returns the transform value set by the last setTransform() call.
| ColorUtil | ||
|
hexFromComponents(r:uint, g:uint, b:uint):uint
[static]
Convert individual R,G,B values to a hexidecimal value.
| ColorUtil | ||
|
hexFromPercentages(rgbObj:Object):uint
[static]
Convert an RGB Object to a hexidecimal color value.
| ColorUtil | ||
|
HSLtoHSV(hue:Number, luminance:Number, saturation:Number):Object
[static]
Convert HSL to HSV using RGB conversions: color preservation may be dubious.
| ColorUtil | ||
|
HSLtoRGB(hue:Number, luminance:Number, saturation:Number):Object
[static]
Convert HSL values to RGB values.
| ColorUtil | ||
|
HSVtoHSL(hue:Number, saturation:Number, value:Number):Object
[static]
Convert HSV to HLS using RGB conversions: color preservation may be dubious.
| ColorUtil | ||
|
HSVtoRGB(hue:Number, saturation:Number, value:Number):Object
[static]
Convert HSV values to RGB values.
| ColorUtil | ||
|
HueToRGB(min:Number, max:Number, hue:Number):Object
[static]
Convert hue to RGB values using a linear transformation.
| ColorUtil | ||
|
invertColor(src:DisplayObject):void
[static]
Inverts the color of the DisplayObject.
| ColorUtil | ||
|
randomColor():uint
[static]
Generate a random hexidecimal color.
| ColorUtil | ||
|
resetColor(src:DisplayObject):void
[static]
Reset the color of the DisplayObject to its original view (pre-ColorTransformed).
| ColorUtil | ||
|
RGBtoHSL(red:Number, green:Number, blue:Number):Object
[static]
Convert an RGB Hexidecimal value to HSL values
| ColorUtil | ||
|
RGBtoHSV(red:Number, green:Number, blue:Number):Object
[static]
Convert RGB values to HSV values.
| ColorUtil | ||
|
RGBToHue(red:Number, green:Number, blue:Number):uint
[static]
Convert RGB values to a hue using a linear transformation.
| ColorUtil | ||
|
setColor(src:DisplayObject, hex:uint):void
[static]
Set the (A)RGB hexadecimal color value of a DisplayObject using ColorTransform.
| ColorUtil | ||
|
setHSLComponent(src:DisplayObject, h:Number, l:Number, s:Number):void
[static]
Set the color of a DisplayObject from HSL components.
| ColorUtil | ||
|
setHSVComponent(src:DisplayObject, h:Number, s:Number, v:Number):void
[static]
Set the color of a DisplayObject from HSV components.
| ColorUtil | ||
|
setRGBComponent(src:DisplayObject, r:Number, g:Number, b:Number):void
[static]
Set the color of a DisplayObject from RGB components.
| ColorUtil | ||
|
setTransform(src:DisplayObject, transformObject:Object):void
[static]
Set ColorTransform information for a DisplayObject.
| ColorUtil | ||
|
toColor(str:String):uint
[static]
Parse a String representation of a color (hex or html) to uint.
| ColorUtil | ||
|
toHexString(hex:uint):String
[static]
Convert a hexidecimal number to a string representation with ECMAScript notation:
0xrrggbb. | ColorUtil | ||
|
toHTML(hex:uint):String
[static]
Convert a hexidecimal number to a string representation with HTML notation:
#rrggbb. | ColorUtil | ||
| Constant | Defined by | ||
|---|---|---|---|
| HUE_MAX : uint = 360 [static]
| ColorUtil | ||
| PCT_MAX : uint = 100 [static]
| ColorUtil | ||
| RGB_MAX : uint = 256 [static]
| ColorUtil | ||
| ColorUtil | () | constructor |
public function ColorUtil()ColorUtil Static Constructor
| averageBlue | () | method |
public static function averageBlue(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):intSample & average the Blue (RGB) value from a display object or one of its region.
Parameterssrc:DisplayObject — of the display object.
|
|
accuracy:Number (default = 0.01) — percentage of pixels to sample when averaging.
|
|
region:Rectangle (default = null) — to sample from [Default: null = entire src object].
|
int — the sampled average blue value on a scale of 0-255.
|
| averageGreen | () | method |
public static function averageGreen(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):intSample & average the Green (RGB) value from a display object or one of its region.
Parameterssrc:DisplayObject — of the display object.
|
|
accuracy:Number (default = 0.01) — percentage of pixels to sample when averaging.
|
|
region:Rectangle (default = null) — to sample from [Default: null = entire src object].
|
int — the sampled average green value on a scale of 0-255.
|
| averageHue | () | method |
public static function averageHue(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):intSample & average the Hue (HSL) value from a display object or one of its region.
Parameterssrc:DisplayObject — of the display object.
|
|
accuracy:Number (default = 0.01) — percentage of pixels to sample when averaging.
|
|
region:Rectangle (default = null) — to sample from [Default: null = entire src object].
|
int — the sampled average hue value on a scale of 0-360.
|
| averageLightness | () | method |
public static function averageLightness(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):intSample & average the Lightness (HSL) value from a display object or one of its region.
Parameterssrc:DisplayObject — of the display object.
|
|
accuracy:Number (default = 0.01) — percentage of pixels to sample when averaging.
|
|
region:Rectangle (default = null) — to sample from [Default: null = entire src object].
|
int — the sampled average lightness value on a scale of 0-255.
|
| averageRed | () | method |
public static function averageRed(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):intSample & average the Red (RGB) value from a display object or one of its region.
Parameterssrc:DisplayObject — of the display object.
|
|
accuracy:Number (default = 0.01) — percentage of pixels to sample when averaging.
|
|
region:Rectangle (default = null) — to sample from [Default: null = entire src object].
|
int — the sampled average red value on a scale of 0-255.
|
| averageSaturation | () | method |
public static function averageSaturation(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):NumberSample & average the Saturation (HSL) value from a display object or one of its region.
Parameterssrc:DisplayObject — of the display object.
|
|
accuracy:Number (default = 0.01) — percentage of pixels to sample when averaging.
|
|
region:Rectangle (default = null) — to sample from [Default: null = entire src object].
|
Number — the sampled average saturation value on a scale of 0-1.
|
| averageValue | () | method |
public static function averageValue(src:DisplayObject, accuracy:Number = 0.01, region:Rectangle = null):NumberSample & average the Value (HSV) value from a display object or one of its region.
Parameterssrc:DisplayObject — of the display object.
|
|
accuracy:Number (default = 0.01) — percentage of pixels to sample when averaging.
|
|
region:Rectangle (default = null) — to sample from [Default: null = entire src object].
|
Number — the sampled average lightness value on a scale of 0-1.
|
| changeContrast | () | method |
public static function changeContrast(hex:Number, inc:Number):NumberChange the contrast of a hexidecimal Number by a certain increment
Parametershex:Number — color value to shift contrast on
|
|
inc:Number — increment value to shift
|
Number — new hex color value
|
| componentsFromHex | () | method |
public static function componentsFromHex(hex:uint):ObjectConvert an RGB hexidecimal value to an object containing its R,G,B components. TODO - refactor to getRGB or toRGBComponents
Parametershex:uint |
Object |
| getColor | () | method |
public static function getColor(src:DisplayObject, x:uint = 0, y:uint = 0, getAlpha:Boolean = false):uintReturn the (A)RGB hexadecimal color value of a DisplayObject.
Parameterssrc:DisplayObject — of the display object.
|
|
x:uint (default = 0) — position to sample.
|
|
y:uint (default = 0) — position to sample.
|
|
getAlpha:Boolean (default = false) — if true return is RGBA, else RGB.
|
uint |
| getHSLComponent | () | method |
public static function getHSLComponent(src:DisplayObject, x:uint = 0, y:uint = 0):ObjectGet the HSL components from a DisplayObject.
Parameterssrc:DisplayObject — to sample color from.
|
|
x:uint (default = 0) — location to sample.
|
|
y:uint (default = 0) — location to sample.
|
Object — component object.
|
| getHSVComponent | () | method |
public static function getHSVComponent(src:DisplayObject, x:uint = 0, y:uint = 0):ObjectGet the HSV components from a DisplayObject.
Parameterssrc:DisplayObject — to sample color from.
|
|
x:uint (default = 0) — location to sample.
|
|
y:uint (default = 0) — location to sample.
|
Object — component object.
|
| getRGBComponent | () | method |
public static function getRGBComponent(src:DisplayObject, x:uint = 0, y:uint = 0):ObjectGet the RGB components from a DisplayObject.
Parameterssrc:DisplayObject — to sample color from.
|
|
x:uint (default = 0) — location to sample.
|
|
y:uint (default = 0) — location to sample.
|
Object — component object.
|
| getTransform | () | method |
public static function getTransform(src:DisplayObject):ObjectReturns the transform value set by the last setTransform() call.
Parameterssrc:DisplayObject |
Object — An object containing the current offset and percentage values for the color.
|
| hexFromComponents | () | method |
public static function hexFromComponents(r:uint, g:uint, b:uint):uintConvert individual R,G,B values to a hexidecimal value.
Parametersr:uint |
|
g:uint |
|
b:uint |
uint |
| hexFromPercentages | () | method |
public static function hexFromPercentages(rgbObj:Object):uintConvert an RGB Object to a hexidecimal color value.
ParametersrgbObj:Object |
uint |
| HSLtoHSV | () | method |
public static function HSLtoHSV(hue:Number, luminance:Number, saturation:Number):ObjectConvert HSL to HSV using RGB conversions: color preservation may be dubious.
Parametershue:Number |
|
luminance:Number |
|
saturation:Number |
Object |
| HSLtoRGB | () | method |
public static function HSLtoRGB(hue:Number, luminance:Number, saturation:Number):ObjectConvert HSL values to RGB values.
Parametershue:Number — 0 to 360.
|
|
luminance:Number — 0 to 1.
|
|
saturation:Number — 0 to 1.
|
Object — Object with R,G,B values on 0 to 1 scale.
|
| HSVtoHSL | () | method |
public static function HSVtoHSL(hue:Number, saturation:Number, value:Number):ObjectConvert HSV to HLS using RGB conversions: color preservation may be dubious.
Parametershue:Number |
|
saturation:Number |
|
value:Number |
Object |
| HSVtoRGB | () | method |
public static function HSVtoRGB(hue:Number, saturation:Number, value:Number):ObjectConvert HSV values to RGB values.
Parametershue:Number — on 0 to 360 scale.
|
|
saturation:Number — on 0 to 1 scale.
|
|
value:Number — on 0 to 1 scale.
|
Object — Object with R,G,B values on 0 to 1 scale.
|
| HueToRGB | () | method |
public static function HueToRGB(min:Number, max:Number, hue:Number):ObjectConvert hue to RGB values using a linear transformation.
Parametersmin:Number — of R,G,B.
|
|
max:Number — of R,G,B.
|
|
hue:Number — value angle hue.
|
Object — Object with R,G,B properties on 0-1 scale.
|
| invertColor | () | method |
public static function invertColor(src:DisplayObject):voidInverts the color of the DisplayObject.
Parameterssrc:DisplayObject |
| randomColor | () | method |
public static function randomColor():uintGenerate a random hexidecimal color.
Returnsuint |
See also
| resetColor | () | method |
public static function resetColor(src:DisplayObject):voidReset the color of the DisplayObject to its original view (pre-ColorTransformed).
Parameterssrc:DisplayObject |
| RGBtoHSL | () | method |
public static function RGBtoHSL(red:Number, green:Number, blue:Number):ObjectConvert an RGB Hexidecimal value to HSL values
Parametersred:Number — 0 - 1 scale.
|
|
green:Number — 0 - 1 scale.
|
|
blue:Number — 0 - 1 scale.
|
Object — Object with h (hue), l (lightness), s (saturation) values:
|
| RGBtoHSV | () | method |
public static function RGBtoHSV(red:Number, green:Number, blue:Number):ObjectConvert RGB values to HSV values.
Parametersred:Number — 0 to 1 scale.
|
|
green:Number — 0 to 1 scale.
|
|
blue:Number — 0 to 1 scale.
|
Object — Object with H,S,V values:
|
| RGBToHue | () | method |
public static function RGBToHue(red:Number, green:Number, blue:Number):uintConvert RGB values to a hue using a linear transformation.
Parametersred:Number — value on 0 to 1 scale.
|
|
green:Number — value on 0 to 1 scale.
|
|
blue:Number — value on 0 to 1 scale.
|
uint — hue degree between 0 and 360.
|
| setColor | () | method |
public static function setColor(src:DisplayObject, hex:uint):voidSet the (A)RGB hexadecimal color value of a DisplayObject using ColorTransform.
Parameterssrc:DisplayObject |
|
hex:uint |
| setHSLComponent | () | method |
public static function setHSLComponent(src:DisplayObject, h:Number, l:Number, s:Number):voidSet the color of a DisplayObject from HSL components.
Parameterssrc:DisplayObject |
|
h:Number |
|
l:Number |
|
s:Number |
| setHSVComponent | () | method |
public static function setHSVComponent(src:DisplayObject, h:Number, s:Number, v:Number):voidSet the color of a DisplayObject from HSV components.
Parameterssrc:DisplayObject |
|
h:Number |
|
s:Number |
|
v:Number |
| setRGBComponent | () | method |
public static function setRGBComponent(src:DisplayObject, r:Number, g:Number, b:Number):voidSet the color of a DisplayObject from RGB components.
Parameterssrc:DisplayObject |
|
r:Number |
|
g:Number |
|
b:Number |
| setTransform | () | method |
public static function setTransform(src:DisplayObject, transformObject:Object):voidSet ColorTransform information for a DisplayObject.
The colorTransformObject parameter is a generic object that you create from the new Object constructor. It has parameters specifying the percentage and offset values for the red, green, blue, and alpha (transparency) components of a color, entered in the format 0xRRGGBBAA.
Parameterssrc:DisplayObject — An object created with the new Object constructor. This instance of the Object class must have the following properties
that specify color transform values: ra, rb, ga, gb, ba, bb, aa, ab. These properties are explained in the above summary for the setTransform() method.
|
|
transformObject:Object |
| toColor | () | method |
public static function toColor(str:String):uintParse a String representation of a color (hex or html) to uint.
Parametersstr:String |
uint |
| toHexString | () | method |
public static function toHexString(hex:uint):String
Convert a hexidecimal number to a string representation with ECMAScript notation: 0xrrggbb.
hex:uint |
String |
| toHTML | () | method |
public static function toHTML(hex:uint):String
Convert a hexidecimal number to a string representation with HTML notation: #rrggbb.
hex:uint |
String |
| HUE_MAX | constant |
public static const HUE_MAX:uint = 360
| PCT_MAX | constant |
public static const PCT_MAX:uint = 100
| RGB_MAX | constant |
public static const RGB_MAX:uint = 256