版权声明:转载时请务必保留以下作者信息和链接
作者:陈维(chenweionline@hotmail.com)作者的网站:http://www.chenwei.mobi
/***/
/**
*图像水平翻转。
*@parambufferedImage原图像。
*@return返回水平翻转后的图像。
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
public
static
BufferedImageflipHorizontalJ2D(BufferedImagebufferedImage)
...
{
intwidth=bufferedImage.getWidth();
intheight=bufferedImage.getHeight();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
BufferedImagedstImage=newBufferedImage(width,height,bufferedImage.getType());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
AffineTransformaffineTransform=newAffineTransform(-1,0,0,1,width,0);
AffineTransformOpaffineTransformOp=newAffineTransformOp(affineTransform,AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
returnaffineTransformOp.filter(bufferedImage,dstImage);
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
/***/
/**
*图像竖直翻转。
*@parambufferedImage原图像。
*@return返回竖直翻转后的图像。
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
public
static
BufferedImageflipVerticalJ2D(BufferedImagebufferedImage)
...
{
intwidth=bufferedImage.getWidth();
intheight=bufferedImage.getHeight();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
BufferedImagedstImage=newBufferedImage(width,height,bufferedImage.getType());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
AffineTransformaffineTransform=newAffineTransform(1,0,0,-1,0,height);
AffineTransformOpaffineTransformOp=newAffineTransformOp(affineTransform,AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
returnaffineTransformOp.filter(bufferedImage,dstImage);
}