Skip to main content
Version: 9.0.2

canvas.setPixel

canvas.setPixel(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
xnumberThe x position pixel.
ynumberThe y position pixel.
colornumberAn RGB color value as an integer value.

Example

// Place a red dot on the canvas
function RedDot(name) { 
var canvas = sb.getCanvas(name); 
var x = canvas.width / 2; 
var y = canvas.height / 2; 
canvas.setPixel(x, y, 0xff2244);
}