Here you can find the source of filter(ImageIcon image, RGBImageFilter filter)
Parameter | Description |
---|---|
image | the image to be filtered. |
filter | the filter to be used. |
public static ImageIcon filter(ImageIcon image, RGBImageFilter filter)
//package com.java2s; import java.awt.Toolkit; import java.awt.image.FilteredImageSource; import java.awt.image.ImageProducer; import java.awt.image.RGBImageFilter; import javax.swing.ImageIcon; public class Main { /**// ww w. ja v a2 s. c o m * Utility method that filters the image. * * @param image * the image to be filtered. * @param filter * the filter to be used. * * @return the filtered image. */ public static ImageIcon filter(ImageIcon image, RGBImageFilter filter) { ImageProducer prod = new FilteredImageSource(image.getImage().getSource(), filter); ImageIcon filteredImage = new ImageIcon(Toolkit.getDefaultToolkit().createImage(prod)); return filteredImage; } }