kviewshell
DjVuImage.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #ifndef _DJVUIMAGE_H
00058 #define _DJVUIMAGE_H
00059 #ifdef HAVE_CONFIG_H
00060 #include "config.h"
00061 #endif
00062 #if NEED_GNUG_PRAGMAS
00063 # pragma interface
00064 #endif
00065
00066
00105
00106
00107
00108 #include "DjVuFile.h"
00109 #include "DjVuAnno.h"
00110 #include "GRect.h"
00111
00112 #ifdef HAVE_NAMESPACES
00113 namespace DJVU {
00114 # ifdef NOT_DEFINED // Just to fool emacs c++ mode
00115 }
00116 #endif
00117 #endif
00118
00119
00120
00121 class DjVuInterface
00122 {
00123 public:
00124 virtual ~DjVuInterface();
00125 virtual void notify_chunk(const char *chkid, const char *msg) = 0;
00126 virtual void notify_relayout(void) = 0;
00127 virtual void notify_redisplay(void) = 0;
00128 };
00129
00130
00138 class DjVuImage : public DjVuPort
00139 {
00140 protected:
00141 DjVuImage(void);
00142 public:
00143 enum { NOINFO, NOTEXT=1, NOMAP=4, NOMETA=8 };
00144
00156 static GP<DjVuImage> create(void) {return new DjVuImage();}
00157
00164 void connect(const GP<DjVuFile> & file);
00165
00167 static GP<DjVuImage> create(const GP<DjVuFile> &file)
00168 { const GP<DjVuImage> retval=create(); retval->connect(file); return retval; }
00169
00171
00172
00178 GP<DjVuInfo> get_info() const;
00182 GP<IW44Image> get_bg44() const;
00187 GP<GPixmap> get_bgpm() const;
00192 GP<JB2Image> get_fgjb() const;
00197 GP<GPixmap> get_fgpm() const;
00201 GP<DjVuPalette> get_fgbc() const;
00206 GP<ByteStream> get_anno() const;
00209 GP<ByteStream> get_text() const;
00212 GP<ByteStream> get_meta() const;
00214
00215
00222 bool wait_for_complete_decode(void);
00224
00225
00232 void decode(ByteStream & str, DjVuInterface *notifier=0);
00234
00235
00242 int get_width() const;
00247 int get_height() const;
00251 int get_real_width() const;
00255 int get_real_height() const;
00260 int get_version() const;
00265 int get_dpi() const;
00269 int get_rounded_dpi() const;
00273 double get_gamma() const;
00277 GUTF8String get_mimetype() const;
00280 GUTF8String get_short_description() const;
00295 GUTF8String get_long_description() const;
00298 GP<DjVuFile> get_djvu_file(void) const;
00300 void writeXML(ByteStream &str_out,const GURL &doc_url, const int flags=0) const;
00302 void writeXML(ByteStream &str_out) const;
00304 GUTF8String get_XML(const GURL &doc_url, const int flags=0) const;
00306 GUTF8String get_XML(void) const;
00308
00309
00317 int is_legal_photo() const;
00323 int is_legal_bilevel() const;
00330 int is_legal_compound() const;
00332
00333
00353 GP<GPixmap> get_pixmap(const GRect &rect, const GRect &all, double gamma=0) const;
00362 GP<GBitmap> get_bitmap(const GRect &rect, const GRect &all, int align = 1) const;
00370 GP<GPixmap> get_bg_pixmap(const GRect &rect, const GRect &all, double gamma=0) const;
00378 GP<GPixmap> get_fg_pixmap(const GRect &rect, const GRect &all, double gamma=0) const;
00379
00380
00383 void set_rotate(int count=0);
00385 int get_rotate() const;
00388 GP<DjVuAnno> get_decoded_anno();
00391 void map(GRect &rect) const;
00394 void unmap(GRect &rect) const;
00397 void map(int &x, int &y) const;
00400 void unmap(int &x, int &y) const;
00401
00402
00403
00405
00406
00407 virtual void notify_chunk_done(const DjVuPort *, const GUTF8String &name);
00408
00409
00410 GP<GPixmap> get_pixmap(const GRect &rect, int subs=1, double gamma=0) const;
00411 GP<GBitmap> get_bitmap(const GRect &rect, int subs=1, int align = 1) const;
00412 GP<GPixmap> get_bg_pixmap(const GRect &rect, int subs=1, double gamma=0) const;
00413 GP<GPixmap> get_fg_pixmap(const GRect &rect, int subs=1, double gamma=0) const;
00414 private:
00415 GP<DjVuFile> file;
00416 int rotate_count;
00417 bool relayout_sent;
00418
00419
00420 int stencil(GPixmap *pm, const GRect &rect, int subs, double gcorr) const;
00421 GP<DjVuInfo> get_info(const GP<DjVuFile> & file) const;
00422 GP<IW44Image> get_bg44(const GP<DjVuFile> & file) const;
00423 GP<GPixmap> get_bgpm(const GP<DjVuFile> & file) const;
00424 GP<JB2Image> get_fgjb(const GP<DjVuFile> & file) const;
00425 GP<GPixmap> get_fgpm(const GP<DjVuFile> & file) const;
00426 GP<DjVuPalette> get_fgbc(const GP<DjVuFile> & file) const;
00427 void init_rotate(const DjVuInfo &info);
00428 };
00429
00430
00431 inline GP<DjVuFile>
00432 DjVuImage::get_djvu_file(void) const
00433 {
00434 return file;
00435 }
00436
00438
00439
00440
00441
00442
00443 #ifdef HAVE_NAMESPACES
00444 }
00445 # ifndef NOT_USING_DJVU_NAMESPACE
00446 using namespace DJVU;
00447 # endif
00448 #endif
00449 #endif