Example usage for java.awt.image AffineTransformOp filter

List of usage examples for java.awt.image AffineTransformOp filter

Introduction

In this page you can find the example usage for java.awt.image AffineTransformOp filter.

Prototype

public final WritableRaster filter(Raster src, WritableRaster dst) 

Source Link

Document

Transforms the source Raster and stores the results in the destination Raster .

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_BYTE_INDEXED);

    AffineTransform tx = new AffineTransform();
    tx.shear(2, 3);//from   w  w w  .  ja v  a 2s  .c o m

    AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
    bufferedImage = op.filter(bufferedImage, null);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_BYTE_INDEXED);

    AffineTransform tx = new AffineTransform();
    tx.translate(2, 1);/*from   w  ww.ja  v  a2  s  . com*/

    AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
    bufferedImage = op.filter(bufferedImage, null);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_BYTE_INDEXED);

    AffineTransform tx = new AffineTransform();
    tx.scale(1, 2);//from ww  w  .  j  ava 2 s.  c o  m

    AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
    bufferedImage = op.filter(bufferedImage, null);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_BYTE_INDEXED);

    AffineTransform tx = new AffineTransform();
    tx.rotate(0.5, bufferedImage.getWidth() / 2, bufferedImage.getHeight() / 2);

    AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
    bufferedImage = op.filter(bufferedImage, null);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_BYTE_INDEXED);

    AffineTransform tx = AffineTransform.getScaleInstance(-1, 1);
    tx.translate(-bufferedImage.getWidth(null), 0);
    AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    bufferedImage = op.filter(bufferedImage, null);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_BYTE_INDEXED);

    AffineTransform tx = AffineTransform.getScaleInstance(-1, -1);
    tx.translate(-bufferedImage.getWidth(null), -bufferedImage.getHeight(null));
    AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    bufferedImage = op.filter(bufferedImage, null);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_BYTE_INDEXED);

    AffineTransform tx = AffineTransform.getScaleInstance(1, -1);
    tx.translate(0, -bufferedImage.getHeight(null));
    AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    bufferedImage = op.filter(bufferedImage, null);

}

From source file:de.mfo.jsurf.Main.java

public static BufferedImage flipV(BufferedImage bi) {
    AffineTransform tx = AffineTransform.getScaleInstance(1, -1);
    tx.translate(0, -bi.getHeight(null));
    AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    return op.filter(bi, null);
}

From source file:com.ttech.cordovabuild.domain.application.source.ApplicationSourceFactoryImpl.java

public static BufferedImage scaleTo(BufferedImage image, Integer height, Integer width) throws IOException {
    int imageWidth = image.getWidth();
    int imageHeight = image.getHeight();

    double scaleX = (double) (width == null ? 1 : width / imageWidth);
    double scaleY = (double) (height == null ? 1 : height / imageHeight);
    AffineTransform scaleTransform = AffineTransform.getScaleInstance(scaleX, scaleY);
    AffineTransformOp bilinearScaleOp = new AffineTransformOp(scaleTransform, AffineTransformOp.TYPE_BILINEAR);

    return bilinearScaleOp.filter(image, new BufferedImage(width, height, image.getType()));
}

From source file:se.trixon.almond.GraphicsHelper.java

public static BufferedImage flipBufferedImageX(BufferedImage bufferedImage) {
    AffineTransform affineTransform = AffineTransform.getScaleInstance(-1, 1);
    affineTransform.translate(-bufferedImage.getWidth(null), 0);
    AffineTransformOp affineTransformOp = new AffineTransformOp(affineTransform,
            AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    return affineTransformOp.filter(bufferedImage, null);
}