File indexing completed on 2024-05-19 04:36:37

0001 /* This file is part of the TikZKit project.
0002  *
0003  * Copyright (C) 2013-2014 Dominik Haumann <dhaumann@kde.org>
0004  *
0005  * This library is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU Library General Public License as published
0007  * by the Free Software Foundation, either version 2 of the License, or
0008  * (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, see
0017  * <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 #ifndef TIKZ_PDF_RENDERER_H
0021 #define TIKZ_PDF_RENDERER_H
0022 
0023 #include <QObject>
0024 #include <QPixmap>
0025 #include <QProcess>
0026 
0027 class PdfRendererPrivate;
0028 class NodeItem;
0029 
0030 namespace tex {
0031 
0032 class PdfRenderer : public QObject
0033 {
0034     Q_OBJECT
0035 
0036     public:
0037         /**
0038          * Constructor.
0039          */
0040         PdfRenderer(QObject* parent);
0041 
0042         /**
0043          * Destructor
0044          */
0045         virtual ~PdfRenderer();
0046 
0047     public Q_SLOTS:
0048         /**
0049          * Load the pdf file from @p filename.
0050          */
0051         void loadPdf(const QString& filename);
0052 
0053     public:
0054         /**
0055          * Returns a valid pixmap with desired dpi on success. The dpi values
0056          * @p physicalDpiX and @p physicalDpiY should include scaling factors.
0057          * On failure, returns a null pixmap: QPixmap::isNull() is true.
0058          */
0059         QPixmap render(qreal physicalDpiX, qreal physicalDpiY);
0060 
0061     private:
0062         PdfRendererPrivate * const d;
0063 };
0064 
0065 }
0066 
0067 #endif // TIKZ_PDF_RENDERER_H
0068 
0069 // kate: indent-width 4; replace-tabs on;