Rapid Render API
    Preparing search index...

    Class TextTexture

    A texture that renders text using an internal HTML Canvas.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _ph: number = 0
    _pw: number = 0
    _px: number = 0
    _py: number = 0
    flipY: boolean = true
    glTexture: WebGLTexture | null = null
    isAtlas: boolean = false
    isRotated: boolean = false
    offsetX: number = 0
    offsetY: number = 0
    rawHeight: number = 0
    rawWidth: number = 0
    scale: number = 1
    uvH: number = 1
    uvW: number = 1
    uvX: number = 0
    uvY: number = 0

    Accessors

    • get height(): number

      Returns number

    • get text(): string

      Returns string

    • set text(value: string): void

      Set new text and update the texture

      Parameters

      • value: string

      Returns void

    • get width(): number

      Returns number

    Methods

    • Marks this Texture as destroyed, decrementing the BaseTexture reference count.

      Returns void

    • Creates a new Texture representing a sub-region of this Texture.

      Parameters

      • x: number

        The x coordinate in pixels, relative to this texture's logical start.

      • y: number

        The y coordinate in pixels, relative to this texture's logical start.

      • width: number

        The width of the sub-texture in pixels.

      • height: number

        The height of the sub-texture in pixels.

      Returns Texture

      A new Texture pointing to the sub-region.

    • Sets the visible region (clipping) in pixels relative to the BaseTexture.

      Parameters

      • x: number

        The x coordinate in pixels.

      • y: number

        The y coordinate in pixels.

      • w: number

        The width in pixels.

      • h: number

        The height in pixels.

      Returns this

      The current Texture instance.

    • Utility to split this texture into a grid of sprite textures. Sub-textures will respect the current UV offsets.

      Parameters

      • cellWidth: number

        The width of each cell in pixels.

      • cellHeight: number

        The height of each cell in pixels.

      • Optionalcols: number

        Optional number of columns. Truncates based on texture width if omitted.

      • Optionalrows: number

        Optional number of rows. Truncates based on texture height if omitted.

      • gap: number = 0

        Optional pixel gap between cells.

      Returns Texture[]

      An array of split Textures.

    • Updates the internal canvas and uploads it to WebGL

      Returns void