EaselJS

EaselJS  0.4.2

EaselJS > EaselJS > ColorMatrix
Search:
 
Filters

Class ColorMatrix

Provides helper functions for assembling a matrix for use with the ColorMatrixFilter. Can be used directly as the matrix for a ColorMatrixFilter. Most methods return the instance to facilitate chained calls. Ex. myColorMatrix.adjustHue(20).adjustBrightness(50);

Constructor

ColorMatrix ( brightness , contrast , saturation , hue )
Parameters:
brightness <Number>
contrast <Number>
saturation <Number>
hue <Number>

Properties

DELTA_INDEX - static Array

Array of delta values for contrast calculations.

IDENTITY_MATRIX - static Array

Identity matrix values.

LENGTH - static Number

The constant length of a color matrix.

Methods

_cleanValue

protected void _cleanValue ( )
Make sure values are within the specified range, hue has a limit of 180, brightness is 255, others are 100.
Returns: void

_fixMatrix

protected void _fixMatrix ( )
Makes sure matrixes are 5x5 (25 long).
Returns: void

_multiplyMatrix

protected void _multiplyMatrix ( )
Returns: void

adjustBrightness

ColorMatrix adjustBrightness ( value )
Adjusts the brightness of pixel color by adding the specified value to the red, green and blue channels. Positive values will make the image brighter, negative values will make it darker.
Parameters:
value <Number> A value between -255 & 255 that will be added to the RGB channels.
Returns: ColorMatrix
The ColorMatrix instance the method is called on (useful for chaining calls.)

adjustColor

ColorMatrix adjustColor ( brightness , contrast , saturation , hue )
Shortcut method to adjust brightness, contrast, saturation and hue. Equivalent to calling adjustHue(hue), adjustContrast(contrast), adjustBrightness(brightness), adjustSaturation(saturation), in that order.
Parameters:
brightness <Number>
contrast <Number>
saturation <Number>
hue <Number>
Returns: ColorMatrix
The ColorMatrix instance the method is called on (useful for chaining calls.)

adjustContrast

ColorMatrix adjustContrast ( value )
Adjusts the contrast of pixel color. Positive values will increase contrast, negative values will decrease contrast.
Parameters:
value <Number> A value between -100 & 100.
Returns: ColorMatrix
The ColorMatrix instance the method is called on (useful for chaining calls.)

adjustHue

ColorMatrix adjustHue ( value )
Adjusts the hue of the pixel color.
Parameters:
value <Number> A value between -180 & 180.
Returns: ColorMatrix
The ColorMatrix instance the method is called on (useful for chaining calls.)

adjustSaturation

ColorMatrix adjustSaturation ( value )
Adjusts the color saturation of the pixel. Positive values will increase saturation, negative values will decrease saturation (trend towards greyscale).
Parameters:
value <Number> A value between -100 & 100.
Returns: ColorMatrix
The ColorMatrix instance the method is called on (useful for chaining calls.)

clone

ColorMatrix clone ( )
Returns a clone of this ColorMatrix.
Returns: ColorMatrix
A clone of this ColorMatrix.

concat

ColorMatrix concat ( matrix )
Concatenates (multiplies) the specified matrix with this one.
Parameters:
matrix <Array> An array or ColorMatrix instance.
Returns: ColorMatrix
The ColorMatrix instance the method is called on (useful for chaining calls.)

copyMatrix

ColorMatrix copyMatrix ( matrix )
Copy the specified matrix's values to this matrix.
Parameters:
matrix <Array> An array or ColorMatrix instance.
Returns: ColorMatrix
The ColorMatrix instance the method is called on (useful for chaining calls.)

initialize

protected void initialize ( )
Initialization method.
Returns: void

reset

ColorMatrix reset ( )
Resets the matrix to identity values.
Returns: ColorMatrix
The ColorMatrix instance the method is called on (useful for chaining calls.)

toArray

Array toArray ( )
Return a length 25 (5x5) array instance containing this matrix's values.
Returns: Array
An array holding this matrix's values.