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: 
    x - The x position pixel   
    y - The y position pixel   
    color - An 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);
}
Was this article helpful?
0 out of 0 found this helpful