Constructor for Text class. The text is rendered using the browser's canvas element and then copyied into a texture, so the parameters are based on what is understood by CanvasRenderingContext2D. Shortcuts are provided for fillStyle, backgroundStyle, and strokeStyle to use the gfx.Color types if that is more convenient for your application.
The text to be rendered
The width of the text canvas
The height of the text canvas
The font style of the text. Can be a gfx.Color or see additional options for canvas.font.
The fill style of the text. Can be a gfx.Color or see additional options for canvas.fillStyle.
The fill style of the background. Can be a gfx.Color or see additional options for canvas.fillStyle.
The stroke style of the text. Can be a gfx.Color or see additional options for canvas.strokeStyle.
The stroke width of the text.
The alignment of the text. See possible values in canvas.textAlign
The baseline of the text. See possible values in canvas.textBaseline.
Protected
Readonly
glThe height of the original (non-mipmapped) texture image data or 'undefined' if the image has not yet completed loading.
The WebGL texture ID used to draw this texture
Private
textThe internal object used by WebGL to draw this texture
The width of the original (non-mipmapped) texture image data or 'undefined' if the image has not yet completed loading.
Callback function for image loaded events
HTML DOM image element produced by loading the image texture
Original URL the image was loaded from (used as an internal identifier for the image asset)
Load an image into this texture.
URL to load the texture from (can be absolute, e.g. "http://unlikely-url.com/some-image.jpg", or relative, e.g. "./some-image.jpg"). Can be null to start out with, in which case the texture will be empty.
Copies the pixel data from an ImageData source into a portion of the texture, placing it as a sub-image within the texture
An ImageData object with width and height that are the same size or smaller than the texture
An offset in the x-direction within the texture where the top-left corner of imageData should be placed
An offset in the y-direction within the texture where the top-left corner of imageData should be placed
Updates the texture image of the Text class
Sets the width and height of the canvas, font, text alignment, and baseline. Fills the canvas with the background style if specified. Fills the text with the fill style if specified. Strokes the text with the stroke style and stroke width if specified. Binds the texture and generated mipmap.
Generated using TypeDoc
Represents an image texture