Example usage for java.awt.image BandCombineOp filter

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

Introduction

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

Prototype

public WritableRaster filter(Raster src, WritableRaster dst) 

Source Link

Document

Transforms the Raster using the matrix specified in the constructor.

Usage

From source file:CombineApp.java

public void bandCombine(float[][] bandCombineMatrix) {
    BandCombineOp bandCombineOp = new BandCombineOp(bandCombineMatrix, null);
    bandCombineOp.filter(srcRaster, dstRaster);
    bi = biDest;/*w w w .ja  v a  2s.  c  om*/
}

From source file:Java2DExample.java

public BufferedImage processImage(BufferedImage image) {
    float[][] colorMatrix = { { 1f, 0f, 0f }, { 0.5f, 1.0f, 0.5f }, { 0.2f, 0.4f, 0.6f } };
    BandCombineOp changeColors = new BandCombineOp(colorMatrix, null);
    Raster sourceRaster = image.getRaster();
    WritableRaster displayRaster = sourceRaster.createCompatibleWritableRaster();
    changeColors.filter(sourceRaster, displayRaster);
    return new BufferedImage(image.getColorModel(), displayRaster, true, null);

}