Java BufferedImage Transform getTransformedImage(BufferedImage image, double scaleX, double scaleY, double shearX, double shearY)

Here you can find the source of getTransformedImage(BufferedImage image, double scaleX, double scaleY, double shearX, double shearY)

Description

get Transformed Image

License

Apache License

Declaration

public static BufferedImage getTransformedImage(BufferedImage image, double scaleX, double scaleY,
            double shearX, double shearY) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static BufferedImage getTransformedImage(BufferedImage image, double scaleX, double scaleY,
            double shearX, double shearY) {
        AffineTransform transform = new AffineTransform();
        if (scaleX > 0 && scaleY > 0)
            transform.scale(scaleX, scaleY);
        if (shearX > 0 && shearY > 0)
            transform.shear(shearX, shearY);

        AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);
        BufferedImage dest = new BufferedImage(image.getWidth(), image.getHeight(), image.getType());
        op.filter(image, dest);//from w ww . j  a  v a2 s.  c  o m
        return dest;
    }
}

Related

  1. copyAndTranslateSubimage(BufferedImage src, Rectangle bounds)
  2. transform(BufferedImage image, int numquadrants)
  3. transform(BufferedImage image, int sx, int sy, int dx, int dy)
  4. transform(String originalFile, String thumbnailFile, int thumbWidth, int thumbHeight)
  5. TransformGrayToTransparency(BufferedImage image)