GIF Images
GIF methods allow you to decode, scale, and render GIF images (including animated GIFs) directly onto displays. Images are provided as Base64 encoded GIF data unless otherwise specified.
Methods
Section titled “Methods”decodeAndScaleGIF
Section titled “decodeAndScaleGIF”Decodes a Base64 GIF image and scales it to the requested size.
Useful when you need image data before drawing.
Requires: base64GifData : string, targetWidth : number, targetHeight : number
Returns: Image data table.
Example
Section titled “Example”local image = gpu.decodeAndScaleGIF( base64GifData, 128, 128)decodeGIF
Section titled “decodeGIF”Decodes a Base64 GIF image and returns its pixel data.
Requires: base64GifData : string
Returns: Image data table.
Example
Section titled “Example”local image = gpu.decodeGIF(base64GifData)getGIFDimensions
Section titled “getGIFDimensions”Gets the dimensions of a GIF without fully decoding or rendering it.
Requires: base64GifData : string
Returns:
{ width, height}Example
Section titled “Example”local dims = gpu.getGIFDimensions(base64GifData)
print(dims.width, dims.height)getGIFFrameInfo
Section titled “getGIFFrameInfo”Gets information about the frames of an animated GIF.
Requires: base64GifData : string
Returns: Table containing frame information (such as frame count and per-frame data).
Example
Section titled “Example”local info = gpu.getGIFFrameInfo(base64GifData)
print(info.frameCount)loadGIFFullscreen
Section titled “loadGIFFullscreen”Decodes a GIF image and fills the entire display with it.
Call updateDisplay afterwards to push the framebuffer.
Requires: DisplayID, gifData : string
Example
Section titled “Example”gpu.loadGIFFullscreen(displayId, gifData)gpu.updateDisplay(displayId)loadGIFFrame
Section titled “loadGIFFrame”Loads a single frame of an animated GIF into a specific region of a display.
Requires: DisplayID, gifData : string, frameIndex : number, x : number, y : number, w : number, h : number
Example
Section titled “Example”gpu.loadGIFFrame( displayId, gifData, 1, 0, 0, 128, 128)loadGIFRegion
Section titled “loadGIFRegion”Loads GIF binary data into a specific region of a display.
Useful for updating only part of the framebuffer.
Requires: DisplayID, gifBinaryData : string, x : number, y : number, w : number, h : number
Example
Section titled “Example”gpu.loadGIFRegion( displayId, gifBinaryData, 0, 0, 100, 100)loadGIFRegionBytes
Section titled “loadGIFRegionBytes”Loads a Base64 encoded GIF into a specific display region.
This is the Base64 version of loadGIFRegion.
Requires: DisplayID, base64GifData : string, x : number, y : number, w : number, h : number
Example
Section titled “Example”gpu.loadGIFRegionBytes( displayId, base64GifData, 50, 50, 128, 128)stopGIF
Section titled “stopGIF”Stops GIF playback on a display.
Requires: DisplayID
Example
Section titled “Example”gpu.stopGIF(displayId)