Abstract Class: AbstractTextSystem
Defined in: node_modules/pixi.js/lib/scene/text/shared/AbstractTextSystem.d.ts:11
Base system plugin to the renderer to manage canvas text.
Advanced
Extended by
Implements
Constructors
Constructor
> new AbstractTextSystem(renderer, retainCanvasContext): AbstractTextSystem
Defined in: node_modules/pixi.js/lib/scene/text/shared/AbstractTextSystem.d.ts:15
Parameters
renderer
retainCanvasContext
boolean
Returns
AbstractTextSystem
Properties
_renderer
> protected readonly _renderer: Renderer
Defined in: node_modules/pixi.js/lib/scene/text/shared/AbstractTextSystem.d.ts:12
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.
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
Implementation of
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
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
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
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
~~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
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