source: trunk/libdjvu/DjVuInfo.h @ 15

Last change on this file since 15 was 15, checked in by Eugene Romanenko, 15 years ago

needed libs update

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