Skip to main content
Version: 9.0.2

CANVAS:set_pixel

CANVAS:set_pixel(x, y, color)

Set the pixel value at x, y to the specified color. This is equivalent to drawing a 1x1 filled rectangle.

Parameters

ParameterTypeDescription
x#numberThe x position pixel.
y#numberThe y position pixel.
color#numberAn RGB color value as an integer value.

Example

-- Place a red dot on the canvas
function RedDot(name)
local canvas = gre.get_canvas(name)
local size = canvas:get_dimensions()
local x = size.width / 2
local y = size.height / 2
canvas:set_pixel(x, y, 0xff2244)
end