com.flagstone.transform.image
Class DefineJPEGImage2

java.lang.Object
  extended by com.flagstone.transform.image.DefineJPEGImage2
All Implemented Interfaces:
Copyable<MovieTag>, SWFEncodeable, DefineTag, ImageTag, MovieTag

public final class DefineJPEGImage2
extends Object
implements ImageTag

DefineJPEGImage2 is used to define a JPEG encoded image with an integrated encoding table.

See Also:
DefineJPEGImage, DefineJPEGImage3

Constructor Summary
DefineJPEGImage2(DefineJPEGImage2 object)
          Creates and initialises a DefineJPEGImage2 object using the values copied from another DefineJPEGImage2 object.
DefineJPEGImage2(int uid, byte[] img)
          Creates a DefineJPEGImage2 object with the identifier and JPEG image data.
DefineJPEGImage2(SWFDecoder coder)
          Creates and initialises a DefineJPEGImage2 object using values encoded in the Flash binary format.
 
Method Summary
 DefineJPEGImage2 copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 int getHeight()
          Get the height of the image in pixels (not twips).
 int getIdentifier()
          Get the unique identifier assigned to this object.
 byte[] getImage()
          Get a copy of the image.
 int getWidth()
          Get the width of the image in pixels (not twips).
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setIdentifier(int uid)
          Sets the unique identifier for an object within a given Movie.
 void setImage(byte[] bytes)
          Sets the image data.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefineJPEGImage2

public DefineJPEGImage2(SWFDecoder coder)
                 throws IOException
Creates and initialises a DefineJPEGImage2 object using values encoded in the Flash binary format.

Parameters:
coder - an SWFDecoder object that contains the encoded Flash data.
Throws:
IOException - if an error occurs while decoding the data.

DefineJPEGImage2

public DefineJPEGImage2(int uid,
                        byte[] img)
Creates a DefineJPEGImage2 object with the identifier and JPEG image data.

Parameters:
uid - the unique identifier for this object. Must be in the range 1..65535.
img - the JPEG encoded image data. Must not be null.

DefineJPEGImage2

public DefineJPEGImage2(DefineJPEGImage2 object)
Creates and initialises a DefineJPEGImage2 object using the values copied from another DefineJPEGImage2 object.

Parameters:
object - a DefineJPEGImage2 object from which the values will be copied.
Method Detail

getIdentifier

public int getIdentifier()
Get the unique identifier assigned to this object.

Specified by:
getIdentifier in interface DefineTag
Returns:
the unique identifier used by the Flash Player to reference this definition.

setIdentifier

public void setIdentifier(int uid)
Sets the unique identifier for an object within a given Movie.

Specified by:
setIdentifier in interface DefineTag
Parameters:
uid - a unique identifier for the object. Must be in the range 1..65535.

getWidth

public int getWidth()
Get the width of the image in pixels (not twips).

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

getHeight

public int getHeight()
Get the height of the image in pixels (not twips).

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

getImage

public byte[] getImage()
Get a copy of the image.

Returns:
a copy of the data.

setImage

public void setImage(byte[] bytes)
Sets the image data.

Parameters:
bytes - a list of bytes containing the image data. Must not be null.

copy

public DefineJPEGImage2 copy()
Creates a complete copy of this object.

Specified by:
copy in interface Copyable<MovieTag>
Returns:
a deep-copy of this object. New instances of mutable objects are copied and immutable instances are shared.

toString

public String toString()

Overrides:
toString in class Object

prepareToEncode

public int prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. This method also used to initialise variables, such as offsets and flags that will be used when the object is encoded. Generally the method returns the size in bytes, however when called on objects that use bit fields such as shapes the methods will return the size in bits.

Specified by:
prepareToEncode in interface SWFEncodeable
Parameters:
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Returns:
the size of the object when it is encoded.

encode

public void encode(SWFEncoder coder,
                   Context context)
            throws IOException
Encode an object to the Flash binary format.

Specified by:
encode in interface SWFEncodeable
Parameters:
coder - an SWFEncoder object.
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Throws:
IOException - if an error occurs while encoding the object.


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