This tip demonstrates how to build a “flea” filter based on the RGBImageFilter class. The filtered picture will look like the image displayed on old TVs.
import java.awt.image.*;import java.util.*;import java.awt.*;public class FleaFilter extends RGBImageFilter{ ColorModel cm=ColorModel.getRGBdefault(); public FleaFilter() { canFilterIndexColorModel=true; } public int filterRGB(int x, int y, int rgb) { Random Rred=new Random(); Random Rgreen=new Random(); Random Rblue=new Random(); Color backup=new Color(Rred.nextInt(255), Rgreen.nextInt(255),Rblue.nextInt(255)); return rgb|backup.getRGB(); }}