PDF4QT/PdfTool/pdftoolrender.h

83 lines
2.7 KiB
C
Raw Normal View History

2020-10-25 18:55:25 +01:00
// Copyright (C) 2020 Jakub Melka
//
2020-12-20 19:03:58 +01:00
// This file is part of Pdf4Qt.
2020-10-25 18:55:25 +01:00
//
2020-12-20 19:03:58 +01:00
// Pdf4Qt is free software: you can redistribute it and/or modify
2020-10-25 18:55:25 +01:00
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
2020-12-20 19:03:58 +01:00
// Pdf4Qt is distributed in the hope that it will be useful,
2020-10-25 18:55:25 +01:00
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
2020-12-20 19:03:58 +01:00
// along with Pdf4Qt. If not, see <https://www.gnu.org/licenses/>.
2020-10-25 18:55:25 +01:00
#ifndef PDFTOOLRENDER_H
#define PDFTOOLRENDER_H
#include "pdftoolabstractapplication.h"
2020-10-28 16:35:16 +01:00
#include "pdfexception.h"
2020-10-25 18:55:25 +01:00
namespace pdftool
{
class PDFToolRenderBase : public PDFToolAbstractApplication
{
public:
virtual int execute(const PDFToolOptions& options) override;
2020-10-28 16:35:16 +01:00
protected:
virtual void finish(const PDFToolOptions& options) = 0;
virtual void onPageRendered(const PDFToolOptions& options, pdf::PDFRenderedPageImage& renderedPageImage) = 0;
void writePageInfoStatistics(const pdf::PDFRenderedPageImage& renderedPageImage);
void writeStatistics(PDFOutputFormatter& formatter);
void writePageStatistics(PDFOutputFormatter& formatter);
void writeErrors(PDFOutputFormatter& formatter);
struct PageInfo
{
bool isRendered = false;
pdf::PDFInteger pageIndex = 0;
qint64 pageCompileTime = 0;
qint64 pageWaitTime = 0;
qint64 pageRenderTime = 0;
qint64 pageTotalTime = 0;
qint64 pageWriteTime = 0;
std::vector<pdf::PDFRenderError> errors;
};
std::vector<PageInfo> m_pageInfo;
qint64 m_wallTime = 0;
2020-10-25 18:55:25 +01:00
};
class PDFToolRender : public PDFToolRenderBase
{
public:
virtual QString getStandardString(StandardString standardString) const override;
virtual Options getOptionsFlags() const override;
2020-10-28 16:35:16 +01:00
protected:
virtual void finish(const PDFToolOptions& options) override;
virtual void onPageRendered(const PDFToolOptions& options, pdf::PDFRenderedPageImage& renderedPageImage) override;
2020-10-25 18:55:25 +01:00
};
2020-10-26 19:28:56 +01:00
class PDFToolBenchmark : public PDFToolRenderBase
{
public:
virtual QString getStandardString(StandardString standardString) const override;
virtual Options getOptionsFlags() const override;
2020-10-28 16:35:16 +01:00
protected:
virtual void finish(const PDFToolOptions& options) override;
virtual void onPageRendered(const PDFToolOptions& options, pdf::PDFRenderedPageImage& renderedPageImage) override;
2020-10-26 19:28:56 +01:00
};
2020-10-25 18:55:25 +01:00
} // namespace pdftool
#endif // PDFTOOLRENDER_H