Implementing Custom Image Filters

The AWT provides two ways to implement custom image filters. One way is to extend the ImageFilter class. The ImageFilter class is a “null” filter that passes on the bits of an image, untouched, to another image consumer. As you one might suspect, an image filter that makes no modifications to the original image is, in and of itself, of little use. The ImageFilter class is designed to be subclassed in order to implement filters that actually modify the original image. As we shall soon discover, extending the ImageFilter class can sometimes be a daunting task.

The second way to implement an image filter is to extend the RGBImageFilter class. RGBImageFilter extends ImageFilter and is much easier to subclass than ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.