Blame libdjvu/DjVuImage.h

Packit df99a1
//C-  -*- C++ -*-
Packit df99a1
//C- -------------------------------------------------------------------
Packit df99a1
//C- DjVuLibre-3.5
Packit df99a1
//C- Copyright (c) 2002  Leon Bottou and Yann Le Cun.
Packit df99a1
//C- Copyright (c) 2001  AT&T
Packit df99a1
//C-
Packit df99a1
//C- This software is subject to, and may be distributed under, the
Packit df99a1
//C- GNU General Public License, either Version 2 of the license,
Packit df99a1
//C- or (at your option) any later version. The license should have
Packit df99a1
//C- accompanied the software or you may obtain a copy of the license
Packit df99a1
//C- from the Free Software Foundation at http://www.fsf.org .
Packit df99a1
//C-
Packit df99a1
//C- This program is distributed in the hope that it will be useful,
Packit df99a1
//C- but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit df99a1
//C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit df99a1
//C- GNU General Public License for more details.
Packit df99a1
//C- 
Packit df99a1
//C- DjVuLibre-3.5 is derived from the DjVu(r) Reference Library from
Packit df99a1
//C- Lizardtech Software.  Lizardtech Software has authorized us to
Packit df99a1
//C- replace the original DjVu(r) Reference Library notice by the following
Packit df99a1
//C- text (see doc/lizard2002.djvu and doc/lizardtech2007.djvu):
Packit df99a1
//C-
Packit df99a1
//C-  ------------------------------------------------------------------
Packit df99a1
//C- | DjVu (r) Reference Library (v. 3.5)
Packit df99a1
//C- | Copyright (c) 1999-2001 LizardTech, Inc. All Rights Reserved.
Packit df99a1
//C- | The DjVu Reference Library is protected by U.S. Pat. No.
Packit df99a1
//C- | 6,058,214 and patents pending.
Packit df99a1
//C- |
Packit df99a1
//C- | This software is subject to, and may be distributed under, the
Packit df99a1
//C- | GNU General Public License, either Version 2 of the license,
Packit df99a1
//C- | or (at your option) any later version. The license should have
Packit df99a1
//C- | accompanied the software or you may obtain a copy of the license
Packit df99a1
//C- | from the Free Software Foundation at http://www.fsf.org .
Packit df99a1
//C- |
Packit df99a1
//C- | The computer code originally released by LizardTech under this
Packit df99a1
//C- | license and unmodified by other parties is deemed "the LIZARDTECH
Packit df99a1
//C- | ORIGINAL CODE."  Subject to any third party intellectual property
Packit df99a1
//C- | claims, LizardTech grants recipient a worldwide, royalty-free, 
Packit df99a1
//C- | non-exclusive license to make, use, sell, or otherwise dispose of 
Packit df99a1
//C- | the LIZARDTECH ORIGINAL CODE or of programs derived from the 
Packit df99a1
//C- | LIZARDTECH ORIGINAL CODE in compliance with the terms of the GNU 
Packit df99a1
//C- | General Public License.   This grant only confers the right to 
Packit df99a1
//C- | infringe patent claims underlying the LIZARDTECH ORIGINAL CODE to 
Packit df99a1
//C- | the extent such infringement is reasonably necessary to enable 
Packit df99a1
//C- | recipient to make, have made, practice, sell, or otherwise dispose 
Packit df99a1
//C- | of the LIZARDTECH ORIGINAL CODE (or portions thereof) and not to 
Packit df99a1
//C- | any greater extent that may be necessary to utilize further 
Packit df99a1
//C- | modifications or combinations.
Packit df99a1
//C- |
Packit df99a1
//C- | The LIZARDTECH ORIGINAL CODE is provided "AS IS" WITHOUT WARRANTY
Packit df99a1
//C- | OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
Packit df99a1
//C- | TO ANY WARRANTY OF NON-INFRINGEMENT, OR ANY IMPLIED WARRANTY OF
Packit df99a1
//C- | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Packit df99a1
//C- +------------------------------------------------------------------
Packit df99a1
Packit df99a1
#ifndef _DJVUIMAGE_H
Packit df99a1
#define _DJVUIMAGE_H
Packit df99a1
#ifdef HAVE_CONFIG_H
Packit df99a1
#include "config.h"
Packit df99a1
#endif
Packit df99a1
#if NEED_GNUG_PRAGMAS
Packit df99a1
# pragma interface
Packit df99a1
#endif
Packit df99a1
Packit df99a1
Packit df99a1
/** @name DjVuImage.h
Packit df99a1
Packit df99a1
    Files #"DjVuImage.h"# and #"DjVuImage.cpp"# implement \Ref{DjVuImage}
Packit df99a1
    class produced as a result of decoding of DjVu files. In the previous
Packit df99a1
    version of the library both the rendering {\bf and} decoding have been
Packit df99a1
    handled by \Ref{DjVuImage}. This is no longer true. Now the
Packit df99a1
    \Ref{DjVuDocument} and \Ref{DjVuFile} classes handle decoding of both
Packit df99a1
    single page and multi page documents.
Packit df99a1
Packit df99a1
    For compatibility reasons though, we still support old-style decoding
Packit df99a1
    interface through the \Ref{DjVuImage} class for single page documents
Packit df99a1
    {\em only}. As before, the display programs can call the decoding
Packit df99a1
    function from a separate thread.  The user interface thread may call
Packit df99a1
    the rendering functions at any time. Rendering will be performed using
Packit df99a1
    the most recent data generated by the decoding thread. This multithreaded
Packit df99a1
    capability enables progressive display of remote images.
Packit df99a1
Packit df99a1
    {\bf Creating DjVu images} --- Class \Ref{DjVuImage} does not provide a
Packit df99a1
    direct way to create a DjVu image.  The recommended procedure consists of
Packit df99a1
    directly writing the required chunks into an \Ref{IFFByteStream} as
Packit df99a1
    demonstrated in program \Ref{djvumake}.  Dealing with too many encoding
Packit df99a1
    issues (such as chunk ordering and encoding quality) would indeed make the
Packit df99a1
    decoder unnecessarily complex.
Packit df99a1
Packit df99a1
    {\bf ToDo: Layered structure} --- Class #DjVuImage# currently contains an
Packit df99a1
    unstructured collection of smart pointers to various data structures.
Packit df99a1
    Although it simplifies the rendering routines, this choice does not
Packit df99a1
    reflect the layered structure of DjVu images and does not leave much room
Packit df99a1
    for evolution.  We should be able to do better.
Packit df99a1
Packit df99a1
    @memo
Packit df99a1
    Decoding DjVu and IW44 images.
Packit df99a1
    @author
Packit df99a1
    L\'eon Bottou <leonb@research.att.com> - initial implementation
Packit df99a1
    Andrei Erofeev <eaf@geocities.com> - multipage support
Packit df99a1
*/
Packit df99a1
//@{
Packit df99a1
Packit df99a1
Packit df99a1
Packit df99a1
#include "DjVuFile.h"
Packit df99a1
#include "DjVuAnno.h"
Packit df99a1
#include "GRect.h"
Packit df99a1
Packit df99a1
#ifdef HAVE_NAMESPACES
Packit df99a1
namespace DJVU {
Packit df99a1
# ifdef NOT_DEFINED // Just to fool emacs c++ mode
Packit df99a1
}
Packit df99a1
#endif
Packit df99a1
#endif
Packit df99a1
Packit df99a1
/* Obsolete class included for backward compatibility. */
Packit df99a1
Packit df99a1
class DjVuInterface
Packit df99a1
{
Packit df99a1
public:
Packit df99a1
  virtual ~DjVuInterface();
Packit df99a1
  virtual void notify_chunk(const char *chkid, const char *msg) = 0;
Packit df99a1
  virtual void notify_relayout(void) = 0;
Packit df99a1
  virtual void notify_redisplay(void) = 0;
Packit df99a1
};
Packit df99a1
Packit df99a1
Packit df99a1
/** Main DjVu Image data structure.  This class defines the internal
Packit df99a1
    representation of a DjVu image.  This representation consists of a few
Packit df99a1
    pointers referencing the various components of the DjVu image.  These
Packit df99a1
    components are created and populated by the decoding function.  The
Packit df99a1
    rendering functions then can use the available components to compute a
Packit df99a1
    pixel representation of the desired segment of the DjVu image. */
Packit df99a1
Packit df99a1
class DJVUAPI DjVuImage : public DjVuPort
Packit df99a1
{
Packit df99a1
protected:
Packit df99a1
  DjVuImage(void);
Packit df99a1
public:
Packit df99a1
  enum { NOINFO, NOTEXT=1, NOMAP=4, NOMETA=8 };
Packit df99a1
  // CONSTRUCTION
Packit df99a1
  /** @name Construction. */
Packit df99a1
  //@{
Packit df99a1
  /** Creates an empty DjVu image. After the image has been constructed,
Packit df99a1
      it may be connected to an existing \Ref{DjVuFile} or left as is.
Packit df99a1
Packit df99a1
      In the former case #DjVuImage# will look for its decoded components
Packit df99a1
      (like #Sjbz# or #BG44#) by decending the hierarchy of \Ref{DjVuFile}s
Packit df99a1
      starting from the one passed to \Ref{connect}().
Packit df99a1
Packit df99a1
      In the latter case you can use \Ref{decode}() function to decode
Packit df99a1
      {\bf single-page} DjVu documents in the old-style way. */
Packit df99a1
  static GP<DjVuImage> create(void) {return new DjVuImage();}
Packit df99a1
Packit df99a1
  /** Connects this #DjVuImage# to the passed \Ref{DjVuFile}. The #DjVuImage#
Packit df99a1
      will use this \Ref{DjVuFile} to retrieve components necessary for
Packit df99a1
      decoding. It will also connect itself to \Ref{DjVuFile} using the
Packit df99a1
      communication mechanism provided by \Ref{DjVuPort} and \Ref{DjVuPortcaster}.
Packit df99a1
      This will allow it to receive and relay messages and requests generated
Packit df99a1
      by the passed \Ref{DjVuFile} and any file included into it. */
Packit df99a1
  void		connect(const GP<DjVuFile> & file);
Packit df99a1
Packit df99a1
  /** This combines the above two steps for simplier code operations. */
Packit df99a1
  static GP<DjVuImage> create(const GP<DjVuFile> &file)
Packit df99a1
  { const GP<DjVuImage> retval=create(); retval->connect(file); return retval; }
Packit df99a1
      
Packit df99a1
  //@}
Packit df99a1
Packit df99a1
  // COMPONENTS
Packit df99a1
  /** @name Components. */
Packit df99a1
  //@{
Packit df99a1
  /** Returns a pointer to a DjVu information component.
Packit df99a1
      This function returns a null pointer until the decoder
Packit df99a1
      actually processes an #"INFO"# chunk. */
Packit df99a1
  GP<DjVuInfo>    get_info() const;
Packit df99a1
  /** Returns a pointer to the IW44 encoded background component of a DjVu
Packit df99a1
      image.  This function returns a null pointer until the decoder actually
Packit df99a1
      processes an #"BG44"# chunk. */
Packit df99a1
  GP<IW44Image>    get_bg44() const;
Packit df99a1
  /** Returns a pointer to the raw background component of a DjVu image. The
Packit df99a1
      background component is used for JPEG encoded backgrounds.  This
Packit df99a1
      function returns a null pointer until the decoder actually processes an
Packit df99a1
      #"BGjp"# chunk. */
Packit df99a1
  GP<GPixmap>     get_bgpm() const;
Packit df99a1
  /** Returns a pointer to the mask of the foreground component of a DjVu
Packit df99a1
      image. The mask of the foreground component is always a JB2 image in
Packit df99a1
      this implementation. This function returns a null pointer until the
Packit df99a1
      decoder actually processes an #"Sjbz"# chunk. */
Packit df99a1
  GP<JB2Image>    get_fgjb() const;
Packit df99a1
  /** Returns a pointer to the colors of the foreground component of a DjVu
Packit df99a1
      image. The mask of the foreground component is always a small pixmap in
Packit df99a1
      this implementation. This function returns a null pointer until the
Packit df99a1
      decoder actually processes an #"FG44"# chunk. */
Packit df99a1
  GP<GPixmap>     get_fgpm() const;
Packit df99a1
  /** Returns a pointer to a palette object containing colors for the 
Packit df99a1
      foreground components of a DjVu image.  These colors are only
Packit df99a1
      pertinent with respect to the JB2Image. */
Packit df99a1
  GP<DjVuPalette> get_fgbc() const;
Packit df99a1
  /** Returns a pointer to a ByteStream containing all the annotation
Packit df99a1
      chunks collected so far for this image.  Individual chunks can be
Packit df99a1
      retrieved using \Ref{IFFByteStream}. Returns NULL if no chunks have been
Packit df99a1
      collected yet. */
Packit df99a1
  GP<ByteStream> get_anno() const;
Packit df99a1
  /** Returns a pointer to a ByteStream containing all the hidden text.
Packit df99a1
      Returns NULL if no chunks have been collected yet. */
Packit df99a1
  GP<ByteStream> get_text() const;
Packit df99a1
  /** Returns a pointer to a ByteStream containing all the metadata.
Packit df99a1
      Returns NULL if no chunks have been collected yet. */
Packit df99a1
  GP<ByteStream> get_meta() const;
Packit df99a1
  //@}
Packit df99a1
Packit df99a1
  // NEW STYLE DECODING
Packit df99a1
  /** @name New style decoding. */
Packit df99a1
  //@{
Packit df99a1
  /** The decoder is now started when the image is created
Packit df99a1
      by function \Ref{DjVuDocument::get_page} in \Ref{DjVuDocument}. 
Packit df99a1
      This function waits until the decoding thread terminates
Packit df99a1
      and returns TRUE if the image has been successfully decoded. */
Packit df99a1
  bool wait_for_complete_decode(void);
Packit df99a1
  //@}
Packit df99a1
  
Packit df99a1
  // OLD STYLE DECODING
Packit df99a1
  /** @name Old style decoding (backward compatibility). */
Packit df99a1
  //@{
Packit df99a1
  /** This function is here for backward compatibility. Now, with the
Packit df99a1
      introduction of multipage DjVu documents, the decoding is handled
Packit df99a1
      by \Ref{DjVuFile} and \Ref{DjVuDocument} classes. For single page
Packit df99a1
      documents though, we still have this wrapper. */
Packit df99a1
  void decode(ByteStream & str, DjVuInterface *notifier=0);
Packit df99a1
  //@}
Packit df99a1
  
Packit df99a1
  // UTILITIES
Packit df99a1
  /** @name Utilities */
Packit df99a1
  //@{
Packit df99a1
  /** Returns the width of the DjVu image. This function just extracts this
Packit df99a1
      information from the DjVu information component. It returns zero if such
Packit df99a1
      a component is not yet available. This gives rotated width if there is any
Packit df99a1
      rotation of image. If you need real width, use #get_real_width()#.*/
Packit df99a1
  int get_width() const;
Packit df99a1
  /** Returns the height of the DjVu image. This function just extracts this
Packit df99a1
      information from the DjVu information component. It returns zero if such
Packit df99a1
      a component is not yet available. This gives rotated height if there is any
Packit df99a1
      rotation of image. If you need real width, use #get_real_height()#.*/
Packit df99a1
  int get_height() const;
Packit df99a1
  /** Returns the width of the DjVu image. This function just extracts this
Packit df99a1
      information from the DjVu information component. It returns zero if such
Packit df99a1
      a component is not yet available.*/
Packit df99a1
  int get_real_width() const;
Packit df99a1
  /** Returns the height of the DjVu image. This function just extracts this
Packit df99a1
      information from the DjVu information component. It returns zero if such
Packit df99a1
      a component is not yet available.*/
Packit df99a1
  int get_real_height() const;
Packit df99a1
  /** Returns the format version the DjVu data. This function just extracts
Packit df99a1
      this information from the DjVu information component. It returns zero if
Packit df99a1
      such a component is not yet available.  This version number should
Packit df99a1
      be compared with the \Ref{DjVu version constants}. */
Packit df99a1
  int get_version() const;
Packit df99a1
  /** Returns the resolution of the DjVu image. This information is given in
Packit df99a1
      pixels per 2.54 cm.  Display programs can use this information to
Packit df99a1
      determine the natural magnification to use for rendering a DjVu
Packit df99a1
      image. */
Packit df99a1
  int get_dpi() const;
Packit df99a1
  /** Same as \Ref{get_dpi}() but instead of precise value returns the closest
Packit df99a1
      "standard" one: 25, 50, 75, 100, 150, 300, 600. If dpi is greater than
Packit df99a1
      700, it's returned as is. */
Packit df99a1
  int get_rounded_dpi() const;
Packit df99a1
  /** Returns the gamma coefficient of the display for which the image was
Packit df99a1
      designed.  The rendering functions can use this information in order to
Packit df99a1
      perform color correction for the intended display device. */
Packit df99a1
  double get_gamma() const;
Packit df99a1
  /** Returns a MIME type string describing the DjVu data.  This information
Packit df99a1
      is auto-sensed by the decoder.  The MIME type can be #"image/djvu"# or
Packit df99a1
      #"image/iw44"# depending on the data stream. */
Packit df99a1
  GUTF8String get_mimetype() const;
Packit df99a1
  /** Returns a short string describing the DjVu image.
Packit df99a1
      Example: #"2500x3223 in 23.1 Kb"#. */
Packit df99a1
  GUTF8String get_short_description() const;
Packit df99a1
  /** Returns a verbose description of the DjVu image.  This description lists
Packit df99a1
      all the chunks with their size and a brief comment, as shown in the
Packit df99a1
      following example.
Packit df99a1
      \begin{verbatim}
Packit df99a1
      DJVU Image (2325x3156) version 17:
Packit df99a1
       0.0 Kb   'INFO'  Page information.
Packit df99a1
       17.3 Kb  'Sjbz'  JB2 foreground mask (2325x3156)
Packit df99a1
       2.5 Kb   'BG44'  IW44 background (775x1052)
Packit df99a1
       1.0 Kb   'FG44'  IW44 foreground colors (194x263)
Packit df99a1
       3.0 Kb   'BG44'  IW44 background (part 2).
Packit df99a1
       0.9 Kb   'BG44'  IW44 background (part 3).
Packit df99a1
       7.1 Kb   'BG44'  IW44 background (part 4).
Packit df99a1
      Compression ratio: 676 (31.8 Kb)
Packit df99a1
      \end{verbatim} */
Packit df99a1
  GUTF8String get_long_description() const;
Packit df99a1
  /** Returns pointer to \Ref{DjVuFile} which contains this image in
Packit df99a1
      compressed form. */
Packit df99a1
  GP<DjVuFile> get_djvu_file(void) const;
Packit df99a1
  /// Write out a DjVuXML object tag and map tag.
Packit df99a1
  void writeXML(ByteStream &str_out,const GURL &doc_url, const int flags=0) const;
Packit df99a1
  /// Write out a DjVuXML object tag and map tag.
Packit df99a1
  void writeXML(ByteStream &str_out) const;
Packit df99a1
  /// Get a DjVuXML object tag and map tag.
Packit df99a1
  GUTF8String get_XML(const GURL &doc_url, const int flags=0) const;
Packit df99a1
  /// Get a DjVuXML object tag and map tag.
Packit df99a1
  GUTF8String get_XML(void) const;
Packit df99a1
  //@}
Packit df99a1
Packit df99a1
  // CHECKING
Packit df99a1
  /** @name Checking for legal DjVu files. */
Packit df99a1
  //@{
Packit df99a1
  /** This function returns true if this object contains a well formed {\em
Packit df99a1
      Photo DjVu Image}. Calling function #get_pixmap# on a well formed photo
Packit df99a1
      image should always return a non zero value.  Note that function
Packit df99a1
      #get_pixmap# works as soon as sufficient information is present,
Packit df99a1
      regardless of the fact that the image follows the rules or not. */
Packit df99a1
  int is_legal_photo() const;
Packit df99a1
  /** This function returns true if this object contains a well formed {\em
Packit df99a1
      Bilevel DjVu Image}.  Calling function #get_bitmap# on a well formed
Packit df99a1
      bilevel image should always return a non zero value.  Note that function
Packit df99a1
      #get_bitmap# works as soon as a foreground mask component is present,
Packit df99a1
      regardless of the fact that the image follows the rules or not. */
Packit df99a1
  int is_legal_bilevel() const;
Packit df99a1
  /** This function returns true if this object contains a well formed {\em
Packit df99a1
      Compound DjVu Image}.  Calling function #get_bitmap# or #get_pixmap# on
Packit df99a1
      a well formed compound DjVu image should always return a non zero value.
Packit df99a1
      Note that functions #get_bitmap# or #get_pixmap# works as soon as
Packit df99a1
      sufficient information is present, regardless of the fact that the image
Packit df99a1
      follows the rules or not.  */
Packit df99a1
  int is_legal_compound() const;
Packit df99a1
  //@}
Packit df99a1
Packit df99a1
  // RENDERING 
Packit df99a1
  /** @name Rendering.  
Packit df99a1
      All these functions take two rectangles as argument.  Conceptually,
Packit df99a1
      these function first render the whole image into a rectangular area
Packit df99a1
      defined by rectangle #all#.  The relation between this rectangle and the
Packit df99a1
      image size define the appropriate scaling.  The rendering function then
Packit df99a1
      extract the subrectangle #rect# and return the corresponding pixels as a
Packit df99a1
      #GPixmap# or #GBitmap# object.  The #all# and #rect# should take the any
Packit df99a1
      rotation in to effect, The actual implementation performs these
Packit df99a1
      two operation simultaneously for obvious efficiency reasons.  The best
Packit df99a1
      rendering speed is achieved by making sure that the size of rectangle
Packit df99a1
      #all# and the size of the DjVu image are related by an integer ratio. */
Packit df99a1
  //@{
Packit df99a1
  /** Renders the image and returns a color pixel image.  Rectangles #rect#
Packit df99a1
      and #all# are used as explained above. Color correction is performed
Packit df99a1
      according to argument #gamma#, which represents the gamma coefficient of
Packit df99a1
      the display device on which the pixmap will be rendered.  The default
Packit df99a1
      value, zero, means that no color correction should be performed. 
Packit df99a1
      This function returns a null pointer if there is not enough information
Packit df99a1
      in the DjVu image to properly render the desired image. */
Packit df99a1
  GP<GPixmap>  get_pixmap(const GRect &rect, const GRect &all, 
Packit df99a1
                          double gamma, GPixel white) const;
Packit df99a1
  GP<GPixmap>  get_pixmap(const GRect &rect, const GRect &all, 
Packit df99a1
                          double gamma=0) const;
Packit df99a1
  /** Renders the mask of the foreground layer of the DjVu image.  This
Packit df99a1
      functions is a wrapper for \Ref{JB2Image::get_bitmap}.  Argument #align#
Packit df99a1
      specified the alignment of the rows of the returned images.  Setting
Packit df99a1
      #align# to #4#, for instance, will adjust the bitmap border in order to
Packit df99a1
      make sure that each row of the returned image starts on a word (four
Packit df99a1
      byte) boundary.  This function returns a null pointer if there is not
Packit df99a1
      enough information in the DjVu image to properly render the desired
Packit df99a1
      image. */
Packit df99a1
  GP<GBitmap>  get_bitmap(const GRect &rect, const GRect &all, 
Packit df99a1
                          int align = 1) const;
Packit df99a1
  /** Renders the background layer of the DjVu image.  Rectangles #rect# and
Packit df99a1
      #all# are used as explained above. Color correction is performed
Packit df99a1
      according to argument #gamma#, which represents the gamma coefficient of
Packit df99a1
      the display device on which the pixmap will be rendered.  The default
Packit df99a1
      value, zero, means that no color correction should be performed.  This
Packit df99a1
      function returns a null pointer if there is not enough information in
Packit df99a1
      the DjVu image to properly render the desired image. */
Packit df99a1
  GP<GPixmap>  get_bg_pixmap(const GRect &rect, const GRect &all, 
Packit df99a1
                             double gamma, GPixel white) const;
Packit df99a1
  GP<GPixmap>  get_bg_pixmap(const GRect &rect, const GRect &all, 
Packit df99a1
                             double gamma=0) const;
Packit df99a1
  /** Renders the foreground layer of the DjVu image.  Rectangles #rect# and
Packit df99a1
      #all# are used as explained above. Color correction is performed
Packit df99a1
      according to argument #gamma#, which represents the gamma coefficient of
Packit df99a1
      the display device on which the pixmap will be rendered.  The default
Packit df99a1
      value, zero, means that no color correction should be performed.  This
Packit df99a1
      function returns a null pointer if there is not enough information in
Packit df99a1
      the DjVu image to properly render the desired image. */
Packit df99a1
  GP<GPixmap>  get_fg_pixmap(const GRect &rect, const GRect &all, 
Packit df99a1
                             double gamma, GPixel white) const;
Packit df99a1
  GP<GPixmap>  get_fg_pixmap(const GRect &rect, const GRect &all, 
Packit df99a1
                             double gamma=0) const;
Packit df99a1
Packit df99a1
Packit df99a1
  /** set the rotation count(angle) in counter clock wise for the image
Packit df99a1
    values (0,1,2,3) correspond to (0,90,180,270) degree rotation*/
Packit df99a1
  void set_rotate(int count=0);
Packit df99a1
  /** returns the rotation count*/
Packit df99a1
  int get_rotate() const;
Packit df99a1
  /** returns decoded annotations in DjVuAnno object in which all hyperlinks
Packit df99a1
      and hilighted areas are rotated as per rotation setting*/
Packit df99a1
  GP<DjVuAnno> get_decoded_anno();
Packit df99a1
  /** maps the given #rect# from rotated co-ordinates to unrotated document 
Packit df99a1
      co-ordinates*/
Packit df99a1
  void map(GRect &rect) const;
Packit df99a1
  /** unmaps the given #rect# from unrotated document co-ordinates to rotated  
Packit df99a1
      co-ordinates*/
Packit df99a1
  void unmap(GRect &rect) const;
Packit df99a1
  /** maps the given #x#, #y# from rotated co-ordinates to unrotated document 
Packit df99a1
      co-ordinates*/
Packit df99a1
  void map(int &x, int &y) const;
Packit df99a1
  /** unmaps the given #x#, #y# from unrotated document co-ordinates to rotated  
Packit df99a1
      co-ordinates*/
Packit df99a1
  void unmap(int &x, int &y) const;
Packit df99a1
Packit df99a1
Packit df99a1
Packit df99a1
  //@}
Packit df99a1
Packit df99a1
  // Inherited from DjVuPort.
Packit df99a1
  virtual void notify_chunk_done(const DjVuPort *, const GUTF8String &name);
Packit df99a1
Packit df99a1
  // SUPERSEDED
Packit df99a1
  GP<GPixmap>  get_pixmap(const GRect &r, int s=1, double g=0) const;
Packit df99a1
  GP<GPixmap>  get_pixmap(const GRect &r, int s, double g, GPixel w) const;
Packit df99a1
  GP<GBitmap>  get_bitmap(const GRect &r, int s=1, int align = 1) const;
Packit df99a1
  GP<GPixmap>  get_bg_pixmap(const GRect &r, int s=1, double g=0) const;
Packit df99a1
  GP<GPixmap>  get_bg_pixmap(const GRect &r, int s, double g, GPixel w) const;
Packit df99a1
  GP<GPixmap>  get_fg_pixmap(const GRect &r, int s=1, double g=0) const;
Packit df99a1
  GP<GPixmap>  get_fg_pixmap(const GRect &r, int s, double g, GPixel w) const;
Packit df99a1
private:
Packit df99a1
  GP<DjVuFile>		file;
Packit df99a1
  int			rotate_count;
Packit df99a1
  bool			relayout_sent;
Packit df99a1
  
Packit df99a1
  // HELPERS
Packit df99a1
  int stencil(GPixmap *pm, const GRect &rect, int s, double g, GPixel w) const;
Packit df99a1
  GP<DjVuInfo>		get_info(const GP<DjVuFile> & file) const;
Packit df99a1
  GP<IW44Image>		get_bg44(const GP<DjVuFile> & file) const;
Packit df99a1
  GP<GPixmap>		get_bgpm(const GP<DjVuFile> & file) const;
Packit df99a1
  GP<JB2Image>		get_fgjb(const GP<DjVuFile> & file) const;
Packit df99a1
  GP<GPixmap>		get_fgpm(const GP<DjVuFile> & file) const;
Packit df99a1
  GP<DjVuPalette>      get_fgbc(const GP<DjVuFile> & file) const;
Packit df99a1
  void init_rotate(const DjVuInfo &info;;
Packit df99a1
};
Packit df99a1
Packit df99a1
Packit df99a1
inline GP<DjVuFile>
Packit df99a1
DjVuImage::get_djvu_file(void) const
Packit df99a1
{
Packit df99a1
   return file;
Packit df99a1
}
Packit df99a1
Packit df99a1
//@}
Packit df99a1
Packit df99a1
Packit df99a1
Packit df99a1
// ----- THE END
Packit df99a1
Packit df99a1
#ifdef HAVE_NAMESPACES
Packit df99a1
}
Packit df99a1
# ifndef NOT_USING_DJVU_NAMESPACE
Packit df99a1
using namespace DJVU;
Packit df99a1
# endif
Packit df99a1
#endif
Packit df99a1
#endif