If loaded from a file format that supports it, an
Image may have transparency, meaning that certain
pixels are specified as being transparent when drawn. Examples
of file formats that support transparency are GIF and PNG.
There are two primary ways to use Images.
The first is to load a graphic file from disk and create an
Image from it. This is done using an Image
constructor, for example:
Image i = new Image(device, "C:\\graphic.bmp");
ImageData data = new ImageData("C:\\graphic.bmp");
RGB rgbs = data.getRGBs();
// At this point, rgbs contains specifications of all
// the colors contained within this image. You may
// allocate as many of these colors as you wish by
// using the Color constructor Color(RGB), then
// create the image:
Image i = new Image(device, data);
Applications which require even greater control over the image
loading process should use the support provided in class
Application code must explicitly invoke the Image.dispose()
method to release the operating system resources managed by each instance
when those instances are no longer required.