new 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!
var colorMatrix = new PIXI.ColorMatrixFilter();
container.filters = [colorMatrix];
colorMatrix.contrast(2);
Extends
Members
-
matrixArray.<number>
-
Sets the matrix of the color matrix filter
- Default Value:
- [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]
-
paddingnumber
-
The extra padding that the filter might need
-
uniformsobject
-
The uniforms as an object
Methods
-
_colorMatrix(matrix){Array.<number>}
-
Create a Float32 Array and normalize the offset component to 0-1
Name Type Description matrix
Array.<number> (mat 5x4)
Returns:
Type Description Array.<number> m (mat 5x4) with all values between 0-1 -
_loadMatrix(matrix, multiply)
-
Transforms current matrix and set the new one
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
-
_multiply(out, a, b){Array.<number>}
-
Multiplies two mat5's
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
Returns:
Type Description Array.<number> out (mat 5x4) -
inherited applyFilter(renderer, input, output, clear)
-
Applies the filter
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
-
blackAndWhite(multiply)
-
Set the black and white matrice
Multiply the current matrixName Type Description multiply
boolean refer to ._loadMatrix() method
-
brightness(b, multiply)
-
Adjusts brightness
Name Type Description b
number value of the brigthness (0 is black)
multiply
boolean refer to ._loadMatrix() method
-
browni(multiply)
-
Brown delicious browni filter (thanks Dominic Szablewski)
Name Type Description multiply
boolean refer to ._loadMatrix() method
-
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 downName Type Description amount
number value of the contrast
multiply
boolean refer to ._loadMatrix() method
-
desaturate(multiply)
-
Desaturate image (remove color)
Call the saturate function
Name Type Description multiply
boolean refer to ._loadMatrix() method
-
inherited getShader(renderer)
-
Grabs a shader from the current renderer
Name Type Description renderer
PIXI.WebGLRenderer The renderer to retrieve the shader from
-
greyscale(scale, multiply)
-
Set the matrices in grey scales
Name Type Description scale
number value of the grey (0 is black)
multiply
boolean refer to ._loadMatrix() method
-
hue(rotation, multiply)
-
Set the hue property of the color
Name Type Description rotation
number in degrees
multiply
boolean refer to ._loadMatrix() method
-
kodachrome(multiply)
-
Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski)
Name Type Description multiply
boolean refer to ._loadMatrix() method
-
negative(multiply)
-
Negative image (inverse of classic rgb matrix)
Name Type Description multiply
boolean refer to ._loadMatrix() method
-
polaroid(multiply)
-
Polaroid filter
Name Type Description multiply
boolean refer to ._loadMatrix() method
-
saturate(amount, multiply)
-
Set the saturation matrix, increase the separation between colors
Increase saturation : increase contrast, brightness, and sharpnessName Type Description amount
number multiply
boolean refer to ._loadMatrix() method
-
sepia(multiply)
-
Sepia image
Name Type Description multiply
boolean refer to ._loadMatrix() method
-
inherited syncUniform()
-
Syncs a uniform between the class object and the shaders.
-
technicolor(multiply)
-
Color motion picture process invented in 1916 (thanks Dominic Szablewski)
Name Type Description multiply
boolean refer to ._loadMatrix() method
-
toBGR(multiply)
-
Filter who transforms : Red -> Blue and Blue -> Red
Name Type Description multiply
boolean refer to ._loadMatrix() method