/** Sets a rectangle inside the image with the specified value. */ public static void fillRectangle( ImageSInt32 img, int value, int x0, int y0, int width, int height) { int x1 = x0 + width; int y1 = y0 + height; for (int y = y0; y < y1; y++) { for (int x = x0; x < x1; x++) { if (img.isInBounds(x, y)) img.set(x, y, value); } } }