LogoPixi’VN
pixi-jsClasses

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

Filter

The filter to apply.

input

Texture

The input texture.

output

RenderSurface

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

Matrix

The matrix to output to.

sprite

Sprite

The sprite to map to.

Returns

Matrix

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

System.destroy


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

Texture

The texture to apply filters to.

Returns

Texture

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:

  1. padding is not currently supported here - so clipping may occur with filters that use padding.
  2. 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

RenderTarget

The last render surface to copy from.

bounds

Bounds

The bounds of the area to copy.

previousBounds?

Bounds

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

FilterInstruction

The instruction containing the filter effect and container.

Returns

void