class DjVuImage: public GPEnabled

Main DjVu Image data structure.

Inheritance:


Public

[more] Construction.

[more] DjVuImage()
Constructs an empty DjVu image.
[more]void init()
Resets a DjVu image and release all memory.

[more] Components.

[more]GP<DjVuInfo> get_info() const
Returns a pointer to a DjVu information component.
[more]GP<DjVuAnno> get_anno() const
Returns a pointer to a DjVu display annotation component.
[more]GP<IWPixmap> get_bg44() const
Returns a pointer to the background component of a DjVu image.
[more]GP<JB2Image> get_fgjb() const
Returns a pointer to the mask of the foreground component of a DjVu image.
[more]GP<GPixmap> get_fgpm() const
Returns a pointer to the colors of the foreground component of a DjVu image.

[more] Utilities

[more]int get_width() const
Returns the width of the DjVu image.
[more]int get_height() const
Returns the height of the DjVu image.
[more]int get_version() const
Returns the format version the DjVu data.
[more]int get_dpi() const
Returns the resolution of the DjVu image.
[more]double get_gamma() const
Returns the gamma coefficient of the display for which the image was designed.
[more]GString get_mimetype() const
Returns a MIME type string describing the DjVu data.
[more]unsigned int get_memory_usage() const
Returns the memory required to store this image.
[more]GString get_short_description() const
Returns a short string describing the DjVu image.
[more]GString get_long_description() const
Returns a verbose description of the DjVu image.

[more] Decoding.

[more]void decode(ByteStream &bs, DjVuInterface *notifier=0)
Decodes DjVu data.

[more] Checking for legal DjVu files.

[more]int is_legal_photo() const
This function returns true if this object contains a well formed Photo DjVu Image.
[more]int is_legal_bilevel() const
This function returns true if this object contains a well formed Bilevel DjVu Image.
[more]int is_legal_compound() const
This function returns true if this object contains a well formed Compound DjVu Image.

[more] Rendering.

[more]GP<GPixmap> get_pixmap(const GRect &rect, const GRect &all, double gamma=0) const
Renders the image and returns a color pixel image.
[more]GP<GBitmap> get_bitmap(const GRect &rect, const GRect &all, int align = 1) const
Renders the mask of the foreground layer of the DjVu image.
[more]GP<GPixmap> get_bg_pixmap(const GRect &rect, const GRect &all, double gamma=0) const
Renders the background layer of the DjVu image.
[more]GP<GPixmap> get_fg_pixmap(const GRect &rect, const GRect &all, double gamma=0) const
Renders the foreground layer of the DjVu image.


Inherited from GPEnabled:

Public Methods

oGPEnabled& operator=(const GPEnabled & obj)

Protected Fields

ovolatile int count

Protected Methods

ovirtual void destroy()


Documentation

Main DjVu Image data structure. This class defines the internal representation of a DjVu image. This representation consists of a few pointers referencing the various components of the DjVu image. These components are created and populated by the decoding function. The rendering functions then can use the available components to compute a pixel representation of the desired segment of the DjVu image.
o Construction.

o DjVuImage()
Constructs an empty DjVu image. Function decode must then be called to populate this DjVu image object.

ovoid init()
Resets a DjVu image and release all memory. Function decode must then be called to populate this DjVu image object.

o Components.

oGP<DjVuInfo> get_info() const
Returns a pointer to a DjVu information component. This function returns a null pointer until the decoder actually processes an "INFO" chunk.

oGP<DjVuAnno> get_anno() const
Returns a pointer to a DjVu display annotation component. This function returns a null pointer until the decoder actually processes an "ANTa" chunk.

oGP<IWPixmap> get_bg44() const
Returns a pointer to the background component of a DjVu image. The background component is always an IW44 image in this implementation. This function returns a null pointer until the decoder actually processes an "BG44" chunk.

oGP<JB2Image> get_fgjb() const
Returns a pointer to the mask of the foreground component of a DjVu image. The mask of the foreground component is always a JB2 image in this implementation. This function returns a null pointer until the decoder actually processes an "Sjbz" chunk.

oGP<GPixmap> get_fgpm() const
Returns a pointer to the colors of the foreground component of a DjVu image. The mask of the foreground component is always a small pixmap in this implementation. This function returns a null pointer until the decoder actually processes an "FG44" chunk.

o Utilities

oint get_width() const
Returns the width of the DjVu image. This function just extracts this information from the DjVu information component. It returns zero if such a component is not yet available.

oint get_height() const
Returns the height of the DjVu image. This function just extracts this information from the DjVu information component. It returns zero if such a component is not yet available.

oint get_version() const
Returns the format version the DjVu data. This function just extracts this information from the DjVu information component. It returns zero if such a component is not yet available. This version number should be compared with the DjVu version constants.

oint get_dpi() const
Returns the resolution of the DjVu image. This information is given in pixels per 2.54 cm. Display programs can use this information to determine the natural magnification to use for rendering a DjVu image.

odouble get_gamma() const
Returns the gamma coefficient of the display for which the image was designed. The rendering functions can use this information in order to perform color correction for the intended display device.

oGString get_mimetype() const
Returns a MIME type string describing the DjVu data. This information is auto-sensed by the decoder. The MIME type can be "image/djvu" or "image/iw44" depending on the data stream.

ounsigned int get_memory_usage() const
Returns the memory required to store this image. This number includes the memory required by all the components of the DjVu image.

oGString get_short_description() const
Returns a short string describing the DjVu image. Example: "2500x3223 in 23.1 Kb".

oGString get_long_description() const
Returns a verbose description of the DjVu image. This description lists all the chunks with their size and a brief comment, as shown in the following example.
      DJVU Image (2325x3156) version 17:
       0.0 Kb   'INFO'  Page information.
       17.3 Kb  'Sjbz'  JB2 foreground mask (2325x3156)
       2.5 Kb   'BG44'  IW44 background (775x1052)
       1.0 Kb   'FG44'  IW44 foreground colors (194x263)
       3.0 Kb   'BG44'  IW44 background (part 2).
       0.9 Kb   'BG44'  IW44 background (part 3).
       7.1 Kb   'BG44'  IW44 background (part 4).
      Compression ratio: 676 (31.8 Kb)
      

o Decoding.

ovoid decode(ByteStream &bs, DjVuInterface *notifier=0)
Decodes DjVu data. This function reads binary data from the ByteStream bs and populates this DjVu image. The decoder can process both IW44 Image files and DjVu Image files. IW44 Image files are in fact handled like Photo DjVu Images. The member functions of the optional argument notifier are called at appropriate times during the decoding process. See class DjVuInterface for more details.

o Checking for legal DjVu files.

oint is_legal_photo() const
This function returns true if this object contains a well formed Photo DjVu Image. Calling function get_pixmap on a well formed photo image should always return a non zero value. Note that function get_pixmap works as soon as sufficient information is present, regardless of the fact that the image follows the rules or not.

oint is_legal_bilevel() const
This function returns true if this object contains a well formed Bilevel DjVu Image. Calling function get_bitmap on a well formed bilevel image should always return a non zero value. Note that function get_bitmap works as soon as a foreground mask component is present, regardless of the fact that the image follows the rules or not.

oint is_legal_compound() const
This function returns true if this object contains a well formed Compound DjVu Image. Calling function get_bitmap or get_pixmap on a well formed compound DjVu image should always return a non zero value. Note that functions get_bitmap or get_pixmap works as soon as sufficient information is present, regardless of the fact that the image follows the rules or not.

o Rendering.
All these functions take two rectangles as argument. Conceptually, these function first render the whole image into a rectangular area defined by rectangle all. The relation between this rectangle and the image size define the appropriate scaling. The rendering function then extract the subrectangle rect and return the corresponding pixels as a GPixmap or GBitmap object. The actual implementation performs these two operation simultaneously for obvious efficiency reasons. The best rendering speed is achieved by making sure that the size of rectangle all and the size of the DjVu image are related by an integer ratio.

oGP<GPixmap> get_pixmap(const GRect &rect, const GRect &all, double gamma=0) const
Renders the image and returns a color pixel image. Rectangles rect and all are used as explained above. Color correction is performed according to argument gamma, which represents the gamma coefficient of the display device on which the pixmap will be rendered. The default value, zero, means that no color correction should be performed. This function returns a null pointer if there is not enough information in the DjVu image to properly render the desired image.

oGP<GBitmap> get_bitmap(const GRect &rect, const GRect &all, int align = 1) const
Renders the mask of the foreground layer of the DjVu image. This functions is a wrapper for get_bitmap. Argument align specified the alignment of the rows of the returned images. Setting align to 4, for instance, will adjust the bitmap border in order to make sure that each row of the returned image starts on a word (four byte) boundary. This function returns a null pointer if there is not enough information in the DjVu image to properly render the desired image.

oGP<GPixmap> get_bg_pixmap(const GRect &rect, const GRect &all, double gamma=0) const
Renders the background layer of the DjVu image. Rectangles rect and all are used as explained above. Color correction is performed according to argument gamma, which represents the gamma coefficient of the display device on which the pixmap will be rendered. The default value, zero, means that no color correction should be performed. This function returns a null pointer if there is not enough information in the DjVu image to properly render the desired image.

oGP<GPixmap> get_fg_pixmap(const GRect &rect, const GRect &all, double gamma=0) const
Renders the foreground layer of the DjVu image. Rectangles rect and all are used as explained above. Color correction is performed according to argument gamma, which represents the gamma coefficient of the display device on which the pixmap will be rendered. The default value, zero, means that no color correction should be performed. This function returns a null pointer if there is not enough information in the DjVu image to properly render the desired image.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java