Here you can find the source of flipImage(Object original, boolean flipX, boolean flipY)
public static BufferedImage flipImage(Object original, boolean flipX, boolean flipY)
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; import java.awt.Graphics2D; public class Main { public static BufferedImage flipImage(Object original, boolean flipX, boolean flipY) { BufferedImage originalImage = (BufferedImage) original; if (!flipX && !flipY) return originalImage; int x = 0; int y = 0; int width = originalImage.getWidth(); int height = originalImage.getHeight(); BufferedImage flippedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = flippedImage.createGraphics(); if (flipX) { x = width;// w ww .j a v a2 s. c o m width = -width; } if (flipY) { y = height; height = -height; } g.drawImage(originalImage, x, y, width, height, null); g.dispose(); return flippedImage; } }