Blame libdjvu/DjVuInfo.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 _DJVUINFO_H
Packit df99a1
#define _DJVUINFO_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 DjVuInfo.h
Packit df99a1
    Each instance of class #DjVuInfo# represents the information
Packit df99a1
    contained in the information chunk of a DjVu file.  This #"INFO"#
Packit df99a1
    chunk is always the first chunk of a DjVu file.
Packit df99a1
    @memo
Packit df99a1
    DjVu information chunk.
Packit df99a1
    @author
Packit df99a1
    L\'eon Bottou <leonb@research.att.com>
Packit df99a1
*/
Packit df99a1
//@{
Packit df99a1
Packit df99a1
Packit df99a1
Packit df99a1
#include "GSmartPointer.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
class ByteStream;
Packit df99a1
Packit df99a1
/** @name DjVu version constants
Packit df99a1
    @memo DjVu file format version. */
Packit df99a1
//@{
Packit df99a1
/** Current DjVu format version.  The value of this macro represents the
Packit df99a1
    version of the DjVu file format implemented by this release of the DjVu
Packit df99a1
    Reference Library. */
Packit df99a1
#define DJVUVERSION              26
Packit df99a1
/** DjVu format version. This is the value used in files produced 
Packit df99a1
    with DjVuLibre. This is smaller than DJVUVERSION because version
Packit df99a1
    number inflation causes problems with older software. */ 
Packit df99a1
#define DJVUVERSION_FOR_OUTPUT   24
Packit df99a1
/** This is the version which introduced orientations. */
Packit df99a1
#define DJVUVERSION_ORIENTATION  22
Packit df99a1
/** Oldest DjVu format version supported by this library.  This release of the
Packit df99a1
    library cannot completely decode DjVu files whose version field is less
Packit df99a1
    than or equal to this number. */
Packit df99a1
#define DJVUVERSION_TOO_OLD      15
Packit df99a1
/** Newest DjVu format partially supported by this library.  This release of
Packit df99a1
    the library will attempt to decode files whose version field is smaller
Packit df99a1
    than this macro.  If the version field is greater than or equal to this
Packit df99a1
    number, the decoder will just throw a \Ref{GException}.  */
Packit df99a1
#define DJVUVERSION_TOO_NEW      50
Packit df99a1
//@}
Packit df99a1
Packit df99a1
Packit df99a1
class GUTF8String;
Packit df99a1
Packit df99a1
/** Information component.
Packit df99a1
    Each instance of class #DjVuInfo# represents the information
Packit df99a1
    contained in the information chunk of a DjVu file.  This #"INFO"#
Packit df99a1
    chunk is always the first chunk of a DjVu file.
Packit df99a1
 */
Packit df99a1
Packit df99a1
class DJVUAPI DjVuInfo : public GPEnabled
Packit df99a1
{
Packit df99a1
protected:
Packit df99a1
  DjVuInfo(void);
Packit df99a1
public:
Packit df99a1
  /** Creates an empty DjVuInfo object.
Packit df99a1
      The #width# and #height# fields are set to zero.
Packit df99a1
      All other fields are initialized with suitable default values. */
Packit df99a1
  static GP<DjVuInfo> create(void) {return new DjVuInfo();}
Packit df99a1
Packit df99a1
  /** Decodes the DjVu #"INFO"# chunk.  This function reads binary data from
Packit df99a1
      ByteStream #bs# and populates the fields of this DjVuInfo object.  It is
Packit df99a1
      normally called after detecting an #"INFO"# chunk header with function
Packit df99a1
      \Ref{IFFByteStream::get_chunk}. */
Packit df99a1
  void decode(ByteStream &bs);
Packit df99a1
  /** Encodes the DjVu #"INFO"# chunk. This function writes the fields of this
Packit df99a1
      DjVuInfo object into ByteStream #bs#. It is normally called after
Packit df99a1
      creating an #"INFO"# chunk header with function
Packit df99a1
      \Ref{IFFByteStream::put_chunk}. */
Packit df99a1
  void encode(ByteStream &bs);  
Packit df99a1
  /** Returns the number of bytes used by this object. */
Packit df99a1
  unsigned int get_memory_usage() const;
Packit df99a1
  /** Width of the DjVu image (in pixels). */
Packit df99a1
  int width;
Packit df99a1
  /** Height of the DjVu image (in pixels). */
Packit df99a1
  int height;
Packit df99a1
  /** DjVu file version number.  This number characterizes the file format
Packit df99a1
      version used by the encoder to generate this DjVu image.  A decoder
Packit df99a1
      should compare this version number with the constants described in
Packit df99a1
      section "\Ref{DjVu version constants}". */
Packit df99a1
  int version;
Packit df99a1
  /** Resolution of the DjVu image.  The resolution is given in ``pixels per
Packit df99a1
      2.54 centimeters'' (this unit is sometimes called ``pixels per
Packit df99a1
      inch''). Display programs can use this information to determine the
Packit df99a1
      natural magnification to use for rendering a DjVu image. */
Packit df99a1
  int dpi;
Packit df99a1
  /** Gamma coefficient of the display for which the image was designed.  The
Packit df99a1
      rendering functions can use this information in order to perform color
Packit df99a1
      correction for the intended display device. */
Packit df99a1
  double gamma;
Packit df99a1
Packit df99a1
  /** Image orientation:
Packit df99a1
      0: no rotation      1: 90 degrees counter-clockwise
Packit df99a1
      2: 180 degrees      3: 270 degrees counter-clockwise */
Packit df99a1
  int orientation;
Packit df99a1
Packit df99a1
     /// Obtain the flags for the default specifications.
Packit df99a1
  GUTF8String get_paramtags(void) const;
Packit df99a1
     /// Obtain the flags for the default specifications.
Packit df99a1
  void writeParam(ByteStream &out_str) const;
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