25th August 1997

SplitImage class

This class allows to do a very simple task: to split an image in different images, all of them with the same size, which can be used for lot of purposes. I needed it, for example, to develop the Menu applet.

Its implementation is based on the CropImageFilter class, whose purpose is to filter only a portion of an image. Using this class, the implementation becomes really very simple.

To use the class, it is needed to create an SplitImage object, passing the image to split, and the number of rows and columns in which the image will be splitted.

After this, it is possible to get an Image Producer for any valid row and column, using the getImageProducer method. It is also possible to obtain the height and the width of the splitted images using the getHeight and getWidth methods. That's all!

SplitImage.java (5 KB)