Class: FilterSystem
Defined in: node_modules/pixi.js/lib/filters/FilterSystem.d.ts:50
System that manages the filter pipeline
Advanced
Implements
Constructors
Constructor
> new FilterSystem(renderer): FilterSystem
Defined in: node_modules/pixi.js/lib/filters/FilterSystem.d.ts:63
Parameters
renderer
WebGLRenderer<HTMLCanvasElement> | WebGPURenderer<HTMLCanvasElement>
Returns
FilterSystem
Properties
renderer
> readonly renderer: WebGLRenderer<HTMLCanvasElement> | WebGPURenderer<HTMLCanvasElement>
Defined in: node_modules/pixi.js/lib/filters/FilterSystem.d.ts:56
Accessors
activeBackTexture
Get Signature
> get activeBackTexture(): Texture<TextureSource<any>> | undefined
Defined in: node_modules/pixi.js/lib/filters/FilterSystem.d.ts:68
The back texture of the currently active filter. Requires the filter to have blendRequired set to true.
Returns
Texture<TextureSource<any>> | undefined
Methods
applyFilter()
> applyFilter(filter, input, output, clear): void
Defined in: node_modules/pixi.js/lib/filters/FilterSystem.d.ts:122
Applies a filter to a texture.
Parameters
filter
The filter to apply.
input
The input texture.
output
The output render surface.
clear
boolean
Whether to clear the output surface before applying the filter.
Returns
void
calculateSpriteMatrix()
> calculateSpriteMatrix(outputMatrix, sprite): Matrix
Defined in: node_modules/pixi.js/lib/filters/FilterSystem.d.ts:131
Multiply input normalized coordinates to this matrix to get sprite texture normalized coordinates.
Use outputMatrix * vTextureCoord in the shader.
Parameters
outputMatrix
The matrix to output to.
sprite
The sprite to map to.
Returns
The mapped matrix.
destroy()
> destroy(): void
Defined in: node_modules/pixi.js/lib/filters/FilterSystem.d.ts:132
Generic destroy methods to be overridden by the subclass
Returns
void
Implementation of
generateFilteredTexture()
> generateFilteredTexture(params): Texture
Defined in: node_modules/pixi.js/lib/filters/FilterSystem.d.ts:102
Applies filters to a texture.
This method takes a texture and a list of filters, applies the filters to the texture, and returns the resulting texture.
Parameters
params
The parameters for applying filters.
filters
Filter[]
The filters to apply.
texture
The texture to apply filters to.
Returns
The resulting texture after all filters have been applied.
Example
// Create a texture and a list of filters
const texture = new Texture(...);
const filters = [new BlurFilter(), new ColorMatrixFilter()];
// Apply the filters to the texture
const resultTexture = filterSystem.applyToTexture({ texture, filters });
// Use the resulting texture
sprite.texture = resultTexture;
Key Points:
- padding is not currently supported here - so clipping may occur with filters that use padding.
- If all filters are disabled or skipped, the original texture is returned.
getBackTexture()
> getBackTexture(lastRenderSurface, bounds, previousBounds?): Texture<TextureSource<any>>
Defined in: node_modules/pixi.js/lib/filters/FilterSystem.d.ts:114
Copies the last render surface to a texture.
Parameters
lastRenderSurface
The last render surface to copy from.
bounds
The bounds of the area to copy.
previousBounds?
The previous bounds to use for offsetting the copy.
Returns
Texture<TextureSource<any>>
pop()
> pop(): void
Defined in: node_modules/pixi.js/lib/filters/FilterSystem.d.ts:107
Internal
Returns
void
push()
> push(instruction): void
Defined in: node_modules/pixi.js/lib/filters/FilterSystem.d.ts:74
Internal
Pushes a filter instruction onto the filter stack.
Parameters
instruction
The instruction containing the filter effect and container.
Returns
void