com.generationjava.io
Class BitmapReader

java.lang.Object
  |
  +--com.generationjava.io.BitmapReader

public class BitmapReader
extends java.lang.Object

From a Javaworld.com article by XXXX Used to load java.awt.Images which are Microsoft BMP files.


Constructor Summary
BitmapReader()
           
 
Method Summary
 java.awt.Image loadbitmap(java.lang.String sdir, java.lang.String sfile)
          loadbitmap() method converted from Windows C code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitmapReader

public BitmapReader()
Method Detail

loadbitmap

public java.awt.Image loadbitmap(java.lang.String sdir,
                                 java.lang.String sfile)
loadbitmap() method converted from Windows C code. Reads only uncompressed 24- and 8-bit images. Tested with images saved using Microsoft Paint in Windows 95. If the image is not a 24- or 8-bit image, the program refuses to even try. I guess one could include 4-bit images by masking the byte by first 1100 and then 0011. I am not really interested in such images. If a compressed image is attempted, the routine will probably fail by generating an IOException. Look for variable ncompression to be different from 0 to indicate compression is present. Arguments: sdir and sfile are the result of the FileDialog() getDirectory() and getFile() methods. Returns: Image Object, be sure to check for (Image)null !!!!



Copyright © 2000-2003 GenerationJava. All Rights Reserved.