• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kviewshell

DjVuToPS.h

Go to the documentation of this file.
00001 //C-  -*- C++ -*-
00002 //C- -------------------------------------------------------------------
00003 //C- DjVuLibre-3.5
00004 //C- Copyright (c) 2002-2003  Leon Bottou and Yann Le Cun.
00005 //C- Copyright (c) 2001  AT&T
00006 //C-
00007 //C- This software is subject to, and may be distributed under, the
00008 //C- GNU General Public License, Version 2. The license should have
00009 //C- accompanied the software or you may obtain a copy of the license
00010 //C- from the Free Software Foundation at http://www.fsf.org .
00011 //C-
00012 //C- This program is distributed in the hope that it will be useful,
00013 //C- but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //C- GNU General Public License for more details.
00016 //C- 
00017 //C- DjVuLibre-3.5 is derived from the DjVu(r) Reference Library
00018 //C- distributed by Lizardtech Software.  On July 19th 2002, Lizardtech 
00019 //C- Software authorized us to replace the original DjVu(r) Reference 
00020 //C- Library notice by the following text (see doc/lizard2002.djvu):
00021 //C-
00022 //C-  ------------------------------------------------------------------
00023 //C- | DjVu (r) Reference Library (v. 3.5)
00024 //C- | Copyright (c) 1999-2001 LizardTech, Inc. All Rights Reserved.
00025 //C- | The DjVu Reference Library is protected by U.S. Pat. No.
00026 //C- | 6,058,214 and patents pending.
00027 //C- |
00028 //C- | This software is subject to, and may be distributed under, the
00029 //C- | GNU General Public License, Version 2. The license should have
00030 //C- | accompanied the software or you may obtain a copy of the license
00031 //C- | from the Free Software Foundation at http://www.fsf.org .
00032 //C- |
00033 //C- | The computer code originally released by LizardTech under this
00034 //C- | license and unmodified by other parties is deemed "the LIZARDTECH
00035 //C- | ORIGINAL CODE."  Subject to any third party intellectual property
00036 //C- | claims, LizardTech grants recipient a worldwide, royalty-free, 
00037 //C- | non-exclusive license to make, use, sell, or otherwise dispose of 
00038 //C- | the LIZARDTECH ORIGINAL CODE or of programs derived from the 
00039 //C- | LIZARDTECH ORIGINAL CODE in compliance with the terms of the GNU 
00040 //C- | General Public License.   This grant only confers the right to 
00041 //C- | infringe patent claims underlying the LIZARDTECH ORIGINAL CODE to 
00042 //C- | the extent such infringement is reasonably necessary to enable 
00043 //C- | recipient to make, have made, practice, sell, or otherwise dispose 
00044 //C- | of the LIZARDTECH ORIGINAL CODE (or portions thereof) and not to 
00045 //C- | any greater extent that may be necessary to utilize further 
00046 //C- | modifications or combinations.
00047 //C- |
00048 //C- | The LIZARDTECH ORIGINAL CODE is provided "AS IS" WITHOUT WARRANTY
00049 //C- | OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
00050 //C- | TO ANY WARRANTY OF NON-INFRINGEMENT, OR ANY IMPLIED WARRANTY OF
00051 //C- | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00052 //C- +------------------------------------------------------------------
00053 // 
00054 // $Id: DjVuToPS.h,v 1.14 2004/03/05 16:48:53 leonb Exp $
00055 // $Name: release_3_5_15 $
00056 
00057 #ifndef _DJVU_TO_PS_H_
00058 #define _DJVU_TO_PS_H_
00059 #ifdef HAVE_CONFIG_H
00060 #include "config.h"
00061 #endif
00062 #if NEED_GNUG_PRAGMAS
00063 # pragma interface
00064 #endif
00065 
00078 
00079 #include "DjVuGlobal.h"
00080 #include "GRect.h"
00081 #include "DjVuDocument.h"
00082 #include "DjVuText.h"
00083 
00084 #ifdef HAVE_NAMESPACES
00085 namespace DJVU {
00086 # ifdef NOT_DEFINED // Just to fool emacs c++ mode
00087 }
00088 #endif
00089 #endif
00090 
00095 class DjVuToPS
00096 {
00097 public:
00098   class DecodePort;
00099 
00137   class Options
00138   {
00139   public:
00141     enum Mode { COLOR, FORE, BACK, BW };
00143     enum Format { PS, EPS };
00145     enum Orientation { PORTRAIT, LANDSCAPE, AUTO };
00147     enum BookletMode { OFF, RECTO, VERSO, RECTOVERSO };
00148   private:
00149     Format format;
00150     int level;
00151     Orientation orientation;
00152     Mode mode;
00153     int zoom;
00154     bool color;
00155     bool calibrate;
00156     bool text;
00157     double gamma;
00158     int copies;
00159     bool frame;
00160     bool cropmarks;
00161     BookletMode bookletmode;
00162     int bookletmax;
00163     int bookletalign;
00164     int bookletfold;
00165     int bookletxfold;
00166   public:
00168     void set_format(Format format);
00170     void set_level(int level);
00172     void set_orientation(Orientation orientation);
00174     void set_mode(Mode mode);
00176     void set_zoom(int zoom);
00178     void set_color(bool color);
00180     void set_gamma(double gamma);
00182     void set_sRGB(bool calibrate);
00184     void set_copies(int copies);
00186     void set_frame(bool on);
00188     void set_cropmarks(bool on);
00190     void set_text(bool on);
00192     void set_bookletmode(BookletMode m);
00194     void set_bookletmax(int m);
00197     void set_bookletalign(int m);
00201     void set_bookletfold(int fold, int xfold=0);
00202 
00204     Format get_format(void) const {
00205       return format; }
00207     int get_level(void) const {
00208       return level; }
00210     Orientation get_orientation(void) const {
00211       return orientation; }
00214     Mode get_mode(void) const {
00215       return mode; }
00217     int get_zoom(void) const {
00218       return zoom; }
00220     bool get_color(void) const {
00221       return color; }
00223     bool get_sRGB(void) const {
00224       return calibrate; }
00226     double get_gamma(void) const {
00227       return ((calibrate) ? ((double)2.2) : gamma); }
00230     int get_copies(void) const {
00231       return copies; }
00233     bool get_frame(void) const {
00234       return frame; }
00236     bool get_cropmarks(void) const {
00237       return cropmarks; }
00239     bool get_text(void) const {
00240       return text; }
00242     BookletMode get_bookletmode(void) const {
00243       return bookletmode; }
00245     int get_bookletmax(void) {
00246       return bookletmax; }
00248     int get_bookletalign(void) {
00249       return bookletalign; }
00251     int get_bookletfold(int n=0) {
00252       return bookletfold + (n*bookletxfold+500)/1000; }
00253     /* Constructor */
00254     Options(void);
00255   };
00256   
00259   enum Stage { DECODING, PRINTING };
00260   
00261 private:
00262   void (*refresh_cb)(void*);
00263   void  *refresh_cl_data;
00264   void (*prn_progress_cb)(double, void*);
00265   void  *prn_progress_cl_data;
00266   void (*dec_progress_cb)(double, void*);
00267   void  *dec_progress_cl_data;
00268   void (*info_cb)(int,int,int,Stage,void*);
00269   void  *info_cl_data;
00270   unsigned char ramp[256];
00271   GP<DecodePort> port;
00272 protected:
00273   void store_doc_prolog(ByteStream&,int,int,GRect*);
00274   void store_doc_setup(ByteStream&);
00275   void store_doc_trailer(ByteStream&);
00276   void store_page_setup(ByteStream&,int,const GRect&,int align=0);
00277   void store_page_trailer(ByteStream&);
00278   void make_gamma_ramp(GP<DjVuImage>);
00279   void print_image_lev1(ByteStream&,GP<DjVuImage>,const GRect&);
00280   void print_image_lev2(ByteStream&,GP<DjVuImage>,const GRect&);
00281   void print_bg(ByteStream&,GP<DjVuImage>,const GRect&);
00282   void print_fg_3layer(ByteStream&,GP<DjVuImage>,const GRect&,unsigned char*);
00283   void print_fg_2layer(ByteStream&,GP<DjVuImage>,const GRect&,unsigned char*);
00284   void print_fg(ByteStream&,GP<DjVuImage>,const GRect&);
00285   void print_image(ByteStream&,GP<DjVuImage>,const GRect&,GP<DjVuTXT>);
00286   void parse_range(GP<DjVuDocument>,GUTF8String,GList<int>&);
00287   GP<DjVuImage> decode_page(GP<DjVuDocument>,int,int,int);
00288   void process_single_page(ByteStream&,GP<DjVuDocument>,int,int,int,int);
00289   void process_double_page(ByteStream&,GP<DjVuDocument>,void*,int,int);
00290   
00291 public:
00294   Options options;
00295   
00304    void set_refresh_cb(void (*refresh_cb)(void*), void *refresh_cl_data);
00316   void set_prn_progress_cb(void (*cb)(double, void*), void *data);
00331   void set_dec_progress_cb(void (*cb)(double, void*), void *data);
00350   void set_info_cb(void (*cb)(int,int,int,Stage,void*), void *data);
00352   
00381    void print(ByteStream&, GP<DjVuImage> dimg,
00382               const GRect &prn_rect, const GRect &img_rect,
00383               int override_dpi=-1 );
00384   
00403   void print(ByteStream&, GP<DjVuDocument> doc, GUTF8String page_range);
00404   void print(ByteStream&, GP<DjVuDocument> doc);
00405  
00406   
00408   DjVuToPS(void);
00409 };
00410 
00411 
00412 //****************************************************************************
00413 //******************************** DjVuToPS **********************************
00414 //****************************************************************************
00415 
00417 // ------------
00418 
00419 #ifdef HAVE_NAMESPACES
00420 }
00421 # ifndef NOT_USING_DJVU_NAMESPACE
00422 using namespace DJVU;
00423 # endif
00424 #endif
00425 #endif

kviewshell

Skip menu "kviewshell"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kviewshell
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal