pt.tumba.parser.swf
Class ImageUtil

java.lang.Object
  extended by pt.tumba.parser.swf.ImageUtil

public class ImageUtil
extends java.lang.Object

Utilities for dealing with images

Author:
unknown

Field Summary
private static ImageUtil _theInstance
           
 
Constructor Summary
private ImageUtil()
           
 
Method Summary
static Image.Lossless createLosslessImage(java.awt.Image image, int format, boolean hasAlpha)
          Create a lossless Image object from an AWT Image - the awt image must be fully loaded and ready.
static ImageUtil getInstance()
           
static byte[] normalizeJPEG(java.io.InputStream jpegImage, int[] size2)
          Normalize a JPEG to ensure that it is "Baseline" rather than "Progressive".
static Shape shapeForImage(Image image, double width, double height)
          Create a Shape for the image.
static Shape shapeForImage(java.io.InputStream jpegImage, int[] size2)
          Create a Shape for the image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_theInstance

private static final ImageUtil _theInstance
Constructor Detail

ImageUtil

private ImageUtil()
Method Detail

getInstance

public static ImageUtil getInstance()

normalizeJPEG

public static byte[] normalizeJPEG(java.io.InputStream jpegImage,
                                   int[] size2)
                            throws java.io.IOException
Normalize a JPEG to ensure that it is "Baseline" rather than "Progressive". The Flash player doesn't like "Progressive".

Parameters:
size - null or an int[2] to receive the (width,height) of the image
jpegImage - Description of the Parameter
Returns:
the image data - with the necessary header for SWF
Throws:
java.io.IOException - Description of the Exception

shapeForImage

public static Shape shapeForImage(java.io.InputStream jpegImage,
                                  int[] size2)
                           throws java.io.IOException
Create a Shape for the image. The resulting shape uses the image as a clipped image fill. The shape is a rectangle just the right size to show the entire image and its origin is at the top left. Additional geometry vectors may be added to the shape if required.

Parameters:
size - null or an int[2] to receive the (width,height) of the image
jpegImage - Description of the Parameter
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

shapeForImage

public static Shape shapeForImage(Image image,
                                  double width,
                                  double height)
                           throws java.io.IOException
Create a Shape for the image. The resulting shape uses the image as a clipped image fill. The shape is a rectangle just the right size to show the entire image and its origin is at the top left. Additional geometry vectors may be added to the shape if required.

Parameters:
image - Description of the Parameter
width - Description of the Parameter
height - Description of the Parameter
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

createLosslessImage

public static Image.Lossless createLosslessImage(java.awt.Image image,
                                                 int format,
                                                 boolean hasAlpha)
Create a lossless Image object from an AWT Image - the awt image must be fully loaded and ready.

Parameters:
format - one of: SWFConstants.BITMAP_FORMAT_8_BIT, SWFConstants.BITMAP_FORMAT_16_BIT, SWFConstants.BITMAP_FORMAT_32_BIT
image - Description of the Parameter
hasAlpha - Description of the Parameter
Returns:
Description of the Return Value