【发布时间】:2014-11-25 15:47:38
【问题描述】:
您好,我尝试在 Java 中旋转 BufferedImage,但一切正常。这是我的代码:
public void RotateImageNDegrees(String angulo){
AffineTransform tx = new AffineTransform();
tx.rotate(Double.parseDouble(angulo), bimage.getWidth() / 2, bimage.getHeight() / 2);
AffineTransformOp op = new AffineTransformOp(tx,
AffineTransformOp.TYPE_BILINEAR);
bimage = op.filter(bimage, null);
drawImageInFrame(bimage); //Use bimage width and height to paint in a Frame
}
方法“drawImageInFrame(bimage);”绘制图像,使用 bimage 宽度和高度来设置 JFrame 的大小。
这是它返回的内容:
http://i61.tinypic.com/2ic3590.jpg
但我需要的是这样的:
http://i59.tinypic.com/14l7wuu.jpg
谢谢大家=D
【问题讨论】:
标签: java swing rotation jframe bufferedimage