jwo.utils.gui
Class BMPHandler

java.lang.Object
  extended by jwo.utils.gui.BMPHandler
All Implemented Interfaces:
ImageHandler

public class BMPHandler
extends Object
implements ImageHandler

Handles Windows .bmp (bitmap) files

Version:
2.3, 12th April, 2006.
Author:
Adapted by Jo Wood from JavaWorld Tip 60 by Jean-Pierre Dubé.

Constructor Summary
BMPHandler()
          Initialises the bitmap handler.
 
Method Summary
 boolean saveImage(String fileName, byte[] imageArray, int imgWidth, int imgHeight)
          Saves the given array of 24 bit colours as a bitmap file with the given name and dimensions.
 boolean saveImage(String fileName, Image image)
          Saves the given image as a bitmap file with the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BMPHandler

public BMPHandler()
Initialises the bitmap handler.

Method Detail

saveImage

public boolean saveImage(String fileName,
                         Image image)
Saves the given image as a bitmap file with the given name.

Specified by:
saveImage in interface ImageHandler
Parameters:
fileName - Name of bitmap file to save.
image - Image to save as a bitmap.
Returns:
True if saved correctly, or false if problems saving.

saveImage

public boolean saveImage(String fileName,
                         byte[] imageArray,
                         int imgWidth,
                         int imgHeight)
Saves the given array of 24 bit colours as a bitmap file with the given name and dimensions.

Specified by:
saveImage in interface ImageHandler
Parameters:
fileName - Name of image file to save.
imageArray - BGR colours stored in byte array (3 bytes per colour).
imgWidth - Width of image to save.
imgHeight - Height of image to save.
Returns:
True if saved correctly, or false if problems saving.


Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009