/** * Apply a given function to the current image */ private void applyFunction(Function function) { if(currentImage != null) { function.apply(currentImage); //A function is applied frame.repaint(); showStatus("Applied: " + function.getName()); } else { showStatus("No image loaded."); } } ------------------------------------------------------------------------ public class Rotate extends Function { public Rotate(String name) { super(name); } /** * Apply this function to an image */ public void apply(OFImage image) { int height = image.getHeight(); int width = image.getWidth(); //Rotate the image Graphics2D g = (Graphics2D) image.createGraphics(); g.rotate(Math.PI / 4, width / 2, height / 2); g.drawImage(image, 0,0,null); } }