PIXI.filters.ColorMatrixFilter
class ColorMatrixFilter extends PIXI.Filter
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.filters.ColorMatrixFilter();
container.filters = [colorMatrix];
colorMatrix.contrast(2);
Summary
Properties from ColorMatrixFilter
number |
The opacity value to use when mixing the original and resultant colors. |
Array<number> |
|
Methods from ColorMatrixFilter
void |
|
void |
|
void |
|
void |
|
void |
|
void |
Desaturate image (remove color) Call the saturate function |
void |
|
void |
|
void |
|
void |
LSD effect |
void |
|
void |
|
void |
|
void |
Predator effect |
void |
Erase the current matrix by setting the default one. |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Properties inherited from Filter
boolean |
|
PIXI.BLEND_MODES |
|
boolean |
If enabled is true the filter is applied, if false it will not. |
boolean |
|
PIXI.MSAA_QUALITY |
The samples of the filter. |
number |
|
number |
|
PIXI.State |
The WebGL state the filter requires to render. |
Properties inherited from Shader
PIXI.Program |
Program that the shader uses. |
Dict<any> |
|
Methods inherited from Filter
void |
|
Public Properties
alpha: number = 1
The opacity value to use when mixing the original and resultant colors.
When the value is 0, the original color is used without modification. When the value is 1, the result color is used. When in the range (0, 1) the color is interpolated between the original and result by this amount.
matrix: Array<number> = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]
The matrix of the color matrix filter
Public Methods
blackAndWhite(multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
brightness(b: number, multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
browni(multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
colorTone(desaturation: number, toned: number, lightColor: number, darkColor: number, multiply: boolean) → {void}
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 | number |
Tone values, example: |
darkColor | number |
Tone values, example: |
multiply | boolean |
if true, current matrix and matrix are multiplied. If false, just set the current matrix with @param matrix |
Type | Description |
---|---|
void |
contrast(amount: number, multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
desaturate() → {void}
Desaturate image (remove color) Call the saturate function
Type | Description |
---|---|
void |
greyscale(scale: number, multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
hue(rotation: number, multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
kodachrome(multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
lsd(multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
negative(multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
night(intensity: number, multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
polaroid(multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
predator(amount: number, multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
reset() → {void}
Erase the current matrix by setting the default one.
Type | Description |
---|---|
void |
saturate(amount: number, multiply: boolean) → {void}
Set the saturation matrix, increase the separation between colors Increase saturation : increase contrast, brightness, and sharpness
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
amount | number | 0 |
The saturation amount (0-1) |
|
multiply | boolean |
<optional> |
if true, current matrix and matrix are multiplied. If false, just set the current matrix with @param matrix |
Type | Description |
---|---|
void |
sepia(multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
technicolor(multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
tint(color: number, multiply: boolean) → {void}
Sets each channel on the diagonal of the color matrix. This can be used to achieve a tinting effect on Containers similar to the tint field of some display objects like Sprite, Text, Graphics, and Mesh.
Name | Type | Attributes | Description |
---|---|---|---|
color | number |
Color of the tint. This is a hex value. |
|
multiply | boolean |
<optional> |
if true, current matrix and matrix are multiplied. If false, just set the current matrix with @param matrix |
Type | Description |
---|---|
void |
toBGR(multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |
vintage(multiply: boolean) → {void}
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 |
Type | Description |
---|---|
void |