1 /*
2     PosteRazor - Make your own poster!
3     Copyright (C) 2005-2018 by Alessandro Portale
4     http://posterazor.sourceforge.net/
5 
6     This file is part of PosteRazor
7 
8     PosteRazor is free software; you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation, either version 3 of the License, or
11     (at your option) any later version.
12 
13     PosteRazor is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17 
18     You should have received a copy of the GNU General Public License
19     along with PosteRazor; if not, write to the Free Software
20     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22 
23 #pragma once
24 
25 #include "imageloaderinterface.h"
26 #include <QObject>
27 
28 class ImageLoaderQt: public QObject, public ImageLoaderInterface
29 {
30 public:
31     ImageLoaderQt(QObject *parent = nullptr);
32 
33     bool loadInputImage(const QString &imageFileName, QString &errorMessage) override;
34     bool isImageLoaded() const override;
35     bool isJpeg() const override;
36     QString fileName() const override;
37     QSize sizePixels() const override;
38     qreal horizontalDotsPerUnitOfLength(Types::UnitsOfLength unit) const override;
39     qreal verticalDotsPerUnitOfLength(Types::UnitsOfLength unit) const override;
40     QSizeF size(Types::UnitsOfLength unit) const override;
41     const QImage imageAsRGB(const QSize &size) const override;
42     int bitsPerPixel() const override;
43     Types::ColorTypes colorDataType() const override;
44     int savePoster(const QString &fileName, const PainterInterface *painter, int pagesCount, const QSizeF &sizeCm) const;
45     const QByteArray bits() const override;
46     const QVector<QRgb> colorTable() const override;
47     const QVector<QPair<QStringList, QString> > &imageFormats() const override;
48     QString libraryName() const override;
49     QString libraryAboutText() const override;
50 
51     void setQImage(const QImage &image);
52 
53 private:
54 #ifdef POPPLER_QT5_LIB
55     bool loadPdf(const QString &imageFileName, QString &errorMessage);
56 #endif
57 
58     QImage m_image;
59     QString m_imageFileName;
60 };
61