Coverage Report

Created: 2025-11-16 07:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/poppler/poppler/CairoOutputDev.h
Line
Count
Source
1
//========================================================================
2
//
3
// CairoOutputDev.h
4
//
5
// Copyright 2003 Glyph & Cog, LLC
6
// Copyright 2004 Red Hat, INC
7
//
8
//========================================================================
9
10
//========================================================================
11
//
12
// Modified under the Poppler project - http://poppler.freedesktop.org
13
//
14
// All changes made under the Poppler project to this file are licensed
15
// under GPL version 2 or later
16
//
17
// Copyright (C) 2005-2008 Jeff Muizelaar <jeff@infidigm.net>
18
// Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com>
19
// Copyright (C) 2005 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
20
// Copyright (C) 2006-2011, 2013 Carlos Garcia Campos <carlosgc@gnome.org>
21
// Copyright (C) 2008, 2009, 2011-2017, 2022-2024 Adrian Johnson <ajohnson@redneon.com>
22
// Copyright (C) 2008 Michael Vrable <mvrable@cs.ucsd.edu>
23
// Copyright (C) 2010-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
24
// Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
25
// Copyright (C) 2016 Jason Crain <jason@aquaticape.us>
26
// Copyright (C) 2018, 2019, 2021, 2025 Albert Astals Cid <aacid@kde.org>
27
// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich
28
// Copyright (C) 2020 Michal <sudolskym@gmail.com>
29
// Copyright (C) 2021 Christian Persch <chpe@src.gnome.org>
30
// Copyright (C) 2022 Marek Kasik <mkasik@redhat.com>
31
// Copyright (C) 2024 Nelson Benítez León <nbenitezl@gmail.com>
32
// Copyright (C) 2025 g10 Code GmbH, Author: Sune Stolborg Vuorela <sune@vuorela.dk>
33
//
34
// To see a description of the changes please see the Changelog file that
35
// came with your tarball or type make ChangeLog if you are building from git
36
//
37
//========================================================================
38
39
#ifndef CAIROOUTPUTDEV_H
40
#define CAIROOUTPUTDEV_H
41
42
#include <unordered_set>
43
44
#include <cairo-ft.h>
45
#include "OutputDev.h"
46
#include "TextOutputDev.h"
47
#include "GfxState.h"
48
#include "StructElement.h"
49
#include "StructTreeRoot.h"
50
#include "Annot.h"
51
#include "Link.h"
52
53
class PDFDoc;
54
class GfxState;
55
class GfxPath;
56
class Gfx8BitFont;
57
struct GfxRGB;
58
class CairoFontEngine;
59
class CairoFont;
60
61
//------------------------------------------------------------------------
62
63
//------------------------------------------------------------------------
64
// CairoImage
65
//------------------------------------------------------------------------
66
class CairoImage
67
{
68
public:
69
    // Constructor.
70
    CairoImage(double x1, double y1, double x2, double y2);
71
72
    // Destructor.
73
    ~CairoImage();
74
75
    CairoImage(const CairoImage &) = delete;
76
    CairoImage &operator=(const CairoImage &) = delete;
77
78
    // Set the image cairo surface
79
    void setImage(cairo_surface_t *image);
80
81
    // Get the image cairo surface
82
0
    cairo_surface_t *getImage() const { return image; }
83
84
    // Get the image rectangle
85
    void getRect(double *xa1, double *ya1, double *xa2, double *ya2)
86
0
    {
87
0
        *xa1 = x1;
88
0
        *ya1 = y1;
89
0
        *xa2 = x2;
90
0
        *ya2 = y2;
91
0
    }
92
93
private:
94
    cairo_surface_t *image; // image cairo surface
95
    double x1, y1; // upper left corner
96
    double x2, y2; // lower right corner
97
};
98
99
//------------------------------------------------------------------------
100
// CairoOutputDev
101
//------------------------------------------------------------------------
102
103
class CairoOutputDev : public OutputDev
104
{
105
public:
106
    // Constructor.
107
    CairoOutputDev();
108
109
    // Destructor.
110
    ~CairoOutputDev() override;
111
112
    //----- get info about output device
113
114
    // Does this device use upside-down coordinates?
115
    // (Upside-down means (0,0) is the top left corner of the page.)
116
4.40k
    bool upsideDown() override { return true; }
117
118
    // Does this device use drawChar() or drawString()?
119
2.53M
    bool useDrawChar() override { return true; }
120
121
    // Does this device use tilingPatternFill()?  If this returns false,
122
    // tiling pattern fills will be reduced to a series of other drawing
123
    // operations.
124
1.34k
    bool useTilingPatternFill() override { return true; }
125
126
    // Does this device use functionShadedFill(), axialShadedFill(), and
127
    // radialShadedFill()?  If this returns false, these shaded fills
128
    // will be reduced to a series of other drawing operations.
129
695
    bool useShadedFills(int type) override { return type <= 7; }
130
131
    // Does this device use FillColorStop()?
132
287k
    bool useFillColorStop() override { return true; }
133
134
    // Does this device use beginType3Char/endType3Char?  Otherwise,
135
    // text in Type 3 fonts will be drawn with drawChar/drawString.
136
288
    bool interpretType3Chars() override { return false; }
137
138
    // Does this device need to clip pages to the crop box even when the
139
    // box is the crop box?
140
2.20k
    bool needClipToCropBox() override { return true; }
141
142
    //----- initialization and control
143
144
    // Start a page.
145
    void startPage(int pageNum, GfxState *state, XRef *xref) override;
146
147
    // End a page.
148
    void endPage() override;
149
150
    // Must be called before last call to endPage()
151
    void emitStructTree();
152
153
    void beginForm(Object *obj, Ref id) override;
154
    void endForm(Object *obj, Ref id) override;
155
156
    //----- save/restore graphics state
157
    void saveState(GfxState *state) override;
158
    void restoreState(GfxState *state) override;
159
160
    //----- update graphics state
161
    void updateAll(GfxState *state) override;
162
    void setDefaultCTM(const double *ctm) override;
163
    void updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32) override;
164
    void updateLineDash(GfxState *state) override;
165
    void updateFlatness(GfxState *state) override;
166
    void updateLineJoin(GfxState *state) override;
167
    void updateLineCap(GfxState *state) override;
168
    void updateMiterLimit(GfxState *state) override;
169
    void updateLineWidth(GfxState *state) override;
170
    void updateFillColor(GfxState *state) override;
171
    void updateStrokeColor(GfxState *state) override;
172
    void updateFillOpacity(GfxState *state) override;
173
    void updateStrokeOpacity(GfxState *state) override;
174
    void updateFillColorStop(GfxState *state, double offset) override;
175
    void updateBlendMode(GfxState *state) override;
176
177
    //----- update text state
178
    void updateFont(GfxState *state) override;
179
180
    //----- path painting
181
    void stroke(GfxState *state) override;
182
    void fill(GfxState *state) override;
183
    void eoFill(GfxState *state) override;
184
    void clipToStrokePath(GfxState *state) override;
185
    bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, GfxTilingPattern *tPat, const std::array<double, 6> &mat, int x0, int y0, int x1, int y1, double xStep, double yStep) override;
186
    bool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override;
187
    bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override;
188
    bool axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) override;
189
    bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) override;
190
    bool radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) override;
191
    bool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) override;
192
    bool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) override;
193
194
    //----- path clipping
195
    void clip(GfxState *state) override;
196
    void eoClip(GfxState *state) override;
197
198
    //----- text drawing
199
    void beginString(GfxState *state, const GooString *s) override;
200
    void endString(GfxState *state) override;
201
    void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, CharCode code, int nBytes, const Unicode *u, int uLen) override;
202
    void beginActualText(GfxState *state, const GooString *text) override;
203
    void endActualText(GfxState *state) override;
204
205
    bool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, const Unicode *u, int uLen) override;
206
    void endType3Char(GfxState *state) override;
207
    void beginTextObject(GfxState *state) override;
208
    void endTextObject(GfxState *state) override;
209
210
    void beginMarkedContent(const char *name, Dict *properties) override;
211
    void endMarkedContent(GfxState *state) override;
212
213
    //----- image drawing
214
    void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, bool invert, bool interpolate, bool inlineImg) override;
215
    void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, bool invert, bool inlineImg, double *baseMatrix) override;
216
    void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override;
217
    void drawImageMaskRegular(GfxState *state, Object *ref, Stream *str, int width, int height, bool invert, bool interpolate, bool inlineImg);
218
219
    void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, const int *maskColors, bool inlineImg) override;
220
    void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap,
221
                             bool maskInterpolate) override;
222
223
    void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert, bool maskInterpolate) override;
224
225
    // Does this device supports transparency (alpha channel) in JPX streams?
226
18
    bool supportJPXtransparency() override { return true; }
227
228
    //----- transparency groups and soft masks
229
    void beginTransparencyGroup(GfxState * /*state*/, const std::array<double, 4> & /*bbox*/, GfxColorSpace * /*blendingColorSpace*/, bool /*isolated*/, bool /*knockout*/, bool /*forSoftMask*/) override;
230
    void endTransparencyGroup(GfxState * /*state*/) override;
231
    void popTransparencyGroup();
232
    void paintTransparencyGroup(GfxState * /*state*/, const std::array<double, 4> & /*bbox*/) override;
233
    void setSoftMask(GfxState * /*state*/, const std::array<double, 4> & /*bbox*/, bool /*alpha*/, Function * /*transferFunc*/, GfxColor * /*backdropColor*/) override;
234
    void clearSoftMask(GfxState * /*state*/) override;
235
236
    //----- Type 3 font operators
237
    void type3D0(GfxState *state, double wx, double wy) override;
238
    void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury) override;
239
240
    //----- special access
241
242
    // Called to indicate that a new PDF document has been loaded.
243
    void startDoc(PDFDoc *docA, CairoFontEngine *fontEngine = nullptr);
244
245
    // Called to prepare this output dev for rendering CairoType3Font.
246
    void startType3Render(GfxState *state, XRef *xref);
247
248
0
    bool isReverseVideo() { return false; }
249
250
    void setCairo(cairo_t *cr);
251
    void setTextPage(TextPage *text);
252
    void setPrinting(bool printingA)
253
2.20k
    {
254
2.20k
        printing = printingA;
255
2.20k
        needFontUpdate = true;
256
2.20k
    }
257
    void copyAntialias(cairo_t *cr, cairo_t *source_cr);
258
0
    void setLogicalStructure(bool logStruct) { this->logicalStruct = logStruct; }
259
260
    enum Type3RenderType
261
    {
262
        Type3RenderNone,
263
        Type3RenderMask,
264
        Type3RenderColor
265
    };
266
0
    void setType3RenderType(Type3RenderType state) { t3_render_state = state; }
267
    void getType3GlyphWidth(double *wx, double *wy)
268
0
    {
269
0
        *wx = t3_glyph_wx;
270
0
        *wy = t3_glyph_wy;
271
0
    }
272
0
    bool hasType3GlyphBBox() { return t3_glyph_has_bbox; }
273
0
    double *getType3GlyphBBox() { return t3_glyph_bbox; }
274
0
    bool type3GlyphHasColor() { return t3_glyph_has_color; }
275
276
protected:
277
    void doPath(cairo_t *cairo, GfxState *state, const GfxPath *path);
278
    cairo_surface_t *downscaleSurface(cairo_surface_t *orig_surface);
279
    void getScaledSize(const cairo_matrix_t *matrix, int orig_width, int orig_height, int *scaledWidth, int *scaledHeight);
280
    cairo_filter_t getFilterForSurface(cairo_surface_t *image, bool interpolate);
281
    bool getStreamData(Stream *str, char **buffer, int *length);
282
    void setMimeData(GfxState *state, Stream *str, Object *ref, GfxImageColorMap *colorMap, cairo_surface_t *image, int height);
283
    void fillToStrokePathClip(GfxState *state);
284
    void alignStrokeCoords(const GfxSubpath *subpath, int i, double *x, double *y);
285
    AnnotLink *findLinkObject(const StructElement *elem);
286
    void quadToCairoRect(AnnotQuadrilaterals *quads, int idx, double destPageHeight, cairo_rectangle_t *rect);
287
    bool appendLinkDestRef(GooString *s, const LinkDest *dest);
288
    void appendLinkDestXY(GooString *s, const LinkDest *dest, double destPageHeight);
289
    bool beginLinkTag(AnnotLink *annotLink);
290
    bool beginLink(const StructElement *linkElem);
291
    void getStructElemAttributeString(const StructElement *elem);
292
    int getContentElementStructParents(const StructElement *element);
293
    bool checkIfStructElementNeeded(const StructElement *element);
294
    void emitStructElement(const StructElement *elem);
295
    void startFirstPage(int pageNum, GfxState *state, XRef *xrefA);
296
    bool setMimeDataForJBIG2Globals(Stream *str, cairo_surface_t *image);
297
    bool setMimeDataForCCITTParams(Stream *str, cairo_surface_t *image, int height);
298
    static void textStringToQuotedUtf8(const GooString *text, GooString *s);
299
    bool isPDF();
300
301
    std::optional<GfxRGB> fill_color, stroke_color;
302
    cairo_pattern_t *fill_pattern, *stroke_pattern;
303
    double fill_opacity;
304
    double stroke_opacity;
305
    bool stroke_adjust;
306
    bool adjusted_stroke_width;
307
    bool align_stroke_coords;
308
    std::shared_ptr<CairoFont> currentFont;
309
    XRef *xref;
310
311
    struct StrokePathClip
312
    {
313
        GfxPath *path;
314
        cairo_matrix_t ctm;
315
        double line_width;
316
        double *dashes;
317
        int dash_count;
318
        double dash_offset;
319
        cairo_line_cap_t cap;
320
        cairo_line_join_t join;
321
        double miter;
322
        int ref_count;
323
    } *strokePathClip;
324
325
    PDFDoc *doc; // the current document
326
327
    static FT_Library ft_lib;
328
    static std::once_flag ft_lib_once_flag;
329
330
    CairoFontEngine *fontEngine;
331
    bool fontEngine_owner;
332
333
    cairo_t *cairo;
334
    cairo_matrix_t orig_matrix;
335
    bool needFontUpdate; // set when the font needs to be updated
336
    bool printing;
337
    bool use_show_text_glyphs;
338
    bool text_matrix_valid;
339
    cairo_glyph_t *glyphs;
340
    int glyphCount;
341
    cairo_text_cluster_t *clusters;
342
    int clusterCount;
343
    char *utf8;
344
    int utf8Count;
345
    int utf8Max;
346
    cairo_path_t *textClipPath;
347
    bool inUncoloredPattern; // inside a uncolored pattern (PaintType = 2)
348
    Type3RenderType t3_render_state;
349
    double t3_glyph_wx, t3_glyph_wy;
350
    bool t3_glyph_has_bbox;
351
    bool t3_glyph_has_color;
352
    bool has_color;
353
    double t3_glyph_bbox[4];
354
    bool logicalStruct;
355
    bool firstPage;
356
    int pdfPageNum; // page number of the PDF file
357
    int cairoPageNum; // page number in cairo output
358
    std::vector<std::string> markedContentStack;
359
    std::vector<std::shared_ptr<Annot>> annotations;
360
    std::set<std::string> emittedDestinations;
361
    std::map<int, int> pdfPageToCairoPageMap;
362
363
    TextPage *textPage; // text for the current page
364
    ActualText *actualText;
365
366
    cairo_pattern_t *group;
367
    cairo_pattern_t *shape;
368
    cairo_pattern_t *mask;
369
    cairo_matrix_t mask_matrix;
370
    cairo_t *cairo_shape;
371
    int knockoutCount;
372
    struct ColorSpaceStack
373
    {
374
        bool knockout;
375
        GfxColorSpace *cs;
376
        cairo_matrix_t group_matrix;
377
        struct ColorSpaceStack *next;
378
    } *groupColorSpaceStack;
379
380
    struct SaveStateElement
381
    {
382
        // These patterns hold a reference
383
        cairo_pattern_t *fill_pattern;
384
        cairo_pattern_t *stroke_pattern;
385
        double fill_opacity;
386
        double stroke_opacity;
387
        cairo_pattern_t *mask; // can be null
388
        cairo_matrix_t mask_matrix;
389
        Ref fontRef;
390
    };
391
    std::vector<SaveStateElement> saveStateStack;
392
393
    std::map<Ref, std::map<std::string, std::unique_ptr<LinkDest>>> destsMap;
394
    std::map<Ref, int> pdfPageRefToCairoPageNumMap;
395
    std::vector<int> structParentsStack;
396
    int currentStructParents;
397
398
    struct StructParentsMcidHash
399
    {
400
0
        size_t operator()(std::pair<int, int> x) const { return x.first << 16 | x.second; }
401
    };
402
    std::unordered_set<std::pair<int, int>, StructParentsMcidHash> mcidEmitted; // <structParent, MCID>
403
404
    std::unordered_set<const StructElement *> structElementNeeded;
405
};
406
407
//------------------------------------------------------------------------
408
// CairoImageOutputDev
409
//------------------------------------------------------------------------
410
411
// XXX: this should ideally not inherit from CairoOutputDev but use it instead perhaps
412
class CairoImageOutputDev : public CairoOutputDev
413
{
414
public:
415
    // Constructor.
416
    CairoImageOutputDev();
417
418
    // Destructor.
419
    ~CairoImageOutputDev() override;
420
421
    //----- get info about output device
422
423
    // Does this device use upside-down coordinates?
424
    // (Upside-down means (0,0) is the top left corner of the page.)
425
0
    bool upsideDown() override { return true; }
426
427
    // Does this device use drawChar() or drawString()?
428
0
    bool useDrawChar() override { return false; }
429
430
    // Does this device use tilingPatternFill()?  If this returns false,
431
    // tiling pattern fills will be reduced to a series of other drawing
432
    // operations.
433
0
    bool useTilingPatternFill() override { return true; }
434
435
    // Does this device use functionShadedFill(), axialShadedFill(), and
436
    // radialShadedFill()?  If this returns false, these shaded fills
437
    // will be reduced to a series of other drawing operations.
438
0
    bool useShadedFills(int type) override { return type <= 7; }
439
440
    // Does this device use FillColorStop()?
441
0
    bool useFillColorStop() override { return false; }
442
443
    // Does this device use beginType3Char/endType3Char?  Otherwise,
444
    // text in Type 3 fonts will be drawn with drawChar/drawString.
445
0
    bool interpretType3Chars() override { return false; }
446
447
    // Does this device need non-text content?
448
0
    bool needNonText() override { return true; }
449
450
    //----- save/restore graphics state
451
0
    void saveState(GfxState *state) override { }
452
0
    void restoreState(GfxState *state) override { }
453
454
    //----- update graphics state
455
0
    void updateAll(GfxState *state) override { }
456
0
    void setDefaultCTM(const double *ctm) override { }
457
0
    void updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32) override { }
458
0
    void updateLineDash(GfxState *state) override { }
459
0
    void updateFlatness(GfxState *state) override { }
460
0
    void updateLineJoin(GfxState *state) override { }
461
0
    void updateLineCap(GfxState *state) override { }
462
0
    void updateMiterLimit(GfxState *state) override { }
463
0
    void updateLineWidth(GfxState *state) override { }
464
0
    void updateFillColor(GfxState *state) override { }
465
0
    void updateStrokeColor(GfxState *state) override { }
466
0
    void updateFillOpacity(GfxState *state) override { }
467
0
    void updateStrokeOpacity(GfxState *state) override { }
468
0
    void updateBlendMode(GfxState *state) override { }
469
470
    //----- update text state
471
0
    void updateFont(GfxState *state) override { }
472
473
    //----- path painting
474
0
    void stroke(GfxState *state) override { }
475
0
    void fill(GfxState *state) override { }
476
0
    void eoFill(GfxState *state) override { }
477
0
    void clipToStrokePath(GfxState *state) override { }
478
0
    bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, GfxTilingPattern *tPat, const std::array<double, 6> &mat, int x0, int y0, int x1, int y1, double xStep, double yStep) override { return true; }
479
0
    bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override { return true; }
480
0
    bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) override { return true; }
481
482
    //----- path clipping
483
0
    void clip(GfxState *state) override { }
484
0
    void eoClip(GfxState *state) override { }
485
486
    //----- image drawing
487
    void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, bool invert, bool interpolate, bool inlineImg) override;
488
    void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, const int *maskColors, bool inlineImg) override;
489
    void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap,
490
                             bool maskInterpolate) override;
491
    void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert, bool maskInterpolate) override;
492
    void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, bool invert, bool inlineImg, double *baseMatrix) override;
493
0
    void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override { }
494
495
    //----- transparency groups and soft masks
496
0
    void beginTransparencyGroup(GfxState * /*state*/, const std::array<double, 4> & /*bbox*/, GfxColorSpace * /*blendingColorSpace*/, bool /*isolated*/, bool /*knockout*/, bool /*forSoftMask*/) override { }
497
0
    void endTransparencyGroup(GfxState * /*state*/) override { }
498
0
    void paintTransparencyGroup(GfxState * /*state*/, const std::array<double, 4> & /*bbox*/) override { }
499
0
    void setSoftMask(GfxState * /*state*/, const std::array<double, 4> & /*bbox*/, bool /*alpha*/, Function * /*transferFunc*/, GfxColor * /*backdropColor*/) override { }
500
0
    void clearSoftMask(GfxState * /*state*/) override { }
501
502
    //----- Image list
503
    // By default images are not rendred
504
    void setImageDrawDecideCbk(bool (*cbk)(int img_id, void *data), void *data)
505
0
    {
506
0
        imgDrawCbk = cbk;
507
0
        imgDrawCbkData = data;
508
0
    }
509
    // Iterate through list of images.
510
0
    int getNumImages() const { return numImages; }
511
0
    CairoImage *getImage(int i) const { return images[i]; }
512
513
private:
514
    void saveImage(CairoImage *image);
515
    void getBBox(GfxState *state, int width, int height, double *x1, double *y1, double *x2, double *y2);
516
517
    CairoImage **images;
518
    int numImages;
519
    int size;
520
    bool (*imgDrawCbk)(int img_id, void *data);
521
    void *imgDrawCbkData;
522
};
523
524
#endif