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);
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)
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
-
_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
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 matrixParameters:
Name Type Description multiply
boolean refer to ._loadMatrix() method
-
brightness(b, multiply)
-
Adjusts brightness
Parameters:
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)
Parameters:
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 downParameters:
Name Type Description amount
number value of the contrast
multiply
boolean refer to ._loadMatrix() method
-
desaturate(multiply)
-
Desaturate image (remove color)
Call the saturate function
Parameters:
Name Type Description multiply
boolean refer to ._loadMatrix() method
-
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
-
hue(rotation, multiply)
-
Set the hue property of the color
Parameters:
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)
Parameters:
Name Type Description multiply
boolean refer to ._loadMatrix() method
-
negative(multiply)
-
Negative image (inverse of classic rgb matrix)
Parameters:
Name Type Description multiply
boolean refer to ._loadMatrix() method
-
polaroid(multiply)
-
Polaroid filter
Parameters:
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 sharpnessParameters:
Name Type Description amount
number multiply
boolean refer to ._loadMatrix() method
-
sepia(multiply)
-
Sepia image
Parameters:
Name Type Description multiply
boolean refer to ._loadMatrix() method
-
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
-
toBGR(multiply)
-
Filter who transforms : Red -> Blue and Blue -> Red
Parameters:
Name Type Description multiply
boolean refer to ._loadMatrix() method