Class: CanvasTextSystem
Defined in: node_modules/pixi.js/lib/scene/text/shared/GpuTextSystem.d.ts:9
System plugin to the renderer to manage canvas text for GPU renderers.
Advanced
Extends
Constructors
Constructor
> new CanvasTextSystem(renderer): CanvasTextSystem
Defined in: node_modules/pixi.js/lib/scene/text/shared/GpuTextSystem.d.ts:15
Parameters
renderer
Returns
CanvasTextSystem
Overrides
AbstractTextSystem.constructor
Properties
_renderer
> protected readonly _renderer: Renderer
Defined in: node_modules/pixi.js/lib/scene/text/shared/AbstractTextSystem.d.ts:12
Inherited from
Methods
decreaseReferenceCount()
> decreaseReferenceCount(textKey): void
Defined in: node_modules/pixi.js/lib/scene/text/shared/AbstractTextSystem.d.ts:59
Decreases the reference count for a texture associated with a text key. When the reference count reaches zero, the texture is returned to the pool.
Parameters
textKey
string
The unique key identifying the text style configuration
Returns
void
Remarks
This method is crucial for memory management, ensuring textures are properly cleaned up when they are no longer needed by any Text instances.
Inherited from
AbstractTextSystem.decreaseReferenceCount
destroy()
> destroy(): void
Defined in: node_modules/pixi.js/lib/scene/text/shared/AbstractTextSystem.d.ts:78
Generic destroy methods to be overridden by the subclass
Returns
void
Inherited from
getManagedTexture()
> getManagedTexture(text): Texture<TextureSource<any>>
Defined in: node_modules/pixi.js/lib/scene/text/shared/AbstractTextSystem.d.ts:50
Gets or creates a managed texture for a Text object. This method handles texture reuse and reference counting.
Parameters
text
The Text object that needs a texture
Returns
Texture<TextureSource<any>>
A Texture instance that represents the rendered text
Remarks
This method performs the following:
- Sets the appropriate resolution based on auto-resolution settings
- Checks if a texture already exists for the text's style
- Creates a new texture if needed or returns an existing one
- Manages reference counting for texture reuse
Inherited from
AbstractTextSystem.getManagedTexture
getReferenceCount()
> getReferenceCount(textKey): number
Defined in: node_modules/pixi.js/lib/scene/text/shared/AbstractTextSystem.d.ts:65
Gets the current reference count for a texture associated with a text key.
Parameters
textKey
string
The unique key identifying the text style configuration
Returns
number
The number of Text instances currently using this texture
Inherited from
AbstractTextSystem.getReferenceCount
getTexture()
Call Signature
> getTexture(text, resolution, style, textKey): Texture
Defined in: node_modules/pixi.js/lib/scene/text/shared/AbstractTextSystem.d.ts:17
Parameters
text
string
resolution
number
style
textKey
string
Returns
Deprecated
since 8.0.0
Inherited from
Call Signature
> getTexture(options): Texture
Defined in: node_modules/pixi.js/lib/scene/text/shared/AbstractTextSystem.d.ts:27
This is a function that will create a texture from a text string, style and resolution. Useful if you want to make a texture of your text and use if for various pixi things!
Parameters
options
The options of the text that will be used to generate the texture.
Returns
the newly created texture
Inherited from
~~renderTextToCanvas()~~
> renderTextToCanvas(): void
Defined in: node_modules/pixi.js/lib/scene/text/shared/AbstractTextSystem.d.ts:38
Renders text to its canvas, and updates its texture.
Returns
void
Deprecated
since 8.10.0
Inherited from
AbstractTextSystem.renderTextToCanvas
returnTexture()
> returnTexture(texture): void
Defined in: node_modules/pixi.js/lib/scene/text/shared/AbstractTextSystem.d.ts:33
Returns a texture that was created wit the above getTexture function.
Handy if you are done with a texture and want to return it to the pool.
Parameters
texture
The texture to be returned.
Returns
void