howdy; i'm trying to make a few methds that'll do a few things to an image. i've made it lighter, and halved the image, but i'm also trying to flip it, and fill it with a colour; but i need a little help: this is what i've done for lighter and halving:
Code:
public void lighter(int howMuch) {
int height = pixels.length; int width = pixels[0].length;
postOpPixels = new int[height][width];
for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) {
postOpPixels[y][x] = pixels[y][x] + howMuch;
if (postOpPixels[y][x] < 0) postOpPixels[y][x] = 0;
else if (postOpPixels[y][x] > MAX_GRAY) postOpPixels[y][x] = MAX_GRAY;
} } showResultImage();
}
public void halve() {
int height = pixels.length; int width = pixels[0].length;
postOpPixels = new int[height][width];
for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) {
postOpPixels[y][x] = pixels[y][x];
if (postOpPixels[y][x] < 0) postOpPixels[y][x] = 0;
}
} showResultImage();
}