Skip to content

LuaImage

tom5454 edited this page Nov 1, 2023 · 1 revision

LuaImage

getWidth()

Returns the image width

getHeight()

Returns the image height

getRGB(x, y)

Returns the color of the pixel at x and y coordinates

saveImage()

Saves the image into a ByteBuffer. Returns the ByteBuffer

getAsBuffer()

Returns the image pixels as an unpacked ARGB numbers

local pixels = { image.getAsBuffer() }

--values are available with pixels[x + image.getWidth() * (y - 1)]

setRGB(x, y, Color)

Set the color value of the pixel at x and y
See: Color arguments

gpuDraw()

Returns a GPU context where output is drawn onto this image.

free()

Removes the image from the used VRAM amount and marks the image invalid.

ref()

Returns a string reference to the image.
The reference is only usable on the same peripheral.

Tom's Peripherals Wiki

Clone this wiki locally