API Documentation for: 0.8.0
Show:

ColorMatrix Class

Defined in: ColorMatrix:41
Module: EaselJS

Provides helper functions for assembling a matrix for use with the ColorMatrixFilter. Most methods return the instance to facilitate chained calls.

Example

 myColorMatrix.adjustHue(20).adjustBrightness(50);

See Filter for an example of how to apply filters, or ColorMatrixFilter for an example of how to use ColorMatrix to change a DisplayObject's color.

Constructor

ColorMatrix

(
  • brightness
  • contrast
  • saturation
  • hue
)

Defined in ColorMatrix:41

Parameters:

Methods

_cleanValue

(
  • value
  • limit
)
protected

Defined in _cleanValue:357

Make sure values are within the specified range, hue has a limit of 180, brightness is 255, others are 100.

Parameters:

  • value Number

    The raw number

  • limit Number

    The maximum that the number can be. The minimum is the limit * -1.

_fixMatrix

(
  • matrix
)
protected

Defined in _fixMatrix:368

Makes sure matrixes are 5x5 (25 long).

Parameters:

_multiplyMatrix

(
  • matrix
)
protected

Defined in _multiplyMatrix:335

Parameters:

adjustBrightness

(
  • value
)
ColorMatrix chainable

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

(
  • brightness
  • contrast
  • saturation
  • hue
)
ColorMatrix chainable

Defined in adjustColor:149

Shortcut method to adjust brightness, contrast, saturation and hue. Equivalent to calling adjustHue(hue), adjustContrast(contrast), adjustBrightness(brightness), adjustSaturation(saturation), in that order.

Parameters:

Returns:

ColorMatrix:

The ColorMatrix instance the method is called on (useful for chaining calls.)

adjustContrast

(
  • value
)
ColorMatrix chainable

Defined in adjustContrast:189

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

(
  • value
)
ColorMatrix chainable

Defined in adjustHue:248

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

(
  • value
)
ColorMatrix chainable

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

Defined in clone:287

Returns a clone of this ColorMatrix.

Returns:

ColorMatrix:

A clone of this ColorMatrix.

concat

(
  • matrix
)
ColorMatrix chainable

Defined in concat:273

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.)

copy

(
  • matrix
)
ColorMatrix chainable

Defined in copy:309

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

() deprecated protected

Defined in initialize:63

REMOVED. Removed in favor of using MySuperClass_constructor. See extend and promote for details.

There is an inheritance tutorial distributed with EaselJS in /tutorials/Inheritance.

reset

() ColorMatrix chainable

Defined in reset:139

Resets the matrix to identity values.

Returns:

ColorMatrix:

The ColorMatrix instance the method is called on (useful for chaining calls.)

setColor

(
  • brightness
  • contrast
  • saturation
  • hue
)
ColorMatrix chainable

Defined in setColor:125

Resets the instance with the specified values.

Parameters:

Returns:

ColorMatrix:

The ColorMatrix instance the method is called on (useful for chaining calls.)

toArray

() Array

Defined in toArray:296

Return a length 25 (5x5) array instance containing this matrix's values.

Returns:

Array:

An array holding this matrix's values.

toString

() String

Defined in toString:324

Returns a string representation of this object.

Returns:

String:

a string representation of the instance.

Properties

DELTA_INDEX

Array protected static

Defined in DELTA_INDEX:78

Array of delta values for contrast calculations.

IDENTITY_MATRIX

Array protected static

Defined in IDENTITY_MATRIX:99

Identity matrix values.

LENGTH

Number protected static

Defined in LENGTH:114

The constant length of a color matrix.