All pastes #451570 Raw Edit

Untitled

public java v1 · immutable
·published 2007-04-21 17:15 UTC
rendered paste body
 /**     * 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);			}}