setPixelRgbSafe method
Calls setPixelRgb, but ensures x
and y
are within the extents
of the image, otherwise it returns without setting the pixel.
Implementation
void setPixelRgbSafe(int x, int y, num r, num g, num b) {
if (x < 0 || x >= width || y < 0 || y >= height) {
return;
}
setPixelRgb(x, y, r, g, b);
}