How to extend JImageTaglib to create new filters?

net.sourceforge.jimagetaglib.InterfaceFilter is the base interface for implementing new filters classes. Implementing this interface, you will need to implement the "apply" method, which receives a BufferedImage and returns the BufferedImage with the filter applied. All you need to do is to implement this method, so your class you be able to be used by the "filter" tag.


public BufferedImage apply(BufferedImage origin) {
  float[] edgeKernel = { 0.0f, -1.0f, 0.0f, -1.0f, 4.0f, -1.0f, 0.0f, -1.0f, 0.0f };
  BufferedImageOp op = (BufferedImageOp) new ConvolveOp(new Kernel(3, 3, edgeKernel));
  return op.filter(origin, null);

See javadoc and Sun's Java2D page for details.

“Imagination is more important than knowledge.” Albert Einstein