调整BufferedImage的大小

时间:2011-08-23 11:51:23

标签: swing

我想调整使用AffineTransform对象的Graphics绘图方法绘制的BufferedImage。

        AffineTransform at = new AffineTransform();
        at.scale(1, -1);
        at.translate((int) xPos - xIncr, -(int)yPos);
        ((Graphics2D) g).drawImage(line, at, null);

我怎样才能调整图像的大小,比我想要的图像要小? 谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

鉴于您已经使用AffineTransform绘制图片,为什么不仅仅应用其他scale将图片展开所需的数量?

AffineTransform at = new AffineTransform();
at.scale(1, -1);
at.scale(2.5, 3.0); // replace these with more appropriate scale factors
at.translate((int) xPos - xIncr, -(int)yPos);
((Graphics2D) g).drawImage(line, at, null);
相关问题