Inkscape
Vector Graphics Editor
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages Concepts
pdf-utils.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
/*
5 *
6 * Copyright (C) 2022 Authors
7 *
8 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
9 */
10
11#ifndef PDF_UTILS_H
12#define PDF_UTILS_H
13
14#include <2geom/rect.h>
16#include <2geom/affine.h>
17#include <poppler/Gfx.h>
18#include <poppler/GfxState.h>
19#include <poppler/Page.h>
20
22{
23public:
24 ClipHistoryEntry(GfxPath *clipPath = nullptr, GfxClipType clipType = clipNormal);
25 virtual ~ClipHistoryEntry();
26
27 // Manipulate clip path stack
28 ClipHistoryEntry *save(bool cleared = false);
30 bool hasSaves() { return saved != nullptr; }
31 bool hasClipPath() { return clipPath != nullptr && !cleared; }
32 bool isCopied() { return copied; }
33 bool isBoundingBox() { return is_bbox; }
34 void setClip(GfxState *state, GfxClipType newClipType = clipNormal, bool bbox = false);
35 GfxPath *getClipPath() { return clipPath; }
36 GfxClipType getClipType() { return clipType; }
37 const Geom::Affine &getAffine() { return affine; }
38 bool evenOdd() { return clipType != clipNormal; }
39 void clear() { cleared = true; }
40
41private:
42 ClipHistoryEntry *saved; // next clip path on stack
43
44 Geom::Affine affine = Geom::identity(); // Saved affine state of the clipPath
45 GfxPath *clipPath; // used as the path to be filled for an 'sh' operator
46 GfxClipType clipType;
47 bool is_bbox = false;
48 bool cleared = false;
49 bool copied = false;
50
51 ClipHistoryEntry(ClipHistoryEntry *other, bool cleared = false);
52};
53
54Geom::Rect getRect(_POPPLER_CONST PDFRectangle *box);
55
56#endif /* PDF_UTILS_H */
3x3 affine transformation matrix.
GfxClipType clipType
Definition pdf-utils.h:46
ClipHistoryEntry * save(bool cleared=false)
Create a new clip-history, appending it to the stack.
Definition pdf-utils.cpp:69
const Geom::Affine & getAffine()
Definition pdf-utils.h:37
GfxClipType getClipType()
Definition pdf-utils.h:36
void setClip(GfxState *state, GfxClipType newClipType=clipNormal, bool bbox=false)
Definition pdf-utils.cpp:34
ClipHistoryEntry * restore()
Definition pdf-utils.cpp:76
bool hasClipPath()
Definition pdf-utils.h:31
bool isBoundingBox()
Definition pdf-utils.h:33
GfxPath * getClipPath()
Definition pdf-utils.h:35
virtual ~ClipHistoryEntry()
Definition pdf-utils.cpp:26
Geom::Affine affine
Definition pdf-utils.h:44
ClipHistoryEntry * saved
Definition pdf-utils.h:42
GfxPath * clipPath
Definition pdf-utils.h:45
3x3 matrix representing an affine transformation.
Definition affine.h:70
Axis aligned, non-empty rectangle.
Definition rect.h:92
Affine identity()
Create an identity matrix.
Definition affine.h:210
Geom::Rect getRect(_POPPLER_CONST PDFRectangle *box)
TODO short description.
Axis-aligned rectangle.