com.flagstone.transform.util.image
Class BufferedImageEncoder

java.lang.Object
  extended by com.flagstone.transform.util.image.BufferedImageEncoder

public final class BufferedImageEncoder
extends Object

BufferedImageEncoder generates BufferedImages from Flash image definitions.


Constructor Summary
BufferedImageEncoder()
           
 
Method Summary
 BufferedImage getBufferedImage()
          Create a BufferedImage from the decoded Flash image.
 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.
 BufferedImage resizeImage(BufferedImage bufferedImg, int imgWidth, int imgHeight)
          Resizes a BufferedImage to the specified width and height.
 void setImage(DefineImage definition)
          Decode a DefineImage definition.
 void setImage(DefineImage2 definition)
          Decode a DefineImage2 definition.
 void setImage(ImageTag definition)
          Decode an ImageTeg definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedImageEncoder

public BufferedImageEncoder()
Method Detail

setImage

public void setImage(ImageTag definition)
              throws DataFormatException
Decode an ImageTeg definition.

Parameters:
definition - a DefineImage object.
Throws:
DataFormatException - if there is a problem decoding the image definition.

setImage

public void setImage(DefineImage definition)
              throws DataFormatException
Decode a DefineImage definition.

Parameters:
definition - a DefineImage object.
Throws:
DataFormatException - if there is a problem decoding the image definition.

setImage

public void setImage(DefineImage2 definition)
              throws DataFormatException
Decode a DefineImage2 definition.

Parameters:
definition - a DefineImage2 object.
Throws:
DataFormatException - if there is a problem decoding the image definition.

getWidth

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

Returns:
the width of the image in pixels.

getHeight

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

Returns:
the height of the image in pixels.

getImage

public byte[] getImage()
Get the array of bytes that make up the image.

Returns:
the array of bytes representing the image.

getBufferedImage

public BufferedImage getBufferedImage()
Create a BufferedImage from the decoded Flash image.

Returns:
a BufferedImage containing the image.

resizeImage

public BufferedImage resizeImage(BufferedImage bufferedImg,
                                 int imgWidth,
                                 int imgHeight)
Resizes a BufferedImage to the specified width and height. The aspect ratio of the image is maintained so the area in the new image not covered by the resized original will be transparent.

Parameters:
bufferedImg - the BufferedImage to resize.
imgWidth - the width of the resized image in pixels.
imgHeight - the height of the resized image in pixels.
Returns:
a new BufferedImage with the specified width and height.


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