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