Java BufferedImage Filter applyFilter(BufferedImage img, BufferedImageOp filter)

Here you can find the source of applyFilter(BufferedImage img, BufferedImageOp filter)

Description

apply Filter

License

Open Source License

Declaration

public static final void applyFilter(BufferedImage img, BufferedImageOp filter) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.Graphics2D;

import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;

public class Main {
    public static final void applyFilter(BufferedImage img, BufferedImageOp filter) {
        // FilteredImageSource src = new FilteredImageSource(img.getSource(), filter);
        // Image fImg = Toolkit.getDefaultToolkit().createImage(src);
        // Graphics2D g = img.createGraphics();
        // g.drawImage(fImg, 0, 0, null, null);
        // g.dispose();

        BufferedImage fImg = filter.filter(img, null);
        Graphics2D g = img.createGraphics();
        g.drawImage(fImg, 0, 0, null, null);
        g.dispose();/*from  w  w w. j  av a  2s. c o  m*/
    }
}

Related

  1. applyFilter(BufferedImage img, ImageFilter filter)
  2. applyFilter(LookupTable lookupTable, BufferedImage srcImg)
  3. filter(BufferedImage image, BufferedImageOp op)
  4. filterContrast(BufferedImage img)