Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void mirrorVerticalLefttoRight()
- {
- Pixel[][] pixels = this.getPixels2D();
- Pixel leftPixel = null;
- Pixel rightPixel = null;
- int width = pixels[0].length;
- for (int row = 0; row < pixels.length/2; row++) // divide by 2 so it only does one side
- {
- for (int col = 0; col < width / 2; col++)
- {
- leftPixel = pixels[row][col];
- rightPixel = pixels[row][width - 1 - col];
- rightPixel.setColor(leftPixel.getColor());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement