API Documentation for: 0.6.0
Show:

ColorMatrixFilter Class

Extends Filter
Defined in: ColorMatrixFilter:34
Module: EaselJS

Allows you to carry out complex color operations such as modifying saturation, brightness, or inverting. See the ColorMatrix for more information on changing colors.

See Filter for an example of how to apply filters.

Constructor

ColorMatrixFilter

(
  • matrix
)

Parameters:

  • matrix Array

    A 4x5 matrix describing the color operation to perform. See also the ColorMatrix class.

Methods

applyFilter

(
  • ctx
  • x
  • y
  • width
  • height
  • targetCtx
  • targetX
  • targetY
)
Boolean

Inherited from Filter but overwritten in applyFilter:64

Applies the filter to the specified context.

Parameters:

  • ctx CanvasRenderingContext2D

    The 2D context to use as the source.

  • x Number

    The x position to use for the source rect.

  • y Number

    The y position to use for the source rect.

  • width Number

    The width to use for the source rect.

  • height Number

    The height to use for the source rect.

  • targetCtx CanvasRenderingContext2D

    Optional. The 2D context to draw the result to. Defaults to the context passed to ctx.

  • targetX Number

    Optional. The x position to draw the result to. Defaults to the value passed to x.

  • targetY Number

    Optional. The y position to draw the result to. Defaults to the value passed to y.

Returns:

clone

() ColorMatrixFilter

Inherited from Filter but overwritten in clone:121

Returns a clone of this ColorMatrixFilter instance.

Returns:

ColorMatrixFilter: A clone of the current ColorMatrixFilter instance.

getBounds

() Rectangle

Inherited from Filter: getBounds:73

Returns a rectangle with values indicating the margins required to draw the filter. For example, a filter that will extend the drawing area 4 pixels to the left, and 7 pixels to the right (but no pixels up or down) would return a rectangle with (x=-4, y=0, width=11, height=0).

Returns:

Rectangle: a rectangle object indicating the margins required to draw the filter.

initialize

(
  • matrix
)
protected

Inherited from Filter but overwritten in initialize:54

Parameters:

  • matrix Array

    A 4x5 matrix describing the color operation to perform.

toString

() String

Inherited from Filter but overwritten in toString:111

Returns a string representation of this object.

Returns:

String: a string representation of the instance.