1
//========================================================================
5
// Copyright 1998-2003 Glyph & Cog, LLC
7
//========================================================================
9
//========================================================================
11
// Modified under the Poppler project - http://poppler.freedesktop.org
13
// All changes made under the Poppler project to this file are licensed
14
// under GPL version 2 or later
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>
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
24
//========================================================================
26
#ifndef IMAGEOUTPUTDEV_H
27
#define IMAGEOUTPUTDEV_H
29
#include "poppler/poppler-config.h"
31
#ifdef USE_GCC_PRAGMAS
36
#include "goo/gtypes.h"
37
#include "OutputDev.h"
41
//------------------------------------------------------------------------
43
//------------------------------------------------------------------------
45
class ImageOutputDev: public OutputDev {
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);
56
virtual ~ImageOutputDev();
58
// Check if file was successfully created.
59
virtual GBool isOk() { return ok; }
61
// Does this device use beginType3Char/endType3Char? Otherwise,
62
// text in Type 3 fonts will be drawn with drawChar/drawString.
63
virtual GBool interpretType3Chars() { return gFalse; }
65
// Does this device need non-text content?
66
virtual GBool needNonText() { return gTrue; }
69
virtual void startPage(int pageNumA, GfxState *state)
70
{ pageNum = pageNumA; }
72
//---- get info about output device
74
// Does this device use upside-down coordinates?
75
// (Upside-down means (0,0) is the top left corner of the page.)
76
virtual GBool upsideDown() { return gTrue; }
78
// Does this device use drawChar() or drawString()?
79
virtual GBool useDrawChar() { return gFalse; }
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,
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,
99
int maskWidth, int maskHeight,
100
GfxImageColorMap *maskColorMap,
101
GBool maskInterpolate);
104
// Sets the output filename with a given file extension
105
void setFilename(const char *fileExt);
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?