class JB2Dict: public GPEnabled

Dictionary of JB2 shapes.

Inheritance:


Public Fields

[more]GString comment
Comment string coded by JB2 file.

Public Methods

[more]class JB2Codec JB2Dict()
Null Constructor.
[more]void init()
Resets the JB2Image object.
[more]GP<JB2Dict> get_inherited_dict() const
Returns the inherited dictionary.
[more]int get_inherited_shape_count() const
Returns the number of inherited shapes.
[more]void set_inherited_dict(GP<JB2Dict> dict)
Sets the inherited dictionary.
[more]int get_shape_count() const
Returns the total number of shapes.
[more]JB2Shape* get_shape(int shapeno)
Returns a pointer to shape shapeno.
[more]const JB2Shape* get_shape(int shapeno) const
Returns a constant pointer to shape shapeno.
[more]int add_shape(const JB2Shape &shape)
Appends a shape to the shape array.
[more]void compress()
Compresses all shape bitmaps.
[more]unsigned int get_memory_usage() const
Returns the total memory used by the JB2Image.
[more]void encode(ByteStream &bs) const
Encodes the JB2Dict into ByteStream bs.
[more]void decode(ByteStream &bs, JB2DecoderCallback *cb=0, void *arg=0)
Decodes JB2 data from ByteStream bs.


Inherited from GPEnabled:

Public Methods

oGPEnabled& operator=(const GPEnabled & obj)
oint get_count(void) const

Protected Fields

ovolatile int count


Documentation

Dictionary of JB2 shapes.
oclass JB2Codec JB2Dict()
Null Constructor. Constructs an empty JB2Dict object. You can then call the decoding function decode. You can also manually set the image size using add_shape.

ovoid init()
Resets the JB2Image object. This function reinitializes both the shape and the blit arrays. All allocated memory is freed.

oGP<JB2Dict> get_inherited_dict() const
Returns the inherited dictionary.

oint get_inherited_shape_count() const
Returns the number of inherited shapes.

ovoid set_inherited_dict(GP<JB2Dict> dict)
Sets the inherited dictionary.

oint get_shape_count() const
Returns the total number of shapes. Shape indices range from 0 to get_shape_count()-1.

oJB2Shape* get_shape(int shapeno)
Returns a pointer to shape shapeno. The returned pointer directly points into the shape array. This pointer can be used for reading or writing the shape data.

oconst JB2Shape* get_shape(int shapeno) const
Returns a constant pointer to shape shapeno. The returned pointer directly points into the shape array. This pointer can only be used for reading the shape data.

oint add_shape(const JB2Shape &shape)
Appends a shape to the shape array. This function appends a copy of shape shape to the shape array and returns the subscript of the new shape. The subscript of the parent shape shape.parent must actually designate an already existing shape.

ovoid compress()
Compresses all shape bitmaps. This function reduces the memory required by the JB2Image by calling compress on all shapes bitmaps. This function is best called after decoding a JB2Image, because function get_bitmap can directly use the compressed bitmaps.

ounsigned int get_memory_usage() const
Returns the total memory used by the JB2Image. The returned value is expressed in bytes.

ovoid encode(ByteStream &bs) const
Encodes the JB2Dict into ByteStream bs. This function generates the JB2 data stream without any header.

ovoid decode(ByteStream &bs, JB2DecoderCallback *cb=0, void *arg=0)
Decodes JB2 data from ByteStream bs. This function decodes the image size and populates the shape and blit arrays. The callback function cb is called when the decoder determines that the ByteStream data requires a shape dictionary which has not been set with set_inherited_dict. The callback receives argument arg and must return a suitable dictionary which will be installed as the inherited dictionary. The callback should return null if no such dictionary is found.

oGString comment
Comment string coded by JB2 file.


Direct child classes:
JB2Image

Alphabetic index HTML hierarchy of classes or Java


DjVu is a trademark of LizardTech, Inc.
All other products mentioned are registered trademarks or trademarks of their respective companies.