Need help with mirror images for dr.java
I'm trying to flip the image from the right to the left over the vertical midpoint. I know how to flip the image from left to right, but not the other way around.
Here is my code so far
public void mirrorVertical()
{
int width = this.getWidth();
int mirrorPoint = width / 2;
Pixel leftPixel = null;
Pixel rightPixel = null;
for (int y = 0; y < getHeight(); y++)
{
for (int x = 0; x < mirrorPoint; x++)
{
leftPixel = getPixel (x,y);
rightPixel = getPixel (width -1 - x, y);
rightPixel.setColor(leftPixel.getColor());
}
}
}