Class: ColorMatrixFilter

PIXI.filters. 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!

 let colorMatrix = new PIXI.ColorMatrixFilter();
 container.filters = [colorMatrix];
 colorMatrix.contrast(2);

new PIXI.filters.ColorMatrixFilter()

Author:

Extends

Members

matrix

Sets the matrix directly.

Methods

_loadMatrix(matrix, multiply)

Transforms current matrix and set the new one

Name Type Default Description
matrix Array.<number>

5x4 matrix

multiply boolean false

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

inherited apply(filterManager, input, output, clear)

Applies the filter

Name Type Description
filterManager PIXI.FilterManager

The renderer to retrieve the filter from

input PIXI.RenderTarget

The input render target.

output PIXI.RenderTarget

The target to output to.

clear boolean

Should the output be cleared before rendering to it

Set the black and white matrice.

Name Type Description
multiply boolean

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

Adjusts brightness

Name Type Description
b number

value of the brigthness (0-1, where 0 is black)

multiply boolean

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

Brown delicious browni filter (thanks Dominic Szablewski)

Name Type Description
multiply boolean

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

colorTone(desaturation, toned, lightColor, darkColor, multiply)

We don't know exactly what it does, kind of gradient map, but funny to play with!

Name Type Description
desaturation number

Tone values.

toned number

Tone values.

lightColor string

Tone values, example: 0xFFE580

darkColor string

Tone values, example: 0xFFE580

multiply boolean

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

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

Name Type Description
amount number

value of the contrast (0-1)

multiply boolean

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

Desaturate image (remove color)

Call the saturate function

Set the matrices in grey scales

Name Type Description
scale number

value of the grey (0-1, where 0 is black)

multiply boolean

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

Set the hue property of the color

Name Type Description
rotation number

in degrees

multiply boolean

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

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

Name Type Description
multiply boolean

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

LSD effect

Multiply the current matrix

Name Type Description
multiply boolean

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

Negative image (inverse of classic rgb matrix)

Name Type Description
multiply boolean

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

Night effect

Name Type Description
intensity number

The intensity of the night effect.

multiply boolean

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

Polaroid filter

Name Type Description
multiply boolean

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

Predator effect

Erase the current matrix by setting a new indepent one

Name Type Description
amount number

how much the predator feels his future victim

multiply boolean

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

Erase the current matrix by setting the default one

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

Name Type Default Description
amount number 0

The saturation amount (0-1)

multiply boolean

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

Sepia image

Name Type Description
multiply boolean

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

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

Name Type Description
multiply boolean

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

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

Name Type Description
multiply boolean

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

Vintage filter (thanks Dominic Szablewski)

Name Type Description
multiply boolean

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