1 //======================================================================== 2 // 3 // ImageOutputDev.h 4 // 5 // Copyright 1998-2003 Glyph & Cog, LLC 6 // 7 //======================================================================== 8 9 //======================================================================== 10 // 11 // Modified under the Poppler project - http://poppler.freedesktop.org 12 // 13 // All changes made under the Poppler project to this file are licensed 14 // under GPL version 2 or later 15 // 16 // Copyright (C) 2006 Rainer Keller <class321@gmx.de> 17 // Copyright (C) 2008 Timothy Lee <timothy.lee@siriushk.com> 18 // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> 19 // Copyright (C) 2010 Jakob Voss <jakob.voss@gbv.de> 20 // 21 // To see a description of the changes please see the Changelog file that 22 // came with your tarball or type make ChangeLog if you are building from git 23 // 24 //======================================================================== 25 26 #ifndef IMAGEOUTPUTDEV_H 27 #define IMAGEOUTPUTDEV_H 28 29 #include "poppler/poppler-config.h" 30 31 #ifdef USE_GCC_PRAGMAS 32 #pragma interface 33 #endif 34 35 #include <stdio.h> 36 #include "goo/gtypes.h" 37 #include "OutputDev.h" 38 39 class GfxState; 40 41 //------------------------------------------------------------------------ 42 // ImageOutputDev 43 //------------------------------------------------------------------------ 44 45 class ImageOutputDev: public OutputDev { 46 public: 47 48 // Create an OutputDev which will write images to files named 49 // <fileRoot>-NNN.<type> or <fileRoot>-PPP-NNN.<type>, if 50 // <pageNames> is set. Normally, all images are written as PBM 51 // (.pbm) or PPM (.ppm) files. If <dumpJPEG> is set, JPEG images 52 // are written as JPEG (.jpg) files. 53 ImageOutputDev(char *fileRootA, GBool pageNamesA, GBool dumpJPEGA); 54 55 // Destructor. 56 virtual ~ImageOutputDev(); 57 58 // Check if file was successfully created. isOk()59 virtual GBool isOk() { return ok; } 60 61 // Does this device use beginType3Char/endType3Char? Otherwise, 62 // text in Type 3 fonts will be drawn with drawChar/drawString. interpretType3Chars()63 virtual GBool interpretType3Chars() { return gFalse; } 64 65 // Does this device need non-text content? needNonText()66 virtual GBool needNonText() { return gTrue; } 67 68 // Start a page startPage(int pageNumA,GfxState * state)69 virtual void startPage(int pageNumA, GfxState *state) 70 { pageNum = pageNumA; } 71 72 //---- get info about output device 73 74 // Does this device use upside-down coordinates? 75 // (Upside-down means (0,0) is the top left corner of the page.) upsideDown()76 virtual GBool upsideDown() { return gTrue; } 77 78 // Does this device use drawChar() or drawString()? useDrawChar()79 virtual GBool useDrawChar() { return gFalse; } 80 81 //----- image drawing 82 virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, 83 int width, int height, GBool invert, 84 GBool interpolate, GBool inlineImg); 85 virtual void drawImage(GfxState *state, Object *ref, Stream *str, 86 int width, int height, GfxImageColorMap *colorMap, 87 GBool interpolate, int *maskColors, GBool inlineImg); 88 virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, 89 int width, int height, 90 GfxImageColorMap *colorMap, 91 GBool interpolate, 92 Stream *maskStr, int maskWidth, int maskHeight, 93 GBool maskInvert, GBool maskInterpolate); 94 virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, 95 int width, int height, 96 GfxImageColorMap *colorMap, 97 GBool interpolate, 98 Stream *maskStr, 99 int maskWidth, int maskHeight, 100 GfxImageColorMap *maskColorMap, 101 GBool maskInterpolate); 102 103 private: 104 // Sets the output filename with a given file extension 105 void setFilename(const char *fileExt); 106 107 108 char *fileRoot; // root of output file names 109 char *fileName; // buffer for output file names 110 GBool dumpJPEG; // set to dump native JPEG files 111 GBool pageNames; // set to include page number in file names 112 int pageNum; // current page number 113 int imgNum; // current image number 114 GBool ok; // set up ok? 115 }; 116 117 #endif 118