Skip to main content
An image the overlay can draw with render.image. Global class, no import.
Loading is asynchronous. width and height are 0 until ready is true, and render.image draws nothing before that.

Loading

constructor


Loads a PNG, JPG, BMP, TGA, GIF (first frame) or SVG. path is relative to the script folder. A missing file throws Error with code ENOENT.
width and height only apply to SVG and set its raster size.
Without the filesystem permission the file must be inside the script folder.

fromMemory


A texture from raw RGBA8 pixels: row-major, 4 bytes per pixel, no row padding. data is copied, so you can reuse it.

Properties

toString() gives something like Texture(64x64, ready, "C:/…/logo.svg").

Example

A logo in the top-right corner at its real size, once it has loaded.