|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.flagstone.transform.image.DefineImage2
public final class DefineImage2
DefineImage2 is used to define a transparent image compressed using the lossless zlib compression algorithm.
The class supports colour-mapped images where the image data contains an index into a colour table or direct-mapped images where the colour is specified directly. It extends DefineImage by including alpha channel information for the colour table and pixels in the image.
For colour-mapped images the colour table contains up to 256, 32-bit colours. The image contains one byte for each pixel which is an index into the table to specify the colour for that pixel. The colour table and the image data are compressed as a single block, with the colour table placed before the image.
For images where the colour is specified directly, the image data contains 32 bit colour values.
The image data is stored in zlib compressed form within the object. For colour-mapped images the compressed data contains the colour table followed by the image data.
DefineImage| Constructor Summary | |
|---|---|
DefineImage2(DefineImage2 object)
Creates and initialises a DefineImage2 object using the values copied from another DefineImage2 object. |
|
DefineImage2(int uid,
int imgWidth,
int imgHeight,
byte[] data)
Creates a DefineImage object defining a true-colour image. |
|
DefineImage2(int uid,
int imgWidth,
int imgHeight,
int size,
byte[] data)
Creates a DefineImage2 object defining a colour-mapped image. |
|
DefineImage2(SWFDecoder coder)
Creates and initialises an DefineImage2 object using values encoded in the Flash binary format. |
|
| Method Summary | |
|---|---|
DefineImage2 |
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 compressed colour table and image. |
int |
getPixelSize()
Get the number of bits used to represent each pixel. |
int |
getTableSize()
Get the number of entries in the colour table encoded the compressed 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 |
setHeight(int aNumber)
Sets the height of the image in pixels. |
void |
setIdentifier(int uid)
Sets the unique identifier for an object within a given Movie. |
void |
setImage(byte[] bytes)
Sets the data containing the compressed image and colour table. |
void |
setPixelSize(int size)
Sets the size of the pixel in bits: 8 for colour-mapped images, 32 for direct images. |
void |
setTableSize(int size)
Sets the number of entries in the colour table in the compressed image. |
void |
setWidth(int aNumber)
Sets the width of the image in pixels. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DefineImage2(SWFDecoder coder)
throws IOException
coder - an SWFDecoder object that contains the encoded Flash data.
IOException - if an error occurs while decoding the data.
public DefineImage2(int uid,
int imgWidth,
int imgHeight,
int size,
byte[] data)
uid - the unique identifier for this object. Must be in the range
1..65535.imgWidth - the width of the image. Must be in the range 0..65535.imgHeight - the height of the image. Must be in the range 0..65535.size - the number of entries in the colour table in the compressed
data. Each entry is 32 bits. Must be in the range 1..256.data - the zlib compressed colour table and image data. Must not be
null.
public DefineImage2(int uid,
int imgWidth,
int imgHeight,
byte[] data)
uid - the unique identifier for this object. Must be in the range
1..65535.imgWidth - the width of the image. Must be in the range 0..65535.imgHeight - the height of the image. Must be in the range 0..65535.data - the zlib compressed image data. Must not be null.public DefineImage2(DefineImage2 object)
object - a DefineImage2 object from which the values will be
copied.| Method Detail |
|---|
public int getIdentifier()
getIdentifier in interface DefineTagpublic void setIdentifier(int uid)
setIdentifier in interface DefineTaguid - a unique identifier for the object. Must be in the range
1..65535.public int getWidth()
getWidth in interface ImageTagpublic int getHeight()
getHeight in interface ImageTagpublic int getPixelSize()
public int getTableSize()
public byte[] getImage()
public void setWidth(int aNumber)
aNumber - the width of the image. Must be in the range of 0..65535.public void setHeight(int aNumber)
aNumber - the height of the image. Must be in the range of 0..65535.public void setPixelSize(int size)
size - the size of each pixel in bits: must be either 8 or 32.public void setTableSize(int size)
size - the number of entries in the colour table in the compressed
image. Must be in the range 1..256.public void setImage(byte[] bytes)
bytes - byte array containing zlib compressed colour table and image.
Must not be null.public DefineImage2 copy()
copy in interface Copyable<MovieTag>public String toString()
toString in class Objectpublic int prepareToEncode(Context context)
prepareToEncode in interface SWFEncodeablecontext - an Context that allows information to be passed between
objects to control how they are initialised for encoding.
public void encode(SWFEncoder coder,
Context context)
throws IOException
encode in interface SWFEncodeablecoder - an SWFEncoder object.context - an Context that allows information to be passed between
objects to control how they are initialised for encoding.
IOException - if an error occurs while encoding the object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||