forked from gustawho/okular-backend-mupdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.hpp
76 lines (64 loc) · 1.66 KB
/
page.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/***************************************************************************
* Copyright (C) 2008 by Pino Toscano <[email protected]> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef QMUPDF_PAGE_HPP
#define QMUPDF_PAGE_HPP
#include <QRect>
#include <QString>
#include <QSharedDataPointer>
class QImage;
class QSizeF;
struct fz_document;
struct fz_context;
namespace QMuPDF
{
class TextBox;
class Page
{
public:
Page(fz_context *ctx, fz_document *doc, int num);
Page(const Page &other);
~Page();
int number() const;
QSizeF size(const QSizeF &dpi) const;
qreal duration() const;
QImage render(qreal width, qreal height) const;
QVector<TextBox *> textBoxes(const QSizeF &dpi) const;
private:
Page();
struct Data;
QSharedDataPointer<Data> d;
};
class TextBox
{
public:
TextBox(QChar c, const QRectF &bbox)
: m_text(c), m_rect(bbox), m_end(false) { }
QRectF rect() const
{
return m_rect;
}
QChar text() const
{
return m_text;
}
bool isAtEndOfLine() const
{
return m_end;
}
void markAtEndOfLine()
{
m_end = true;
}
private:
QChar m_text;
QRectF m_rect;
bool m_end : 1;
};
} // namespace QMuPDF
#endif