ewe.fx
Class ImageCodec

java.lang.Object
  extended byewe.util.Errorable
      extended byewe.fx.ImageCodec

public class ImageCodec
extends Errorable

This class is used by Image for decoding image formats. You would not use this class directly.


Field Summary
 Color background
          This is the background color if one was specified.
 int bitDepth
           
static boolean canDecodeGIF
           
static boolean canDecodeJPEG
           
 int compression
           
 int convertTime
          This is used for debugging only.
 int filter
           
 int height
           
 int interlace
           
 boolean isBMPFile
           
 boolean isGIFFile
           
 boolean isJPEGFile
           
 byte[] paletteBytes
           
 int pauseTime
           
 int setPixelTime
          This is used for debuggin only.
protected static int[] signature
           
 byte[] transparencyBytes
           
 Color transparent
          This is the transparent color if one was specified.
protected  int transparentColor
           
protected  int transparentColorLow
           
 int type
           
 int width
           
 
Fields inherited from class ewe.util.Errorable
error
 
Constructor Summary
ImageCodec()
           
 
Method Summary
 boolean decode(RandomAccessStream ras)
          Call this first to decode the parameters of the PNG image.
 boolean decodeBMP(RandomAccessStream ras)
           
protected  ewe.fx.pngChunk getChunk(RandomAccessStream ras)
           
 ImageInfo getImageInfo(Stream dataStream, int imageIndex, ImageInfo destination, boolean createImage)
           
 ImageInfo[] getImages(Stream stream, boolean createImages)
           
static boolean hasBMPSignature(byte[] startData)
           
static boolean hasGIFSignature(byte[] startData)
           
static boolean hasJPEGSignature(byte[] startData)
           
static boolean hasPNGSignature(byte[] startData)
           
static boolean isDecodable(byte[] first16Bytes)
           
 Image javaToImage(Image im)
          Call this after calling decode to convert it to an Image.
 boolean skipGifImage(BasicStream dataStream)
           
 String toString()
          Return a String representation of this object.
 
Methods inherited from class ewe.util.Errorable
returnError, returnError, returnError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode
 

Field Detail

width

public int width

height

public int height

type

public int type

bitDepth

public int bitDepth

compression

public int compression

filter

public int filter

interlace

public int interlace

paletteBytes

public byte[] paletteBytes

transparencyBytes

public byte[] transparencyBytes

transparentColor

protected int transparentColor

transparentColorLow

protected int transparentColorLow

isBMPFile

public boolean isBMPFile

isJPEGFile

public boolean isJPEGFile

isGIFFile

public boolean isGIFFile

pauseTime

public int pauseTime

canDecodeGIF

public static boolean canDecodeGIF

canDecodeJPEG

public static boolean canDecodeJPEG

signature

protected static final int[] signature

background

public Color background
This is the background color if one was specified.


transparent

public Color transparent
This is the transparent color if one was specified.


convertTime

public int convertTime
This is used for debugging only. Specifies the number of milliseconds it took to convert the image. (This is the first step in toImage()).


setPixelTime

public int setPixelTime
This is used for debuggin only. Specifies the number of milliseconds it took to create the image from the raw pixel values. (This is the second step in toImage())

Constructor Detail

ImageCodec

public ImageCodec()
Method Detail

getChunk

protected ewe.fx.pngChunk getChunk(RandomAccessStream ras)

hasPNGSignature

public static boolean hasPNGSignature(byte[] startData)

hasBMPSignature

public static boolean hasBMPSignature(byte[] startData)

hasGIFSignature

public static boolean hasGIFSignature(byte[] startData)

hasJPEGSignature

public static boolean hasJPEGSignature(byte[] startData)

isDecodable

public static boolean isDecodable(byte[] first16Bytes)

decodeBMP

public boolean decodeBMP(RandomAccessStream ras)

decode

public boolean decode(RandomAccessStream ras)
Call this first to decode the parameters of the PNG image.


javaToImage

public Image javaToImage(Image im)
Call this after calling decode to convert it to an Image.


toString

public String toString()
Description copied from class: Object
Return a String representation of this object.

Overrides:
toString in class Object
Returns:
a String representing this object.

skipGifImage

public boolean skipGifImage(BasicStream dataStream)

getImageInfo

public ImageInfo getImageInfo(Stream dataStream,
                              int imageIndex,
                              ImageInfo destination,
                              boolean createImage)
                       throws IllegalArgumentException
Throws:
IllegalArgumentException

getImages

public ImageInfo[] getImages(Stream stream,
                             boolean createImages)