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
|
#ifndef PDFRENDERENGINE_H
#define PDFRENDERENGINE_H
#ifndef NO_POPPLER_PREVIEW
#include "smallUsefulFunctions.h"
#if QT_VERSION < 0x050000
#include "poppler-qt4.h"
#else
#include "poppler-qt5.h"
#endif
#include <QThread>
#include <QSemaphore>
#include <QMutex>
#include <QQueue>
#include <QImage>
class PDFQueue;
class RenderCommand
{
public:
explicit RenderCommand(int p, double xr = 72.0, double yr = 72.0, int x = -1, int y = -1, int w = -1, int h = -1);
int pageNr;
double xres;
double yres;
int x;
int y;
int w;
int h;
Poppler::Page::Rotation rotate;
int ticket;
bool priority;
};
class PDFRenderEngine : public SafeThread
{
Q_OBJECT
public:
explicit PDFRenderEngine(QObject *parent, PDFQueue *mQueue);
~PDFRenderEngine();
QByteArray tempData;
void setDocument(const QSharedPointer<Poppler::Document> &doc);
signals:
void sendImage(QImage image, int page, int ticket);
public slots:
protected:
void run();
private:
QSharedPointer<Poppler::Document> document;
int cachedNumPages;
PDFQueue *queue;
};
#endif // PDFRENDERENGINE_H
#endif
|