So I am currently doing some school assignments which involves me mirroring an image "pixel by pixel
". I got an example on how to flip the image, however i’m struggling to figure out how to mirror it.
Here is the code that I used to flip the image
color[] tempArray = new color[img.pixels.length];
int i = 0; {
while (i < img.pixels.length) {
tempArray[i] = img.pixels[i];
i++;
}
int j = 0;
while (j < img.pixels.length) {
img.pixels[j] = tempArray[img.pixels.length-1-j];
j++;
}
Any help and explanations on all of this would be greatly appreciated, thanks!