com.flagstone.transform.util.image
Class BMPDecoder

java.lang.Object
  extended by com.flagstone.transform.util.image.BMPDecoder
All Implemented Interfaces:
ImageDecoder, ImageProvider

public final class BMPDecoder
extends Object
implements ImageProvider, ImageDecoder

BMPDecoder decodes Bitmap images (BMP) so they can be used in a Flash file.


Constructor Summary
BMPDecoder()
           
 
Method Summary
 ImageTag defineImage(int identifier)
          Create the image definition so it can be added to a movie.
 int getHeight()
          Get the height of the image.
 byte[] getImage()
          Get the array of bytes that make up the image.
 int getWidth()
          Get the width of the image.
 ImageDecoder newDecoder()
          The method implemented by all ImageDecoders in order to be registered with the ImageRegistry and used by the ImageFactory to decode images.
 void read(File file)
          Read an image from a file.
 void read(InputStream stream)
          Read an image from an input stream.
 void read(URL url)
          Read an image from a file referenced by a URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BMPDecoder

public BMPDecoder()
Method Detail

read

public void read(File file)
          throws IOException,
                 DataFormatException
Read an image from a file.

Specified by:
read in interface ImageDecoder
Parameters:
file - the path to the file.
Throws:
IOException - if there is an error reading the image data.
DataFormatException - if the file contains an unsupported format.

read

public void read(URL url)
          throws IOException,
                 DataFormatException
Read an image from a file referenced by a URL.

Specified by:
read in interface ImageDecoder
Parameters:
url - the reference to the file.
Throws:
IOException - if there is an error reading the image data.
DataFormatException - if the file contains an unsupported format.

defineImage

public ImageTag defineImage(int identifier)
Create the image definition so it can be added to a movie.

Specified by:
defineImage in interface ImageDecoder
Parameters:
identifier - the unique identifier used to refer to the image.
Returns:
the image definition.

newDecoder

public ImageDecoder newDecoder()
The method implemented by all ImageDecoders in order to be registered with the ImageRegistry and used by the ImageFactory to decode images.

Specified by:
newDecoder in interface ImageProvider
Returns:
an object that implements the FontDecoder interface.

getWidth

public int getWidth()
Get the width of the image.

Specified by:
getWidth in interface ImageDecoder
Returns:
the width of the image in pixels.

getHeight

public int getHeight()
Get the height of the image.

Specified by:
getHeight in interface ImageDecoder
Returns:
the height of the image in pixels.

getImage

public byte[] getImage()
Get the array of bytes that make up the image. This method is used by the ImageFactory to generate a list of blocks for encoding an image as ScreenVideo.

Specified by:
getImage in interface ImageDecoder
Returns:
the array of bytes representing the image.

read

public void read(InputStream stream)
          throws DataFormatException,
                 IOException
Read an image from an input stream.

Specified by:
read in interface ImageDecoder
Parameters:
stream - the stream used to read the image data.
Throws:
DataFormatException - if the file contains an unsupported format.
IOException - if there is an error reading the image data.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.