API Documentation for: 0.7.1
Show:

ColorMatrix Class

Defined in: ColorMatrix:39
Module: EaselJS

Provides helper functions for assembling a matrix for use with the ColorMatrixFilter, or can be used directly as the matrix for a 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:39

Parameters:

Methods

_cleanValue

(
  • value
  • limit
)
protected

Defined in _cleanValue:332

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:344

Makes sure matrixes are 5x5 (25 long).

Parameters:

_multiplyMatrix

(
  • matrix
)
protected

Defined in _multiplyMatrix:310

Parameters:

adjustBrightness

(
  • value
)
ColorMatrix

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

Defined in adjustColor:131

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

Defined in adjustContrast:169

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

Defined in adjustHue:226

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

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:263

Returns a clone of this ColorMatrix.

Returns:

ColorMatrix:

A clone of this ColorMatrix.

concat

(
  • matrix
)
ColorMatrix

Defined in concat:250

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

(
  • matrix
)
ColorMatrix

Defined in copyMatrix:285

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

(
  • brightness
  • contrast
  • saturation
  • hue
)
protected

Defined in initialize:107

Initialization method.

Parameters:

reset

() ColorMatrix

Defined in reset:122

Resets the matrix to identity values.

Returns:

ColorMatrix:

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

toArray

() Array

Defined in toArray:272

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:299

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:61

Array of delta values for contrast calculations.

IDENTITY_MATRIX

Array protected static

Defined in IDENTITY_MATRIX:82

Identity matrix values.

LENGTH

Number protected static

Defined in LENGTH:97

The constant length of a color matrix.