Class: ColorMatrixFilter

ColorMatrixFilter


new ColorMatrixFilter()

The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA
color and alpha values of every pixel on your displayObject to produce a result
with a new set of RGBA color and alpha values. It's pretty powerful!

 var colorMatrix = new ColorMatrixFilter();
 container.filters = [colorMatrix];
 colorMatrix.contrast(2);
Author:
Source:

Extends

Members


padding :number

The extra padding that the filter might need

Type:
  • number
Inherited From:
Source:

uniforms :object

The uniforms as an object

Type:
  • object
Inherited From:
Source:

Methods


_colorMatrix(matrix)

Create a Float32 Array and normalize the offset component to 0-1

Parameters:
Name Type Description
matrix Array.<number>

(mat 5x4)

Source:
Returns:

m (mat 5x4) with all values between 0-1

Type
Array.<number>

_loadMatrix(matrix, multiply)

Transforms current matrix and set the new one

Parameters:
Name Type Description
matrix Array.<number>

(mat 5x4)

multiply boolean

if true, current matrix and matrix are multiplied. If false, just set the current matrix with @param matrix

Source:

_multiply(out, a, b)

Multiplies two mat5's

Parameters:
Name Type Description
out Array.<number>

(mat 5x4) the receiving matrix

a Array.<number>

(mat 5x4) the first operand

b Array.<number>

(mat 5x4) the second operand

Source:
Returns:

out (mat 5x4)

Type
Array.<number>

applyFilter(renderer, input, output, clear)

Applies the filter

Parameters:
Name Type Description
renderer PIXI.WebGLRenderer

The renderer to retrieve the filter from

input PIXI.RenderTarget
output PIXI.RenderTarget
clear boolean

Whether or not we want to clear the outputTarget

Inherited From:
Source:

blackAndWhite(multiply)

Set the black and white matrice
Multiply the current matrix

Parameters:
Name Type Description
multiply boolean

refer to ._loadMatrix() method

Source:

brightness(b, multiply)

Adjusts brightness

Parameters:
Name Type Description
b number

value of the brigthness (0 is black)

multiply boolean

refer to ._loadMatrix() method

Source:

browni(multiply)

Brown delicious browni filter (thanks Dominic Szablewski)

Parameters:
Name Type Description
multiply boolean

refer to ._loadMatrix() method

Source:

contrast(amount, multiply)

Set the contrast matrix, increase the separation between dark and bright
Increase contrast : shadows darker and highlights brighter
Decrease contrast : bring the shadows up and the highlights down

Parameters:
Name Type Description
amount number

value of the contrast

multiply boolean

refer to ._loadMatrix() method

Source:

desaturate(multiply)

Desaturate image (remove color)

Call the saturate function

Parameters:
Name Type Description
multiply boolean

refer to ._loadMatrix() method

Source:

getShader(renderer)

Grabs a shader from the current renderer

Parameters:
Name Type Description
renderer PIXI.WebGLRenderer

The renderer to retrieve the shader from

Inherited From:
Source:

greyscale(scale, multiply)

Set the matrices in grey scales

Parameters:
Name Type Description
scale number

value of the grey (0 is black)

multiply boolean

refer to ._loadMatrix() method

Source:

hue(rotation, multiply)

Set the hue property of the color

Parameters:
Name Type Description
rotation number

in degrees

multiply boolean

refer to ._loadMatrix() method

Source:

kodachrome(multiply)

Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski)

Parameters:
Name Type Description
multiply boolean

refer to ._loadMatrix() method

Source:

negative(multiply)

Negative image (inverse of classic rgb matrix)

Parameters:
Name Type Description
multiply boolean

refer to ._loadMatrix() method

Source:

polaroid(multiply)

Polaroid filter

Parameters:
Name Type Description
multiply boolean

refer to ._loadMatrix() method

Source:

saturate(amount, multiply)

Set the saturation matrix, increase the separation between colors
Increase saturation : increase contrast, brightness, and sharpness

Parameters:
Name Type Description
amount number
multiply boolean

refer to ._loadMatrix() method

Source:

sepia(multiply)

Sepia image

Parameters:
Name Type Description
multiply boolean

refer to ._loadMatrix() method

Source:

syncUniform()

Syncs a uniform between the class object and the shaders.

Inherited From:
Source:

technicolor(multiply)

Color motion picture process invented in 1916 (thanks Dominic Szablewski)

Parameters:
Name Type Description
multiply boolean

refer to ._loadMatrix() method

Source:

toBGR(multiply)

Filter who transforms : Red -> Blue and Blue -> Red

Parameters:
Name Type Description
multiply boolean

refer to ._loadMatrix() method

Source: