source: trunk/libdjvu/DjVuInfo.h @ 209

Last change on this file since 209 was 206, checked in by Eugene Romanenko, 14 years ago

DJVU plugin: djvulibre updated to version 3.5.19

File size: 7.5 KB
Line 
1//C-  -*- C++ -*-
2//C- -------------------------------------------------------------------
3//C- DjVuLibre-3.5
4//C- Copyright (c) 2002  Leon Bottou and Yann Le Cun.
5//C- Copyright (c) 2001  AT&T
6//C-
7//C- This software is subject to, and may be distributed under, the
8//C- GNU General Public License, either Version 2 of the license,
9//C- or (at your option) any later version. The license should have
10//C- accompanied the software or you may obtain a copy of the license
11//C- from the Free Software Foundation at http://www.fsf.org .
12//C-
13//C- This program is distributed in the hope that it will be useful,
14//C- but WITHOUT ANY WARRANTY; without even the implied warranty of
15//C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16//C- GNU General Public License for more details.
17//C-
18//C- DjVuLibre-3.5 is derived from the DjVu(r) Reference Library from
19//C- Lizardtech Software.  Lizardtech Software has authorized us to
20//C- replace the original DjVu(r) Reference Library notice by the following
21//C- text (see doc/lizard2002.djvu and doc/lizardtech2007.djvu):
22//C-
23//C-  ------------------------------------------------------------------
24//C- | DjVu (r) Reference Library (v. 3.5)
25//C- | Copyright (c) 1999-2001 LizardTech, Inc. All Rights Reserved.
26//C- | The DjVu Reference Library is protected by U.S. Pat. No.
27//C- | 6,058,214 and patents pending.
28//C- |
29//C- | This software is subject to, and may be distributed under, the
30//C- | GNU General Public License, either Version 2 of the license,
31//C- | or (at your option) any later version. The license should have
32//C- | accompanied the software or you may obtain a copy of the license
33//C- | from the Free Software Foundation at http://www.fsf.org .
34//C- |
35//C- | The computer code originally released by LizardTech under this
36//C- | license and unmodified by other parties is deemed "the LIZARDTECH
37//C- | ORIGINAL CODE."  Subject to any third party intellectual property
38//C- | claims, LizardTech grants recipient a worldwide, royalty-free,
39//C- | non-exclusive license to make, use, sell, or otherwise dispose of
40//C- | the LIZARDTECH ORIGINAL CODE or of programs derived from the
41//C- | LIZARDTECH ORIGINAL CODE in compliance with the terms of the GNU
42//C- | General Public License.   This grant only confers the right to
43//C- | infringe patent claims underlying the LIZARDTECH ORIGINAL CODE to
44//C- | the extent such infringement is reasonably necessary to enable
45//C- | recipient to make, have made, practice, sell, or otherwise dispose
46//C- | of the LIZARDTECH ORIGINAL CODE (or portions thereof) and not to
47//C- | any greater extent that may be necessary to utilize further
48//C- | modifications or combinations.
49//C- |
50//C- | The LIZARDTECH ORIGINAL CODE is provided "AS IS" WITHOUT WARRANTY
51//C- | OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
52//C- | TO ANY WARRANTY OF NON-INFRINGEMENT, OR ANY IMPLIED WARRANTY OF
53//C- | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
54//C- +------------------------------------------------------------------
55//
56// $Id: DjVuInfo.h,v 1.16 2007/03/25 20:48:30 leonb Exp $
57// $Name: release_3_5_19 $
58
59#ifndef _DJVUINFO_H
60#define _DJVUINFO_H
61#ifdef HAVE_CONFIG_H
62#include "config.h"
63#endif
64#if NEED_GNUG_PRAGMAS
65# pragma interface
66#endif
67
68
69/** @name DjVuInfo.h
70    Each instance of class #DjVuInfo# represents the information
71    contained in the information chunk of a DjVu file.  This #"INFO"#
72    chunk is always the first chunk of a DjVu file.
73    @memo
74    DjVu information chunk.
75    @author
76    L\'eon Bottou <leonb@research.att.com>
77    @version
78    #$Id: DjVuInfo.h,v 1.16 2007/03/25 20:48:30 leonb Exp $# */
79//@{
80
81
82
83#include "GSmartPointer.h"
84#include "GRect.h"
85
86#ifdef HAVE_NAMESPACES
87namespace DJVU {
88# ifdef NOT_DEFINED // Just to fool emacs c++ mode
89}
90#endif
91#endif
92
93class ByteStream;
94
95/** @name DjVu version constants
96    @memo DjVu file format version. */
97//@{
98/** Current DjVu format version.  The value of this macro represents the
99    version of the DjVu file format implemented by this release of the DjVu
100    Reference Library. */
101#define DJVUVERSION              26
102/** DjVu format version. This is the value used in files produced
103    with DjVuLibre. This is smaller than DJVUVERSION because version
104    number inflation causes problems with older software. */ 
105#define DJVUVERSION_FOR_OUTPUT   24
106/** This is the version which introduced orientations. */
107#define DJVUVERSION_ORIENTATION  22
108/** Oldest DjVu format version supported by this library.  This release of the
109    library cannot completely decode DjVu files whose version field is less
110    than or equal to this number. */
111#define DJVUVERSION_TOO_OLD      15
112/** Newest DjVu format partially supported by this library.  This release of
113    the library will attempt to decode files whose version field is smaller
114    than this macro.  If the version field is greater than or equal to this
115    number, the decoder will just throw a \Ref{GException}.  */
116#define DJVUVERSION_TOO_NEW      50
117//@}
118
119
120class GUTF8String;
121
122/** Information component.
123    Each instance of class #DjVuInfo# represents the information
124    contained in the information chunk of a DjVu file.  This #"INFO"#
125    chunk is always the first chunk of a DjVu file.
126 */
127
128class DjVuInfo : public GPEnabled
129{
130protected:
131  DjVuInfo(void);
132public:
133  /** Creates an empty DjVuInfo object.
134      The #width# and #height# fields are set to zero.
135      All other fields are initialized with suitable default values. */
136  static GP<DjVuInfo> create(void) {return new DjVuInfo();}
137
138  /** Decodes the DjVu #"INFO"# chunk.  This function reads binary data from
139      ByteStream #bs# and populates the fields of this DjVuInfo object.  It is
140      normally called after detecting an #"INFO"# chunk header with function
141      \Ref{IFFByteStream::get_chunk}. */
142  void decode(ByteStream &bs);
143  /** Encodes the DjVu #"INFO"# chunk. This function writes the fields of this
144      DjVuInfo object into ByteStream #bs#. It is normally called after
145      creating an #"INFO"# chunk header with function
146      \Ref{IFFByteStream::put_chunk}. */
147  void encode(ByteStream &bs); 
148  /** Returns the number of bytes used by this object. */
149  unsigned int get_memory_usage() const;
150  /** Width of the DjVu image (in pixels). */
151  int width;
152  /** Height of the DjVu image (in pixels). */
153  int height;
154  /** DjVu file version number.  This number characterizes the file format
155      version used by the encoder to generate this DjVu image.  A decoder
156      should compare this version number with the constants described in
157      section "\Ref{DjVu version constants}". */
158  int version;
159  /** Resolution of the DjVu image.  The resolution is given in ``pixels per
160      2.54 centimeters'' (this unit is sometimes called ``pixels per
161      inch''). Display programs can use this information to determine the
162      natural magnification to use for rendering a DjVu image. */
163  int dpi;
164  /** Gamma coefficient of the display for which the image was designed.  The
165      rendering functions can use this information in order to perform color
166      correction for the intended display device. */
167  double gamma;
168
169  /** Image orientation:
170      0: no rotation      1: 90 degrees counter-clockwise
171      2: 180 degrees      3: 270 degrees counter-clockwise */
172  int orientation;
173
174     /// Obtain the flags for the default specifications.
175  GUTF8String get_paramtags(void) const;
176     /// Obtain the flags for the default specifications.
177  void writeParam(ByteStream &out_str) const;
178};
179
180
181//@}
182
183// ----- THE END
184
185#ifdef HAVE_NAMESPACES
186}
187# ifndef NOT_USING_DJVU_NAMESPACE
188using namespace DJVU;
189# endif
190#endif
191#endif
Note: See TracBrowser for help on using the repository browser.