Crop image Filter
Crop Magel filters an image source to extract a rectangular region. One situation in which this filter is valuable is where you want to use several small images from a single, larger source image. Loading twenty 2K images takes much longer than loading a single 40K image that has many frames of an animation tiled into it. If every subimage is the same size, then you can easily extract these images by using CropImageFilter to disassemble the block once your applet starts. Here is an example that creates 16 images taken from a single image. The tiles are then scrambled by swapping a random pair from the 1(;images 32 times.'

GB mage liter

The RGB Image Filter is used to convert one image to (11\oU1(.p'ri,xel by pixel, transforming the colors along the way. This filter could be used to brighten an image, to increase' its contrast, or even to convert it to grayscale, To demonstrate RGB  age Filter, we have developed .1 somewhat complicated example, which employs a dynamic plug-in strategy for image-processing filters. We've created an interface Ior learnlinc  jr nacfilerinb so that our applet can simply load these filters based on <param> tag without h.wing to know about all of the Image File Tccs in advance. This example consists of the main applet class called ImageFiltcrDcmo, the interface called Plugin lilter. and a utility class calledLoadedlmagc, which encapsulates some of the Media Tracker methods we've been using in this chapter. Also included arc three Hl Tct's Grays Invert, and Contrast-which simply manipulate the color space of the source image using RGB Image Fdcrs, and two more classes-Blur and Sharpen-which do more complicated "convolution" filters that change pixel data based on the pixels surrounding each pixel of source datil. Blur and Sharpen arc subclasses of an abstract helper class called Convolver. Let'rs look at each part of our example

Share This