Return to Snippet

Revision: 1726
at November 10, 2006 00:09 by whitetiger


Updated Code
public BufferedImage rotate90DX(BufferedImage bi)
	{
		int width = bi.getWidth();
		int height = bi.getHeight();
		
		BufferedImage biFlip = new BufferedImage(height, width, bi.getType());
		
		for(int i=0; i<width; i++)
			for(int j=0; j<height; j++)
				biFlip.setRGB(height-1-j, width-1-i, bi.getRGB(i, j));
		
		return biFlip;
	}


	public BufferedImage rotate90SX(BufferedImage bi)
	{
		int width = bi.getWidth();
		int height = bi.getHeight();
		
		BufferedImage biFlip = new BufferedImage(height, width, bi.getType());
		
		for(int i=0; i<width; i++)
			for(int j=0; j<height; j++)
				biFlip.setRGB(j, i, bi.getRGB(i, j));
		
		return biFlip;
	}

Revision: 1725
at November 9, 2006 23:54 by whitetiger


Initial Code
public BufferedImage rotate90DX(BufferedImage bi)
	{
		int width = bi.getWidth();
		int height = bi.getHeight();
		
		BufferedImage biFlip = new BufferedImage(height, width, bi.getType());
		
		for(int i=0; i<width; i++)
			for(int j=0; j<height; j++)
				biFlip.setRGB(height-1-j, width-1-i, bi.getRGB(i, j));
		
		return biFlip;
	}


	public BufferedImage rotate90SX(BufferedImage bi)
	{
		int width = bi.getWidth();
		int height = bi.getHeight();
		
		BufferedImage biFlip = new BufferedImage(height, width, bi.getType());
		
		for(int i=0; i<width; i++)
			for(int j=0; j<height; j++)
				biFlip.setRGB(j, i, bi.getRGB(i, j));
		
		return biFlip;
	}

Initial URL

                                

Initial Description

                                

Initial Title
Java - rotate -90°/90°

Initial Tags
image, java, filter, images

Initial Language
Java