BufferedImage使用AffineTransform旋转和设置

时间:2014-10-15 07:53:20

标签: java

我想旋转并设置BufferedImage.Rotate操作正在使用我的代码。但是我如何设置左边距和上边距

    Graphics g = combined.getGraphics();
    Graphics2D g2d = (Graphics2D) g;
    AffineTransform at = new AffineTransform();
    at.translate(overlay.getWidth() / 2, overlay.getHeight() / 2);

    double d = Math.PI/2;
    at.rotate(d);
    at.translate(-overlay.getWidth()/2, -overlay.getHeight()/2);
    g2d.drawImage(image, 0, 0, null);
    g2d.drawImage(overlay, at, null);

0 个答案:

没有答案