Java BufferedImage Transform transformImage(BufferedImage image, AffineTransform transform)

Here you can find the source of transformImage(BufferedImage image, AffineTransform transform)

Description

transform Image

License

Open Source License

Declaration

public static BufferedImage transformImage(BufferedImage image,
            AffineTransform transform) 

Method Source Code

//package com.java2s;

import java.awt.Graphics2D;

import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;

public class Main {
    public static BufferedImage transformImage(BufferedImage image,
            AffineTransform transform) {
        AffineTransformOp op = new AffineTransformOp(transform, null);
        BufferedImage destImage = op.createCompatibleDestImage(image,
                image.getColorModel());//from   ww w  .j  a v  a  2 s . c o m
        Graphics2D g2d = destImage.createGraphics();
        g2d.drawImage(image, transform, null);
        g2d.dispose();
        return destImage;

        /*
        Graphics2D g = destinationImage.createGraphics();
        g.setBackground(Color.WHITE);
        g.clearRect(0, 0, destinationImage.getWidth(), destinationImage.getHeight());
        destinationImage = op.filter(image, destinationImage);
        return destinationImage;
         */
    }
}

Related

  1. transform(BufferedImage image, int sx, int sy, int dx, int dy)
  2. transform(String originalFile, String thumbnailFile, int thumbWidth, int thumbHeight)
  3. TransformGrayToTransparency(BufferedImage image)
  4. transformGrayToTransparency(BufferedImage image)
  5. transformImage(BufferedImage image, AffineTransform transform)
  6. transformImage(BufferedImage image, AffineTransform transform, int newWidth, int newHeight)
  7. transformImage2(BufferedImage image, AffineTransform transform)
  8. transformToolIcon(BufferedImage source, int width, int height)
  9. translateToTopLeftMargin(Graphics2D g2d, PageFormat pageFormat)