|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.flagstone.transform.FSTransformObject
com.flagstone.transform.FSMovieObject
com.flagstone.transform.FSDefineObject
com.flagstone.transform.FSDefineImage
public class FSDefineImage
FSDefineImage is used to define an 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 images where the image data specifies the colour directly.
Attributes | |
---|---|
type | Identifies the data structure when it is encoded. Read-only. |
identifier | A unique identifier, in the range 1..65535, that is used to reference the image from other objects. |
width | Width of the image in pixels, NOT twips. 1 pixel = 20 twips. |
height | Height of the image in pixels, NOT twips. 1 pixel = 20 twips. |
pixelSize | The number of bits per pixel, either 16 or 24. |
tableSize | The number of entries in the colour table - which is compressed as part of the image. Each entry in the colour table contains one byte each for the red, green and blue colour channels. The colour table is only used for indexed colour images. The table is not used when the colour is specified directly in each pixel. |
compressedData | An array of bytes containing the zlib compressed colour table and image. |
For colour-mapped images the colour table contains up to 256, 24-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 either 16 or 24 bit colour values. For 16-bit colour values the most significant bit is zero followed by three, 5-bit fields for the red, green and blue channels:
+-+--------+--------+--------+ |0| Red | Green | Blue | +-+--------+--------+--------+ 15 0
Four bytes are used to represent 24-bit colours. The first byte is always set to zero and the following bytes contain the colour values for the red, green and blue colour channels.
The number of bytes in each row of an image must be aligned to a 32-bit word boundary. For example if an image if an icon is 25 pixels wide, then for an 8-bit colour mapped image an additional three bytes (0x00) must be used to pad each row; for a 16-bit direct mapped colour image an additional two bytes must be used as padding.
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. The colour table is omitted for direct-mapped images.
The FSDefineImage class represents the DefineBitsLossless tag from the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 2.
Field Summary |
---|
Fields inherited from class com.flagstone.transform.FSDefineObject |
---|
identifier |
Constructor Summary | |
---|---|
FSDefineImage(FSCoder coder)
Construct an FSDefineImage object, initialising it with values decoded from an encoded object. |
|
FSDefineImage(FSDefineImage obj)
Constructs an FSDefineImage object by copying values from an existing object. |
|
FSDefineImage(int anIdentifier,
int width,
int height,
byte[] compressedBytes,
int aPixelSize)
Constructs an FSDefineImage object defining an image that specifies the colour directly. |
|
FSDefineImage(int anIdentifier,
int width,
int height,
int tableSize,
byte[] compressedBytes)
Constructs an FSDefineImage object defining a colour-mapped image. |
Method Summary | |
---|---|
void |
appendDescription(java.lang.StringBuffer buffer,
int depth)
AppendDescription is used to present a string description of the object including all nested objects up to a specified depth. |
java.lang.Object |
clone()
Creates a deep copy of the entire object. |
void |
decode(FSCoder coder)
|
void |
encode(FSCoder coder)
|
boolean |
equals(java.lang.Object anObject)
Returns true if anObject is equal to this one. |
byte[] |
getCompressedData()
Gets the compressed colour table and image. |
int |
getHeight()
Gets the height of the image. |
int |
getPixelSize()
Gets the number of bits used to represent each pixel. |
int |
getTableSize()
Gets the number of entries in the colour table encoded the compressed image. |
int |
getWidth()
Gets the width of the image. |
int |
length(FSCoder coder)
|
void |
setCompressedData(byte[] bytes)
Sets the compressed image data using compressed data. |
void |
setHeight(int aNumber)
Sets the height of the image. |
void |
setPixelSize(int aNumber)
Sets the size of the pixel in bits: 8, 16 or 32. |
void |
setTableSize(int aNumber)
Sets the number of entries in the colour table in the compressed image. |
void |
setWidth(int aNumber)
Sets the width of the image |
Methods inherited from class com.flagstone.transform.FSDefineObject |
---|
getIdentifier, setIdentifier |
Methods inherited from class com.flagstone.transform.FSMovieObject |
---|
getType |
Methods inherited from class com.flagstone.transform.FSTransformObject |
---|
name, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FSDefineImage(FSCoder coder)
coder
- an FSCoder containing the binary data.public FSDefineImage(int anIdentifier, int width, int height, int tableSize, byte[] compressedBytes)
anIdentifier
- the unique identifier for this objectwidth
- the width of the image.height
- the height of the image.tableSize
- the number of entries in the colour table in the compressed
data. Each entry is 24 bits.compressedBytes
- the zlib compressed colour table and image data.public FSDefineImage(int anIdentifier, int width, int height, byte[] compressedBytes, int aPixelSize)
anIdentifier
- the unique identifier for this objectwidth
- the width of the image.height
- the height of the image.compressedBytes
- the zlib compressed image data.aPixelSize
- the size of each pixel, either 16 or 24 bits.public FSDefineImage(FSDefineImage obj)
obj
- an FSDefineImage object.Method Detail |
---|
public int getWidth()
public int getHeight()
public int getPixelSize()
public int getTableSize()
public byte[] getCompressedData()
public void setWidth(int aNumber)
aNumber
- the width of the image.public void setHeight(int aNumber)
aNumber
- the height of the image in pixels.public void setPixelSize(int aNumber)
aNumber
- the size of each pixel in bits: 8, 16 or 24.public void setTableSize(int aNumber)
aNumber
- the number of entries in the colour table in the compressed
image.public void setCompressedData(byte[] bytes)
bytes
- byte array containing zlib compressed colour table and image.public java.lang.Object clone()
FSTransformObject
clone
in class FSTransformObject
public boolean equals(java.lang.Object anObject)
FSMovieObject
equals
in class FSMovieObject
public void appendDescription(java.lang.StringBuffer buffer, int depth)
FSTransformObject
appendDescription
in class FSDefineObject
buffer
- a StringBuffer to which the description of each object is
appended.depth
- the maximum level of nesting up to which objects will be
displayed.public int length(FSCoder coder)
length
in class FSDefineObject
public void encode(FSCoder coder)
encode
in class FSDefineObject
public void decode(FSCoder coder)
decode
in class FSDefineObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |