-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRender.hh
49 lines (40 loc) · 1.1 KB
/
Render.hh
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
#ifndef RENDER_H
#define RENDER_H
#include <QByteArray>
#include <QString>
#include <QMutex>
class QImage;
namespace Poppler {
class Document;
}
class DisplayRenderer {
public:
DisplayRenderer(const QString& filename) : m_filename(filename) {}
virtual ~DisplayRenderer() {}
virtual QImage render(int page, double resolution) const = 0;
virtual int getNPages() const = 0;
void adjustImage(QImage& image, int brightness, int contrast, bool invert) const;
protected:
QString m_filename;
};
class ImageRenderer : public DisplayRenderer {
public:
ImageRenderer(const QString& filename) ;
QImage render(int page, double resolution) const override;
int getNPages() const override {
return m_pageCount;
}
private:
int m_pageCount;
};
class PDFRenderer : public DisplayRenderer {
public:
PDFRenderer(const QString& filename, const QByteArray& password);
~PDFRenderer();
QImage render(int page, double resolution) const override;
int getNPages() const override;
private:
Poppler::Document* m_document;
mutable QMutex m_mutex;
};
#endif // RENDER_H