mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-03-16 03:10:10 +01:00
Issue #25: Windows build without plugins
This commit is contained in:
parent
d0a6b55e88
commit
e5775906cf
@ -24,9 +24,28 @@ project(PDF4QT VERSION ${PDF4QT_VERSION} LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Svg Xml PrintSupport TextToSpeech)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Svg Xml PrintSupport TextToSpeech OpenGLWidgets Test)
|
||||
qt_standard_project_setup()
|
||||
|
||||
find_package(openssl REQUIRED)
|
||||
find_package(lcms REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(freetype CONFIG REQUIRED)
|
||||
find_package(OpenJPEG CONFIG REQUIRED)
|
||||
find_package(JPEG REQUIRED)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(CMAKE_AUTORCC_OPTIONS "--threshold;0;--compress;9")
|
||||
|
||||
if (MSVC)
|
||||
add_compile_options(/bigobj)
|
||||
endif ()
|
||||
|
||||
add_subdirectory(Pdf4QtLib)
|
||||
add_subdirectory(CodeGenerator)
|
||||
add_subdirectory(JBIG2_Viewer)
|
||||
@ -54,3 +73,4 @@ message("CMAKE_TOOLCHAIN_FILE = " ${CMAKE_TOOLCHAIN_FILE})
|
||||
#endmacro()
|
||||
#
|
||||
#dump_variables()
|
||||
|
||||
|
@ -22,7 +22,7 @@ add_executable(CodeGenerator
|
||||
generatormainwindow.ui
|
||||
)
|
||||
|
||||
target_link_libraries(CodeGenerator PRIVATE Pdf4QtLib Qt6::Core Qt6::Widgets Qt6::Gui)
|
||||
target_link_libraries(CodeGenerator PRIVATE Pdf4QtLib Qt6::Core Qt6::Widgets Qt6::Gui Qt6::Xml)
|
||||
|
||||
set_target_properties(CodeGenerator PROPERTIES
|
||||
WIN32_EXECUTABLE ON
|
||||
|
@ -306,7 +306,7 @@ QString CodeGenerator::generateHeader(int indent) const
|
||||
QByteArray ba;
|
||||
{
|
||||
QTextStream stream(&ba, QIODevice::WriteOnly);
|
||||
stream.setCodec("UTF-8");
|
||||
stream.setEncoding(QStringConverter::Utf8);
|
||||
stream.setRealNumberPrecision(3);
|
||||
stream.setRealNumberNotation(QTextStream::FixedNotation);
|
||||
|
||||
@ -324,7 +324,7 @@ QString CodeGenerator::generateSource(QString className, int indent) const
|
||||
QByteArray ba;
|
||||
{
|
||||
QTextStream stream(&ba, QIODevice::WriteOnly);
|
||||
stream.setCodec("UTF-8");
|
||||
stream.setEncoding(QStringConverter::Utf8);
|
||||
stream.setRealNumberPrecision(3);
|
||||
stream.setRealNumberNotation(QTextStream::FixedNotation);
|
||||
|
||||
@ -1647,7 +1647,7 @@ QString XFACodeGenerator::generateSource() const
|
||||
QByteArray ba;
|
||||
{
|
||||
QTextStream stream(&ba, QIODevice::WriteOnly);
|
||||
stream.setCodec("UTF-8");
|
||||
stream.setEncoding(QStringConverter::Utf8);
|
||||
stream.setRealNumberPrecision(3);
|
||||
stream.setRealNumberNotation(QTextStream::FixedNotation);
|
||||
|
||||
@ -1898,7 +1898,7 @@ QString XFACodeGenerator::generateHeader() const
|
||||
QByteArray ba;
|
||||
{
|
||||
QTextStream stream(&ba, QIODevice::WriteOnly);
|
||||
stream.setCodec("UTF-8");
|
||||
stream.setEncoding(QStringConverter::Utf8);
|
||||
stream.setRealNumberPrecision(3);
|
||||
stream.setRealNumberNotation(QTextStream::FixedNotation);
|
||||
|
||||
|
@ -73,7 +73,7 @@ void GeneratorMainWindow::load(const QString& fileName)
|
||||
if (file.open(QFile::ReadOnly | QFile::Truncate))
|
||||
{
|
||||
QTextStream stream(&file);
|
||||
stream.setCodec("UTF-8");
|
||||
stream.setEncoding(QStringConverter::Utf8);
|
||||
|
||||
QDomDocument document;
|
||||
document.setContent(stream.readAll());
|
||||
@ -370,7 +370,7 @@ void GeneratorMainWindow::save(const QString& fileName)
|
||||
if (file.open(QFile::WriteOnly | QFile::Truncate))
|
||||
{
|
||||
QTextStream stream(&file);
|
||||
stream.setCodec("UTF-8");
|
||||
stream.setEncoding(QStringConverter::Utf8);
|
||||
|
||||
QDomDocument document;
|
||||
m_generator->store(document);
|
||||
|
@ -16,10 +16,20 @@
|
||||
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
add_executable(Pdf4QtDocDiff
|
||||
aboutdialog.cpp
|
||||
differencesdockwidget.cpp
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
settingsdockwidget.cpp
|
||||
utils.cpp
|
||||
aboutdialog.ui
|
||||
differencesdockwidget.ui
|
||||
mainwindow.ui
|
||||
settingsdockwidget.ui
|
||||
resources.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(Pdf4QtDocDiff PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
target_link_libraries(Pdf4QtDocDiff PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
||||
|
||||
set_target_properties(Pdf4QtDocDiff PROPERTIES
|
||||
WIN32_EXECUTABLE ON
|
||||
|
@ -30,12 +30,13 @@
|
||||
#include "pdfdocumentwriter.h"
|
||||
|
||||
#include <QToolBar>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QFileDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QActionGroup>
|
||||
#include <QScreen>
|
||||
|
||||
namespace pdfdocdiff
|
||||
{
|
||||
@ -44,7 +45,7 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow),
|
||||
m_progress(new pdf::PDFProgress(this)),
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_taskbarButton(new QWinTaskbarButton(this)),
|
||||
m_progressTaskbarIndicator(nullptr),
|
||||
#endif
|
||||
@ -64,7 +65,7 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||
setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(800, 600)));
|
||||
|
||||
// Initialize task bar progress
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_progressTaskbarIndicator = m_taskbarButton->progress();
|
||||
#endif
|
||||
|
||||
@ -190,7 +191,7 @@ MainWindow::~MainWindow()
|
||||
void MainWindow::showEvent(QShowEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_taskbarButton->setWindow(windowHandle());
|
||||
#endif
|
||||
}
|
||||
@ -311,7 +312,7 @@ void MainWindow::loadSettings()
|
||||
QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
|
||||
if (geometry.isEmpty())
|
||||
{
|
||||
QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
|
||||
QRect availableGeometry = QApplication::primaryScreen()->availableGeometry();
|
||||
QRect windowRect(0, 0, availableGeometry.width() / 2, availableGeometry.height() / 2);
|
||||
windowRect = windowRect.translated(availableGeometry.center() - windowRect.center());
|
||||
setGeometry(windowRect);
|
||||
@ -845,7 +846,7 @@ std::optional<pdf::PDFDocument> MainWindow::openDocument()
|
||||
|
||||
void MainWindow::onProgressStarted(pdf::ProgressStartupInfo info)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_progressTaskbarIndicator->setRange(0, 100);
|
||||
m_progressTaskbarIndicator->reset();
|
||||
m_progressTaskbarIndicator->show();
|
||||
@ -862,7 +863,7 @@ void MainWindow::onProgressStep(int percentage)
|
||||
}
|
||||
|
||||
pdf::PDFTemporaryValueChange guard(&m_isChangingProgressStep, true);
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_progressTaskbarIndicator->setValue(percentage);
|
||||
#else
|
||||
Q_UNUSED(percentage);
|
||||
@ -871,7 +872,7 @@ void MainWindow::onProgressStep(int percentage)
|
||||
|
||||
void MainWindow::onProgressFinished()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_progressTaskbarIndicator->hide();
|
||||
#endif
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QSignalMapper>
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
#include <QWinTaskbarButton>
|
||||
#include <QWinTaskbarProgress>
|
||||
#endif
|
||||
@ -123,7 +123,7 @@ private:
|
||||
Ui::MainWindow* ui;
|
||||
|
||||
pdf::PDFProgress* m_progress;
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
QWinTaskbarButton* m_taskbarButton;
|
||||
QWinTaskbarProgress* m_progressTaskbarIndicator;
|
||||
#endif
|
||||
|
@ -301,7 +301,7 @@ void DifferencesDrawInterface::drawPage(QPainter* painter,
|
||||
pdf::PDFInteger pageIndex,
|
||||
const pdf::PDFPrecompiledPage* compiledPage,
|
||||
pdf::PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<pdf::PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -490,7 +490,7 @@ void DifferencesDrawInterface::drawAnnotations(const pdf::PDFDocument* document,
|
||||
}
|
||||
|
||||
void DifferencesDrawInterface::drawRectangle(QPainter* painter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
const QRectF& rect,
|
||||
QColor color) const
|
||||
{
|
||||
@ -501,7 +501,7 @@ void DifferencesDrawInterface::drawRectangle(QPainter* painter,
|
||||
}
|
||||
|
||||
void DifferencesDrawInterface::drawMarker(QPainter* painter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
const QRectF& rect,
|
||||
QColor color,
|
||||
bool isLeft) const
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
virtual void drawPage(QPainter* painter, pdf::PDFInteger pageIndex,
|
||||
const pdf::PDFPrecompiledPage* compiledPage,
|
||||
pdf::PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<pdf::PDFRenderError>& errors) const override;
|
||||
|
||||
virtual void drawPostRendering(QPainter* painter, QRect rect) const override;
|
||||
@ -106,12 +106,12 @@ public:
|
||||
|
||||
private:
|
||||
void drawRectangle(QPainter* painter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
const QRectF& rect,
|
||||
QColor color) const;
|
||||
|
||||
void drawMarker(QPainter* painter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
const QRectF& rect,
|
||||
QColor color,
|
||||
bool isLeft) const;
|
||||
|
@ -16,7 +16,18 @@
|
||||
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
add_executable(Pdf4QtDocPageOrganizer
|
||||
aboutdialog.cpp
|
||||
assembleoutputsettingsdialog.cpp
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
pageitemdelegate.cpp
|
||||
pageitemmodel.cpp
|
||||
selectbookmarkstoregroupdialog.cpp
|
||||
aboutdialog.ui
|
||||
assembleoutputsettingsdialog.ui
|
||||
mainwindow.ui
|
||||
selectbookmarkstoregroupdialog.ui
|
||||
resources.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(Pdf4QtDocPageOrganizer PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QDesktopWidget>
|
||||
#include <QClipboard>
|
||||
#include <QToolBar>
|
||||
#include <QDesktopServices>
|
||||
@ -259,7 +258,7 @@ void MainWindow::loadSettings()
|
||||
QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
|
||||
if (geometry.isEmpty())
|
||||
{
|
||||
QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
|
||||
QRect availableGeometry = QApplication::primaryScreen()->availableGeometry();
|
||||
QRect windowRect(0, 0, availableGeometry.width() / 2, availableGeometry.height() / 2);
|
||||
windowRect = windowRect.translated(availableGeometry.center() - windowRect.center());
|
||||
setGeometry(windowRect);
|
||||
|
@ -211,7 +211,7 @@ QPixmap PageItemDelegate::getPageImagePixmap(const PageGroupItem* item, QRect re
|
||||
QRect drawRect(QPoint(0, 0), rect.size());
|
||||
QRect mediaBox(QPoint(0, 0), image.size());
|
||||
QRectF rotatedMediaBox = pdf::PDFPage::getRotatedBox(mediaBox, groupItem.pageAdditionalRotation);
|
||||
QMatrix matrix = pdf::PDFRenderer::createMediaBoxToDevicePointMatrix(rotatedMediaBox, drawRect, groupItem.pageAdditionalRotation);
|
||||
QTransform matrix = pdf::PDFRenderer::createMediaBoxToDevicePointMatrix(rotatedMediaBox, drawRect, groupItem.pageAdditionalRotation);
|
||||
|
||||
QPainter painter(&pixmap);
|
||||
painter.setWorldTransform(QTransform(matrix));
|
||||
|
@ -97,8 +97,26 @@ add_library(Pdf4QtLib SHARED
|
||||
sources/pdfpagecontenteditorwidget.ui
|
||||
sources/pdfrenderingerrorswidget.ui
|
||||
sources/pdfselectpagesdialog.ui
|
||||
sources/pdfobjecteditorwidget_impl.h
|
||||
cmaps.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(Pdf4QtLib PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Xml Qt6::Svg)
|
||||
include(GenerateExportHeader)
|
||||
|
||||
GENERATE_EXPORT_HEADER(Pdf4QtLib
|
||||
EXPORT_MACRO_NAME
|
||||
PDF4QTLIBSHARED_EXPORT
|
||||
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlib_export.h")
|
||||
|
||||
target_link_libraries(Pdf4QtLib PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Xml Qt6::Svg Qt6::OpenGLWidgets)
|
||||
target_link_libraries(Pdf4QtLib PRIVATE lcms2::lcms2)
|
||||
target_link_libraries(Pdf4QtLib PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||
target_link_libraries(Pdf4QtLib PRIVATE ZLIB::ZLIB)
|
||||
target_link_libraries(Pdf4QtLib PRIVATE freetype)
|
||||
target_link_libraries(Pdf4QtLib PRIVATE openjp2)
|
||||
target_link_libraries(Pdf4QtLib PRIVATE JPEG::JPEG)
|
||||
|
||||
target_include_directories(Pdf4QtLib INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/sources)
|
||||
target_include_directories(Pdf4QtLib PUBLIC ${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR})
|
||||
|
||||
|
||||
|
@ -416,7 +416,7 @@ void PDFCreateLineTypeTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(pageIndex);
|
||||
@ -534,7 +534,7 @@ void PDFCreateEllipseTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
|
||||
@ -614,7 +614,7 @@ void PDFCreateFreehandCurveTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
|
||||
@ -775,7 +775,7 @@ void PDFCreateStampTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -790,7 +790,7 @@ void PDFCreateStampTool::drawPage(QPainter* painter,
|
||||
|
||||
const PDFPage* page = getDocument()->getCatalog()->getPage(pageIndex);
|
||||
QRectF rectangle = m_stampAnnotation.getRectangle();
|
||||
QMatrix matrix = getProxy()->getAnnotationManager()->prepareTransformations(pagePointToDevicePointMatrix, painter->device(), m_stampAnnotation.getFlags(), page, rectangle);
|
||||
QTransform matrix = getProxy()->getAnnotationManager()->prepareTransformations(pagePointToDevicePointMatrix, painter->device(), m_stampAnnotation.getFlags(), page, rectangle);
|
||||
painter->setWorldTransform(QTransform(matrix), true);
|
||||
|
||||
AnnotationDrawParameters parameters;
|
||||
@ -874,7 +874,7 @@ void PDFCreateHighlightTextTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -928,7 +928,7 @@ void PDFCreateHighlightTextTool::mouseReleaseEvent(QWidget* widget, QMouseEvent*
|
||||
|
||||
QPolygonF quadrilaterals;
|
||||
PDFTextSelectionPainter textSelectionPainter(&m_textSelection);
|
||||
QPainterPath path = textSelectionPainter.prepareGeometry(pageIndex, textLayoutGetter, QMatrix(), &quadrilaterals);
|
||||
QPainterPath path = textSelectionPainter.prepareGeometry(pageIndex, textLayoutGetter, QTransform(), &quadrilaterals);
|
||||
|
||||
if (!path.isEmpty())
|
||||
{
|
||||
@ -1114,7 +1114,7 @@ void PDFCreateRedactTextTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -1168,7 +1168,7 @@ void PDFCreateRedactTextTool::mouseReleaseEvent(QWidget* widget, QMouseEvent* ev
|
||||
|
||||
QPolygonF quadrilaterals;
|
||||
PDFTextSelectionPainter textSelectionPainter(&m_textSelection);
|
||||
QPainterPath path = textSelectionPainter.prepareGeometry(pageIndex, textLayoutGetter, QMatrix(), &quadrilaterals);
|
||||
QPainterPath path = textSelectionPainter.prepareGeometry(pageIndex, textLayoutGetter, QTransform(), &quadrilaterals);
|
||||
|
||||
if (!path.isEmpty())
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ public:
|
||||
virtual void drawPage(QPainter* painter, PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
PDFReal getPenWidth() const;
|
||||
@ -170,7 +170,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
PDFReal getPenWidth() const;
|
||||
@ -205,7 +205,7 @@ public:
|
||||
virtual void drawPage(QPainter* painter, PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual void mousePressEvent(QWidget* widget, QMouseEvent* event) override;
|
||||
@ -243,7 +243,7 @@ public:
|
||||
virtual void drawPage(QPainter* painter, PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual void mouseMoveEvent(QWidget* widget, QMouseEvent* event) override;
|
||||
@ -283,7 +283,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual void mousePressEvent(QWidget* widget, QMouseEvent* event) override;
|
||||
@ -347,7 +347,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual void mousePressEvent(QWidget* widget, QMouseEvent* event) override;
|
||||
|
@ -772,7 +772,7 @@ PDFAnnotationPtr PDFAnnotation::parse(const PDFObjectStorage* storage, PDFObject
|
||||
|
||||
if (const PDFDictionary* fixedPrintDictionary = storage->getDictionaryFromObject(dictionary->get("FixedPrint")))
|
||||
{
|
||||
annotation->m_matrix = loader.readMatrixFromDictionary(fixedPrintDictionary, "Matrix", QMatrix());
|
||||
annotation->m_matrix = loader.readMatrixFromDictionary(fixedPrintDictionary, "Matrix", QTransform());
|
||||
annotation->m_relativeHorizontalOffset = loader.readNumberFromDictionary(fixedPrintDictionary, "H", 0.0);
|
||||
annotation->m_relativeVerticalOffset = loader.readNumberFromDictionary(fixedPrintDictionary, "V", 0.0);
|
||||
}
|
||||
@ -1204,14 +1204,14 @@ PDFAnnotationManager::~PDFAnnotationManager()
|
||||
|
||||
}
|
||||
|
||||
QMatrix PDFAnnotationManager::prepareTransformations(const QMatrix& pagePointToDevicePointMatrix,
|
||||
QTransform PDFAnnotationManager::prepareTransformations(const QTransform& pagePointToDevicePointMatrix,
|
||||
QPaintDevice* device,
|
||||
const PDFAnnotation::Flags annotationFlags,
|
||||
const PDFPage* page,
|
||||
QRectF& annotationRectangle) const
|
||||
{
|
||||
// "Unrotate" user coordinate space, if NoRotate flag is set
|
||||
QMatrix userSpaceToDeviceSpace = pagePointToDevicePointMatrix;
|
||||
QTransform userSpaceToDeviceSpace = pagePointToDevicePointMatrix;
|
||||
if (annotationFlags.testFlag(PDFAnnotation::NoRotate))
|
||||
{
|
||||
PDFReal rotationAngle = 0.0;
|
||||
@ -1237,12 +1237,12 @@ QMatrix PDFAnnotationManager::prepareTransformations(const QMatrix& pagePointToD
|
||||
break;
|
||||
}
|
||||
|
||||
QMatrix rotationMatrix;
|
||||
QTransform rotationMatrix;
|
||||
rotationMatrix.rotate(-rotationAngle);
|
||||
QPointF topLeft = annotationRectangle.bottomLeft(); // Do not forget, that y is upward instead of Qt
|
||||
QPointF difference = topLeft - rotationMatrix.map(topLeft);
|
||||
|
||||
QMatrix finalMatrix;
|
||||
QTransform finalMatrix;
|
||||
finalMatrix.translate(difference.x(), difference.y());
|
||||
finalMatrix.rotate(-rotationAngle);
|
||||
userSpaceToDeviceSpace = finalMatrix * userSpaceToDeviceSpace;
|
||||
@ -1270,7 +1270,7 @@ QMatrix PDFAnnotationManager::prepareTransformations(const QMatrix& pagePointToD
|
||||
void PDFAnnotationManager::drawWidgetAnnotationHighlight(QRectF annotationRectangle,
|
||||
const PDFAnnotation* annotation,
|
||||
QPainter* painter,
|
||||
QMatrix userSpaceToDeviceSpace) const
|
||||
QTransform userSpaceToDeviceSpace) const
|
||||
{
|
||||
const bool isWidget = annotation->getType() == AnnotationType::Widget;
|
||||
if (m_formManager && isWidget)
|
||||
@ -1325,7 +1325,7 @@ void PDFAnnotationManager::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -1387,7 +1387,7 @@ void PDFAnnotationManager::drawPage(QPainter* painter,
|
||||
}
|
||||
|
||||
void PDFAnnotationManager::drawAnnotation(const PageAnnotation& annotation,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
const PDFCMS* cms,
|
||||
bool isEditorDrawEnabled,
|
||||
@ -1448,7 +1448,7 @@ bool PDFAnnotationManager::isAnnotationDrawnByEditor(const PageAnnotation& annot
|
||||
}
|
||||
|
||||
void PDFAnnotationManager::drawAnnotationDirect(const PageAnnotation& annotation,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
const PDFCMS* cms,
|
||||
bool isEditorDrawEnabled,
|
||||
@ -1495,7 +1495,7 @@ void PDFAnnotationManager::drawAnnotationDirect(const PageAnnotation& annotation
|
||||
|
||||
void PDFAnnotationManager::drawAnnotationUsingAppearanceStream(const PageAnnotation& annotation,
|
||||
const PDFObject& appearanceStreamObject,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
const PDFCMS* cms,
|
||||
QPainter* painter) const
|
||||
@ -1507,7 +1507,7 @@ void PDFAnnotationManager::drawAnnotationUsingAppearanceStream(const PageAnnotat
|
||||
const PDFAnnotation::Flags annotationFlags = annotation.annotation->getEffectiveFlags();
|
||||
QRectF annotationRectangle = annotation.annotation->getRectangle();
|
||||
QRectF formBoundingBox = loader.readRectangle(formDictionary->get("BBox"), QRectF());
|
||||
QMatrix formMatrix = loader.readMatrixFromDictionary(formDictionary, "Matrix", QMatrix());
|
||||
QTransform formMatrix = loader.readMatrixFromDictionary(formDictionary, "Matrix", QTransform());
|
||||
QByteArray content = m_document->getDecodedStream(formStream);
|
||||
PDFObject resources = m_document->getObject(formDictionary->get("Resources"));
|
||||
PDFObject transparencyGroup = m_document->getObject(formDictionary->get("Group"));
|
||||
@ -1519,7 +1519,7 @@ void PDFAnnotationManager::drawAnnotationUsingAppearanceStream(const PageAnnotat
|
||||
return;
|
||||
}
|
||||
|
||||
QMatrix userSpaceToDeviceSpace = prepareTransformations(pagePointToDevicePointMatrix, painter->device(), annotationFlags, page, annotationRectangle);
|
||||
QTransform userSpaceToDeviceSpace = prepareTransformations(pagePointToDevicePointMatrix, painter->device(), annotationFlags, page, annotationRectangle);
|
||||
|
||||
PDFRenderer::Features features = m_features;
|
||||
if (annotationFlags.testFlag(PDFAnnotation::NoZoom))
|
||||
@ -1540,10 +1540,10 @@ void PDFAnnotationManager::drawAnnotationUsingAppearanceStream(const PageAnnotat
|
||||
const PDFReal scaleY = annotationRectangle.height() / transformedAppearanceBox.height();
|
||||
const PDFReal translateX = annotationRectangle.left() - transformedAppearanceBox.left() * scaleX;
|
||||
const PDFReal translateY = annotationRectangle.bottom() - transformedAppearanceBox.bottom() * scaleY;
|
||||
QMatrix A(scaleX, 0.0, 0.0, scaleY, translateX, translateY);
|
||||
QTransform A(scaleX, 0.0, 0.0, scaleY, translateX, translateY);
|
||||
|
||||
// Step 3) - compute final matrix AA
|
||||
QMatrix AA = formMatrix * A;
|
||||
QTransform AA = formMatrix * A;
|
||||
|
||||
bool isContentVisible = false;
|
||||
|
||||
@ -1872,7 +1872,7 @@ void PDFWidgetAnnotationManager::updateFromMouseEvent(QMouseEvent* event)
|
||||
|
||||
const PDFAppeareanceStreams::Appearance oldAppearance = pageAnnotation.appearance;
|
||||
QRectF annotationRect = pageAnnotation.annotation->getRectangle();
|
||||
QMatrix matrix = prepareTransformations(snapshotItem.pageToDeviceMatrix, widget, pageAnnotation.annotation->getEffectiveFlags(), m_document->getCatalog()->getPage(snapshotItem.pageIndex), annotationRect);
|
||||
QTransform matrix = prepareTransformations(snapshotItem.pageToDeviceMatrix, widget, pageAnnotation.annotation->getEffectiveFlags(), m_document->getCatalog()->getPage(snapshotItem.pageIndex), annotationRect);
|
||||
QPainterPath path;
|
||||
path.addRect(annotationRect);
|
||||
path = matrix.map(path);
|
||||
@ -2119,12 +2119,10 @@ void PDFWidgetAnnotationManager::createWidgetsForMarkupAnnotations(QWidget* pare
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(parentWidget);
|
||||
layout->addWidget(scrollArea);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(QMargins());
|
||||
|
||||
QWidget* frameWidget = new QWidget(scrollArea);
|
||||
QVBoxLayout* frameLayout = new QVBoxLayout(frameWidget);
|
||||
frameLayout->setMargin(0);
|
||||
frameLayout->setSpacing(0);
|
||||
scrollArea->setWidget(frameWidget);
|
||||
|
||||
@ -2333,7 +2331,7 @@ void PDFTextAnnotation::draw(AnnotationDrawParameters& parameters) const
|
||||
|
||||
QPainterPath textPath;
|
||||
textPath.addText(0.0, 0.0, font, text);
|
||||
textPath = QMatrix(1.0, 0.0, 0.0, -1.0, 0.0, 0.0).map(textPath);
|
||||
textPath = QTransform(1.0, 0.0, 0.0, -1.0, 0.0, 0.0).map(textPath);
|
||||
QRectF textBoundingRect = textPath.boundingRect();
|
||||
QPointF offset = rectangle.center() - textBoundingRect.center();
|
||||
textPath.translate(offset);
|
||||
@ -2566,8 +2564,8 @@ void PDFPolygonalGeometryAnnotation::draw(AnnotationDrawParameters& parameters)
|
||||
boundingPath = m_path;
|
||||
painter.drawPath(m_path);
|
||||
|
||||
QMatrix LCStoGCS_start = LineGeometryInfo::create(QLineF(m_path.pointAtPercent(0.00), m_path.pointAtPercent(0.01))).LCStoGCS;
|
||||
QMatrix LCStoGCS_end = LineGeometryInfo::create(QLineF(m_path.pointAtPercent(0.99), m_path.pointAtPercent(1.00))).LCStoGCS;
|
||||
QTransform LCStoGCS_start = LineGeometryInfo::create(QLineF(m_path.pointAtPercent(0.00), m_path.pointAtPercent(0.01))).LCStoGCS;
|
||||
QTransform LCStoGCS_end = LineGeometryInfo::create(QLineF(m_path.pointAtPercent(0.99), m_path.pointAtPercent(1.00))).LCStoGCS;
|
||||
|
||||
drawLineEnding(&painter, m_path.pointAtPercent(0), lineEndingSize, arrowAxisLength, getStartLineEnding(), false, LCStoGCS_start, boundingPath);
|
||||
drawLineEnding(&painter, m_path.pointAtPercent(1), lineEndingSize, arrowAxisLength, getEndLineEnding(), true, LCStoGCS_end, boundingPath);
|
||||
@ -2604,7 +2602,7 @@ PDFAnnotation::LineGeometryInfo PDFAnnotation::LineGeometryInfo::create(QLineF l
|
||||
// Matrix LCStoGCS is local coordinate system of line line. It transforms
|
||||
// points on the line to the global coordinate system. So, point (0, 0) will
|
||||
// map onto p1 and point (length(p1-p2), 0) will map onto p2.
|
||||
result.LCStoGCS = QMatrix();
|
||||
result.LCStoGCS = QTransform();
|
||||
result.LCStoGCS.translate(p1.x(), p1.y());
|
||||
result.LCStoGCS.rotate(angle);
|
||||
result.GCStoLCS = result.LCStoGCS.inverted();
|
||||
@ -2618,7 +2616,7 @@ void PDFAnnotation::drawLineEnding(QPainter* painter,
|
||||
PDFReal arrowAxisLength,
|
||||
AnnotationLineEnding ending,
|
||||
bool flipAxis,
|
||||
const QMatrix& LCStoGCS,
|
||||
const QTransform& LCStoGCS,
|
||||
QPainterPath& boundingPath) const
|
||||
{
|
||||
QPainterPath path;
|
||||
@ -2714,7 +2712,7 @@ void PDFAnnotation::drawLineEnding(QPainter* painter,
|
||||
// Flip the x-axis (we are drawing endpoint)
|
||||
if (flipAxis && ending != AnnotationLineEnding::Slash)
|
||||
{
|
||||
QMatrix matrix;
|
||||
QTransform matrix;
|
||||
matrix.scale(-1.0, 1.0);
|
||||
path = matrix.map(path);
|
||||
}
|
||||
@ -2779,7 +2777,7 @@ void PDFAnnotation::drawLine(const PDFAnnotation::LineGeometryInfo& info,
|
||||
textVerticalOffset = fontMetrics.descent() + fontMetrics.leading();
|
||||
|
||||
textPath.addText(0, 0, font, text);
|
||||
textPath = QMatrix(1, 0, 0, -1, 0, 0).map(textPath);
|
||||
textPath = QTransform(1, 0, 0, -1, 0, 0).map(textPath);
|
||||
}
|
||||
|
||||
drawLineEnding(&painter, info.transformedLine.p1(), lineEndingSize, arrowAxisLength, p1Ending, false, info.LCStoGCS, boundingPath);
|
||||
@ -3340,7 +3338,7 @@ void PDFStampAnnotation::draw(AnnotationDrawParameters& parameters) const
|
||||
font.setPixelSize(textHeight);
|
||||
|
||||
QFontMetricsF fontMetrics(font, painter.device());
|
||||
const qreal textWidth = fontMetrics.width(text);
|
||||
const qreal textWidth = fontMetrics.horizontalAdvance(text);
|
||||
const qreal rectangleWidth = textWidth + 10;
|
||||
const qreal rectangleHeight = textHeight * 1.2;
|
||||
const qreal penWidth = 2.0;
|
||||
@ -3358,7 +3356,7 @@ void PDFStampAnnotation::draw(AnnotationDrawParameters& parameters) const
|
||||
// Draw text
|
||||
QPainterPath textPath;
|
||||
textPath.addText(0, 0, font, text);
|
||||
textPath = QMatrix(1, 0, 0, -1, 0, 0).map(textPath);
|
||||
textPath = QTransform(1, 0, 0, -1, 0, 0).map(textPath);
|
||||
|
||||
QPointF center = textPath.boundingRect().center();
|
||||
textPath.translate(rectangle.center() - center);
|
||||
@ -3462,7 +3460,7 @@ void PDFAnnotation::drawCharacterSymbol(QString text, PDFReal opacity, Annotatio
|
||||
|
||||
QPainterPath textPath;
|
||||
textPath.addText(0.0, 0.0, font, text);
|
||||
textPath = QMatrix(1.0, 0.0, 0.0, -1.0, 0.0, 0.0).map(textPath);
|
||||
textPath = QTransform(1.0, 0.0, 0.0, -1.0, 0.0, 0.0).map(textPath);
|
||||
QRectF textBoundingRect = textPath.boundingRect();
|
||||
QPointF offset = rectangle.center() - textBoundingRect.center();
|
||||
textPath.translate(offset);
|
||||
|
@ -616,11 +616,11 @@ protected:
|
||||
/// Matrix LCStoGCS is local coordinate system of line originalLine. It transforms
|
||||
/// points on the line to the global coordinate system. So, point (0, 0) will
|
||||
/// map onto p1 and point (originalLine.length(), 0) will map onto p2.
|
||||
QMatrix LCStoGCS;
|
||||
QTransform LCStoGCS;
|
||||
|
||||
/// Inverted matrix of LCStoGCS. It maps global coordinate system to local
|
||||
/// coordinate system of the original line.
|
||||
QMatrix GCStoLCS;
|
||||
QTransform GCStoLCS;
|
||||
|
||||
static LineGeometryInfo create(QLineF line);
|
||||
};
|
||||
@ -652,7 +652,7 @@ protected:
|
||||
PDFReal arrowAxisLength,
|
||||
AnnotationLineEnding ending,
|
||||
bool flipAxis,
|
||||
const QMatrix& LCStoGCS,
|
||||
const QTransform& LCStoGCS,
|
||||
QPainterPath& boundingPath) const;
|
||||
|
||||
/// Draw line using given parameters and painter. Line is specified
|
||||
@ -1326,14 +1326,14 @@ public:
|
||||
|
||||
virtual AnnotationType getType() const override { return AnnotationType::Watermark; }
|
||||
|
||||
const QMatrix& getMatrix() const { return m_matrix; }
|
||||
const QTransform& getMatrix() const { return m_matrix; }
|
||||
PDFReal getRelativeHorizontalOffset() const { return m_relativeHorizontalOffset; }
|
||||
PDFReal getRelativeVerticalOffset() const { return m_relativeVerticalOffset; }
|
||||
|
||||
private:
|
||||
friend PDFAnnotationPtr PDFAnnotation::parse(const PDFObjectStorage* storage, PDFObjectReference reference);
|
||||
|
||||
QMatrix m_matrix;
|
||||
QTransform m_matrix;
|
||||
PDFReal m_relativeHorizontalOffset = 0.0;
|
||||
PDFReal m_relativeVerticalOffset = 0.0;
|
||||
};
|
||||
@ -1439,7 +1439,7 @@ class PDF4QTLIBSHARED_EXPORT PDFAnnotationManager : public QObject, public IDocu
|
||||
private:
|
||||
using BaseClass = QObject;
|
||||
|
||||
void drawWidgetAnnotationHighlight(QRectF annotationRectangle, PDFObjectReference annotationReference, QPainter* painter, QMatrix userSpaceToDeviceSpace) const;
|
||||
void drawWidgetAnnotationHighlight(QRectF annotationRectangle, PDFObjectReference annotationReference, QPainter* painter, QTransform userSpaceToDeviceSpace) const;
|
||||
|
||||
public:
|
||||
|
||||
@ -1462,7 +1462,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
/// Set document
|
||||
@ -1523,7 +1523,7 @@ public:
|
||||
/// \param annotationFlags Annotation flags
|
||||
/// \param page Page
|
||||
/// \param[in,out] annotationRectangle Input/output annotation rectangle
|
||||
QMatrix prepareTransformations(const QMatrix& pagePointToDevicePointMatrix,
|
||||
QTransform prepareTransformations(const QTransform& pagePointToDevicePointMatrix,
|
||||
QPaintDevice* device,
|
||||
const PDFAnnotation::Flags annotationFlags,
|
||||
const PDFPage* page,
|
||||
@ -1553,7 +1553,7 @@ protected:
|
||||
void drawWidgetAnnotationHighlight(QRectF annotationRectangle,
|
||||
const PDFAnnotation* annotation,
|
||||
QPainter* painter,
|
||||
QMatrix userSpaceToDeviceSpace) const;
|
||||
QTransform userSpaceToDeviceSpace) const;
|
||||
|
||||
/// Returns true, if given annotation should be drawn
|
||||
/// \param annotation Annotation
|
||||
@ -1572,7 +1572,7 @@ protected:
|
||||
/// \param errors Errors list (where draw errors are stored)
|
||||
/// \param painter Painter
|
||||
void drawAnnotation(const PageAnnotation& annotation,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
const PDFCMS* cms,
|
||||
bool isEditorDrawEnabled,
|
||||
@ -1588,7 +1588,7 @@ protected:
|
||||
/// \param isEditorDrawEnabled Is annotation drawn by form widget editor?
|
||||
/// \param painter Painter
|
||||
void drawAnnotationDirect(const PageAnnotation& annotation,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
const PDFCMS* cms,
|
||||
bool isEditorDrawEnabled,
|
||||
@ -1603,7 +1603,7 @@ protected:
|
||||
/// \param painter Painter
|
||||
void drawAnnotationUsingAppearanceStream(const PageAnnotation& annotation,
|
||||
const PDFObject& appearanceStreamObject,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
const PDFCMS* cms,
|
||||
QPainter* painter) const;
|
||||
|
@ -1398,7 +1398,7 @@ bool PDFCMSGeneric::transformColorSpace(const PDFCMS::ColorSpaceTransformParams&
|
||||
PDFCMSManager::PDFCMSManager(QObject* parent) :
|
||||
BaseClass(parent),
|
||||
m_document(nullptr),
|
||||
m_mutex(QMutex::Recursive)
|
||||
m_mutex()
|
||||
{
|
||||
|
||||
}
|
||||
@ -1485,7 +1485,7 @@ PDFCMSSettings PDFCMSManager::getDefaultSettings() const
|
||||
|
||||
void PDFCMSManager::setDocument(const PDFDocument* document)
|
||||
{
|
||||
std::optional<QMutexLocker> lock;
|
||||
std::optional<QMutexLocker<QRecursiveMutex>> lock;
|
||||
lock.emplace(&m_mutex);
|
||||
|
||||
if (m_document == document)
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "pdfexception.h"
|
||||
#include "pdfutils.h"
|
||||
|
||||
#include <QMutex>
|
||||
#include <QRecursiveMutex>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include <compare>
|
||||
@ -415,7 +415,7 @@ private:
|
||||
const PDFDocument* m_document;
|
||||
PDFColorProfileIdentifiers m_outputIntentProfiles;
|
||||
|
||||
mutable QMutex m_mutex;
|
||||
mutable QRecursiveMutex m_mutex;
|
||||
mutable PDFCachedItem<PDFCMSPointer> m_CMS;
|
||||
mutable PDFCachedItem<PDFColorProfileIdentifiers> m_outputProfiles;
|
||||
mutable PDFCachedItem<PDFColorProfileIdentifiers> m_grayProfiles;
|
||||
|
@ -807,7 +807,7 @@ bool PDFAbstractColorSpace::transform(const PDFAbstractColorSpace* source,
|
||||
Q_ASSERT(sourceIt + 1 != input.end());
|
||||
Q_ASSERT(sourceIt + 2 != input.end());
|
||||
|
||||
PDFColorComponent LStar = qBound<PDFColorComponent>(0.0, interpolate(*sourceIt, 0.0, 1.0, 0.0, 100.0), 100.0);
|
||||
PDFColorComponent LStar = qBound<PDFColorComponent>(PDFColorComponent(0.0), interpolate(*sourceIt, 0.0, 1.0, 0.0, 100.0), PDFColorComponent(100.0));
|
||||
PDFColorComponent aStar = qBound<PDFColorComponent>(aMin, interpolate(*std::next(sourceIt, 1), 0.0, 1.0, aMin, aMax), aMax);
|
||||
PDFColorComponent bStar = qBound<PDFColorComponent>(bMin, interpolate(*std::next(sourceIt, 2), 0.0, 1.0, bMin, bMax), bMax);
|
||||
|
||||
@ -1473,13 +1473,13 @@ QColor PDFLabColorSpace::getColor(const PDFColor& color, const PDFCMS* cms, Rend
|
||||
|
||||
if (isRange01)
|
||||
{
|
||||
LStar = qBound(0.0, interpolate(color[0], 0.0, 1.0, 0.0, 100.0), 100.0);
|
||||
LStar = qBound<PDFColorComponent>(PDFColorComponent(0.0), interpolate(color[0], 0.0, 1.0, 0.0, 100.0), PDFColorComponent(100.0));
|
||||
aStar = qBound<PDFColorComponent>(m_aMin, interpolate(color[1], 0.0, 1.0, m_aMin, m_aMax), m_aMax);
|
||||
bStar = qBound<PDFColorComponent>(m_bMin, interpolate(color[2], 0.0, 1.0, m_bMin, m_bMax), m_bMax);
|
||||
}
|
||||
else
|
||||
{
|
||||
LStar = qBound<PDFColorComponent>(0.0, color[0], 100.0);
|
||||
LStar = qBound<PDFColorComponent>(PDFColorComponent(0.0), color[0], PDFColorComponent(100.0));
|
||||
aStar = qBound<PDFColorComponent>(m_aMin, color[1], m_aMax);
|
||||
bStar = qBound<PDFColorComponent>(m_bMin, color[2], m_bMax);
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ public:
|
||||
|
||||
protected:
|
||||
/// Clips the color component to range [0, 1]
|
||||
static constexpr PDFColorComponent clip01(PDFColorComponent component) { return qBound<PDFColorComponent>(0.0, component, 1.0); }
|
||||
static constexpr PDFColorComponent clip01(PDFColorComponent component) { return qBound<PDFColorComponent>(PDFColorComponent(0.0), component, PDFColorComponent(1.0)); }
|
||||
|
||||
/// Clips the color to range [0 1] in all components
|
||||
static constexpr PDFColor3 clip01(const PDFColor3& color)
|
||||
|
@ -473,7 +473,7 @@ PDFTextLayout PDFAsynchronousTextLayoutCompiler::createTextLayout(PDFInteger pag
|
||||
m_proxy->getFontCache()->setCacheShrinkEnabled(&guard, false);
|
||||
|
||||
PDFCMSPointer cms = m_proxy->getCMSManager()->getCurrentCMS();
|
||||
PDFTextLayoutGenerator generator(m_proxy->getFeatures(), page, m_proxy->getDocument(), m_proxy->getFontCache(), cms.data(), m_proxy->getOptionalContentActivity(), QMatrix(), m_proxy->getMeshQualitySettings());
|
||||
PDFTextLayoutGenerator generator(m_proxy->getFeatures(), page, m_proxy->getDocument(), m_proxy->getFontCache(), cms.data(), m_proxy->getOptionalContentActivity(), QTransform(), m_proxy->getMeshQualitySettings());
|
||||
generator.processContents();
|
||||
result = generator.createTextLayout();
|
||||
m_proxy->getFontCache()->setCacheShrinkEnabled(&guard, true);
|
||||
@ -605,7 +605,7 @@ void PDFAsynchronousTextLayoutCompiler::makeTextLayout()
|
||||
const PDFPage* page = catalog->getPage(pageIndex);
|
||||
Q_ASSERT(page);
|
||||
|
||||
PDFTextLayoutGenerator generator(m_proxy->getFeatures(), page, m_proxy->getDocument(), m_proxy->getFontCache(), cms.data(), m_proxy->getOptionalContentActivity(), QMatrix(), m_proxy->getMeshQualitySettings());
|
||||
PDFTextLayoutGenerator generator(m_proxy->getFeatures(), page, m_proxy->getDocument(), m_proxy->getFontCache(), cms.data(), m_proxy->getOptionalContentActivity(), QTransform(), m_proxy->getMeshQualitySettings());
|
||||
generator.processContents();
|
||||
result.setTextLayout(pageIndex, generator.createTextLayout(), &mutex);
|
||||
m_proxy->getProgress()->step();
|
||||
|
@ -237,7 +237,7 @@ public:
|
||||
const PDFFontCache* fontCache,
|
||||
const PDFCMS* cms,
|
||||
const PDFOptionalContentActivity* optionalContentActivity,
|
||||
QMatrix pagePointToDevicePointMatrix,
|
||||
QTransform pagePointToDevicePointMatrix,
|
||||
const PDFMeshQualitySettings& meshQualitySettings) :
|
||||
BaseClass(page, document, fontCache, cms, optionalContentActivity, pagePointToDevicePointMatrix, meshQualitySettings),
|
||||
m_features(features)
|
||||
|
@ -677,8 +677,11 @@ void PDFDiff::performCompare(const std::vector<PDFDiffPageContext>& leftPrepared
|
||||
const auto& aItem = a.left ? context.leftTextFlow : context.rightTextFlow;
|
||||
const auto& bItem = b.left ? context.leftTextFlow : context.rightTextFlow;
|
||||
|
||||
QStringRef aText(&aItem.getItem(a.index)->text, a.charIndex, a.charCount);
|
||||
QStringRef bText(&bItem.getItem(b.index)->text, b.charIndex, b.charCount);
|
||||
QStringView aText(aItem.getItem(a.index)->text);
|
||||
aText = aText.mid(a.charIndex, a.charCount);
|
||||
|
||||
QStringView bText(bItem.getItem(b.index)->text);
|
||||
bText = bText.mid(b.charIndex, b.charCount);
|
||||
|
||||
return aText == bText;
|
||||
};
|
||||
@ -758,7 +761,10 @@ void PDFDiff::performCompare(const std::vector<PDFDiffPageContext>& leftPrepared
|
||||
const TextCompareItem& textCompareItem = leftItems[item.index1];
|
||||
const auto& textFlow = textCompareItem.left ? context.leftTextFlow : context.rightTextFlow;
|
||||
const PDFDocumentTextFlow::Item* textItem = textFlow.getItem(textCompareItem.index);
|
||||
QStringRef text(&textItem->text, textCompareItem.charIndex, textCompareItem.charCount);
|
||||
|
||||
QStringView text(textItem->text);
|
||||
text = text.mid(textCompareItem.charIndex, textCompareItem.charCount);
|
||||
|
||||
leftStrings << text.toString();
|
||||
|
||||
if (pageIndex1 == -1)
|
||||
@ -783,7 +789,10 @@ void PDFDiff::performCompare(const std::vector<PDFDiffPageContext>& leftPrepared
|
||||
const TextCompareItem& textCompareItem = rightItems[item.index2];
|
||||
const auto& textFlow = textCompareItem.left ? context.leftTextFlow : context.rightTextFlow;
|
||||
const PDFDocumentTextFlow::Item* textItem = textFlow.getItem(textCompareItem.index);
|
||||
QStringRef text(&textItem->text, textCompareItem.charIndex, textCompareItem.charCount);
|
||||
|
||||
QStringView text(textItem->text);
|
||||
text = text.mid(textCompareItem.charIndex, textCompareItem.charCount);
|
||||
|
||||
rightStrings << text.toString();
|
||||
|
||||
if (pageIndex2 == -1)
|
||||
|
@ -276,7 +276,7 @@ QRectF PDFDocumentDataLoaderDecorator::readRectangle(const PDFObject& object, co
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
QMatrix PDFDocumentDataLoaderDecorator::readMatrixFromDictionary(const PDFDictionary* dictionary, const char* key, QMatrix defaultValue) const
|
||||
QTransform PDFDocumentDataLoaderDecorator::readMatrixFromDictionary(const PDFDictionary* dictionary, const char* key, QTransform defaultValue) const
|
||||
{
|
||||
if (dictionary->hasKey(key))
|
||||
{
|
||||
@ -286,7 +286,7 @@ QMatrix PDFDocumentDataLoaderDecorator::readMatrixFromDictionary(const PDFDictio
|
||||
throw PDFRendererException(RenderErrorType::Error, PDFTranslationContext::tr("Invalid number of matrix elements. Expected 6, actual %1.").arg(matrixNumbers.size()));
|
||||
}
|
||||
|
||||
return QMatrix(matrixNumbers[0], matrixNumbers[1], matrixNumbers[2], matrixNumbers[3], matrixNumbers[4], matrixNumbers[5]);
|
||||
return QTransform(matrixNumbers[0], matrixNumbers[1], matrixNumbers[2], matrixNumbers[3], matrixNumbers[4], matrixNumbers[5]);
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include <QtCore>
|
||||
#include <QColor>
|
||||
#include <QMatrix>
|
||||
#include <QTransform>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <optional>
|
||||
@ -257,7 +257,7 @@ public:
|
||||
|
||||
/// Tries to read matrix from the dictionary. If matrix entry is not present, default value is returned.
|
||||
/// If it is present and invalid, exception is thrown.
|
||||
QMatrix readMatrixFromDictionary(const PDFDictionary* dictionary, const char* key, QMatrix defaultValue) const;
|
||||
QTransform readMatrixFromDictionary(const PDFDictionary* dictionary, const char* key, QTransform defaultValue) const;
|
||||
|
||||
/// Tries to read array of real values from dictionary. If entry dictionary doesn't exist,
|
||||
/// or error occurs, default value is returned.
|
||||
|
@ -505,7 +505,7 @@ PDFObject PDFObjectFactory::createTextString(QString textString)
|
||||
|
||||
{
|
||||
QTextStream textStream(&ba, QIODevice::WriteOnly);
|
||||
textStream.setCodec("UTF-16BE");
|
||||
textStream.setEncoding(QStringConverter::Utf16BE);
|
||||
textStream.setGenerateByteOrderMark(true);
|
||||
textStream << textString;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
pdf::PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const;
|
||||
|
||||
/// Performs drawing of additional graphics after all pages are drawn onto the painter.
|
||||
|
@ -183,7 +183,7 @@ public:
|
||||
const PDFFontCache* fontCache,
|
||||
const PDFCMS* cms,
|
||||
const PDFOptionalContentActivity* optionalContentActivity,
|
||||
QMatrix pagePointToDevicePointMatrix,
|
||||
QTransform pagePointToDevicePointMatrix,
|
||||
const PDFMeshQualitySettings& meshQualitySettings,
|
||||
const PDFStructureTree* tree,
|
||||
const std::map<PDFObjectReference, const PDFStructureItem*>* mapping,
|
||||
@ -449,7 +449,7 @@ void PDFStructureTreeTextExtractor::perform(const std::vector<PDFInteger>& pageI
|
||||
const PDFPage* page = catalog->getPage(pageIndex);
|
||||
Q_ASSERT(page);
|
||||
|
||||
PDFStructureTreeTextContentProcessor processor(PDFRenderer::IgnoreOptionalContent, page, m_document, &fontCache, &cms, &oca, QMatrix(), mqs, m_tree, &mapping, m_options);
|
||||
PDFStructureTreeTextContentProcessor processor(PDFRenderer::IgnoreOptionalContent, page, m_document, &fontCache, &cms, &oca, QTransform(), mqs, m_tree, &mapping, m_options);
|
||||
QList<PDFRenderError> errors = processor.processContents();
|
||||
|
||||
QMutexLocker lock(&mutex);
|
||||
@ -696,7 +696,7 @@ PDFDocumentTextFlow PDFDocumentTextFlowFactory::create(const PDFDocument* docume
|
||||
const PDFPage* page = catalog->getPage(pageIndex);
|
||||
Q_ASSERT(page);
|
||||
|
||||
PDFTextLayoutGenerator generator(PDFRenderer::IgnoreOptionalContent, page, document, &fontCache, &cms, &oca, QMatrix(), mqs);
|
||||
PDFTextLayoutGenerator generator(PDFRenderer::IgnoreOptionalContent, page, document, &fontCache, &cms, &oca, QTransform(), mqs);
|
||||
QList<PDFRenderError> errors = generator.processContents();
|
||||
PDFTextLayout textLayout = generator.createTextLayout();
|
||||
PDFTextFlows textFlows = PDFTextFlow::createTextFlows(textLayout, PDFTextFlow::FlowFlags(PDFTextFlow::SeparateBlocks) | PDFTextFlow::RemoveSoftHyphen, pageIndex);
|
||||
|
@ -679,9 +679,9 @@ void PDFDrawWidgetProxy::update()
|
||||
emit drawSpaceChanged();
|
||||
}
|
||||
|
||||
QMatrix PDFDrawWidgetProxy::createPagePointToDevicePointMatrix(const PDFPage* page, const QRectF& rectangle) const
|
||||
QTransform PDFDrawWidgetProxy::createPagePointToDevicePointMatrix(const PDFPage* page, const QRectF& rectangle) const
|
||||
{
|
||||
QMatrix matrix;
|
||||
QTransform matrix;
|
||||
|
||||
// We want to create transformation from unrotated rectangle
|
||||
// to rotated page rectangle.
|
||||
@ -788,7 +788,7 @@ void PDFDrawWidgetProxy::drawPages(QPainter* painter, QRect rect, PDFRenderer::F
|
||||
|
||||
const PDFPage* page = m_controller->getDocument()->getCatalog()->getPage(item.pageIndex);
|
||||
QTransform matrix = QTransform(createPagePointToDevicePointMatrix(page, placedRect)) * baseMatrix;
|
||||
compiledPage->draw(painter, page->getCropBox(), matrix.toAffine(), features, groupInfo.transparency);
|
||||
compiledPage->draw(painter, page->getCropBox(), matrix, features, groupInfo.transparency);
|
||||
PDFTextLayoutGetter layoutGetter = m_textLayoutCompiler->getTextLayoutLazy(item.pageIndex);
|
||||
|
||||
// Draw text blocks/text lines, if it is enabled
|
||||
@ -810,7 +810,7 @@ void PDFDrawWidgetProxy::drawPages(QPainter* painter, QRect rect, PDFRenderer::F
|
||||
QString blockNumber = QString::number(blockIndex++);
|
||||
|
||||
painter->drawPath(matrix.map(block.getBoundingBox()));
|
||||
painter->drawText(matrix.map(block.getTopLeft()) - QPointF(fontMetrics.width(blockNumber), 0), blockNumber, Qt::TextSingleLine, 0);
|
||||
painter->drawText(matrix.map(block.getTopLeft()) - QPointF(fontMetrics.horizontalAdvance(blockNumber), 0), blockNumber, Qt::TextSingleLine, 0);
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
@ -835,7 +835,7 @@ void PDFDrawWidgetProxy::drawPages(QPainter* painter, QRect rect, PDFRenderer::F
|
||||
QString lineNumber = QString::number(lineIndex++);
|
||||
|
||||
painter->drawPath(matrix.map(line.getBoundingBox()));
|
||||
painter->drawText(matrix.map(line.getTopLeft()) - QPointF(fontMetrics.width(lineNumber), 0), lineNumber, Qt::TextSingleLine, 0);
|
||||
painter->drawText(matrix.map(line.getTopLeft()) - QPointF(fontMetrics.horizontalAdvance(lineNumber), 0), lineNumber, Qt::TextSingleLine, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -848,7 +848,7 @@ void PDFDrawWidgetProxy::drawPages(QPainter* painter, QRect rect, PDFRenderer::F
|
||||
for (IDocumentDrawInterface* drawInterface : m_drawInterfaces)
|
||||
{
|
||||
painter->save();
|
||||
drawInterface->drawPage(painter, item.pageIndex, compiledPage, layoutGetter, matrix.toAffine(), drawInterfaceErrors);
|
||||
drawInterface->drawPage(painter, item.pageIndex, compiledPage, layoutGetter, matrix, drawInterfaceErrors);
|
||||
painter->restore();
|
||||
}
|
||||
}
|
||||
@ -998,7 +998,7 @@ PDFInteger PDFDrawWidgetProxy::getPageUnderPoint(QPoint point, QPointF* pagePoin
|
||||
if (pagePoint)
|
||||
{
|
||||
const PDFPage* page = m_controller->getDocument()->getCatalog()->getPage(item.pageIndex);
|
||||
QMatrix matrix = createPagePointToDevicePointMatrix(page, placedRect).inverted();
|
||||
QTransform matrix = createPagePointToDevicePointMatrix(page, placedRect).inverted();
|
||||
*pagePoint = matrix.map(point);
|
||||
}
|
||||
|
||||
@ -1534,7 +1534,7 @@ void IDocumentDrawInterface::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(painter);
|
||||
|
@ -181,7 +181,7 @@ struct PDFWidgetSnapshot
|
||||
{
|
||||
PDFInteger pageIndex = -1; ///< Index of page
|
||||
QRectF rect; ///< Page rectangle on viewport
|
||||
QMatrix pageToDeviceMatrix; ///< Transforms page coordinates to widget coordinates
|
||||
QTransform pageToDeviceMatrix; ///< Transforms page coordinates to widget coordinates
|
||||
const PDFPrecompiledPage* compiledPage = nullptr; ///< Compiled page (can be nullptr)
|
||||
};
|
||||
|
||||
@ -217,7 +217,7 @@ public:
|
||||
/// from page's media box to the target rectangle.
|
||||
/// \param page Page, for which we want to create matrix
|
||||
/// \param rectangle Page rectangle, to which is page media box transformed
|
||||
QMatrix createPagePointToDevicePointMatrix(const PDFPage* page, const QRectF& rectangle) const;
|
||||
QTransform createPagePointToDevicePointMatrix(const PDFPage* page, const QRectF& rectangle) const;
|
||||
|
||||
/// Draws the actually visible pages on the painter using the rectangle.
|
||||
/// Rectangle is space in the widget, which is used for painting the PDF.
|
||||
|
@ -52,7 +52,7 @@ PDFWidget::PDFWidget(const PDFCMSManager* cmsManager, RendererEngine engine, int
|
||||
layout->addWidget(m_drawWidget->getWidget(), 0, 0);
|
||||
layout->addWidget(m_horizontalScrollBar, 1, 0);
|
||||
layout->addWidget(m_verticalScrollBar, 0, 1);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(QMargins());
|
||||
|
||||
setLayout(layout);
|
||||
setFocusProxy(m_drawWidget->getWidget());
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "pdfdbgheap.h"
|
||||
|
||||
#include <QTimeZone>
|
||||
#include <QTextCodec>
|
||||
#include <QStringDecoder>
|
||||
|
||||
#include <cctype>
|
||||
#include <cstring>
|
||||
@ -2373,21 +2373,21 @@ QString PDFEncoding::convertSmartFromByteStringToUnicode(const QByteArray& strea
|
||||
|
||||
if (hasUnicodeLeadMarkings(stream))
|
||||
{
|
||||
QTextCodec::ConverterState state = { };
|
||||
|
||||
{
|
||||
QTextCodec* codec = QTextCodec::codecForName("UTF-16BE");
|
||||
QString text = codec->toUnicode(stream.constData(), stream.length(), &state);
|
||||
if (state.invalidChars == 0)
|
||||
QStringDecoder decoder(QStringDecoder::Utf16BE);
|
||||
QString text = decoder.decode(stream);
|
||||
|
||||
if (!decoder.hasError())
|
||||
{
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
QTextCodec* codec = QTextCodec::codecForName("UTF-16LE");
|
||||
QString text = codec->toUnicode(stream.constData(), stream.length(), &state);
|
||||
if (state.invalidChars == 0)
|
||||
QStringDecoder decoder(QStringDecoder::Utf16LE);
|
||||
QString text = decoder.decode(stream);
|
||||
|
||||
if (!decoder.hasError())
|
||||
{
|
||||
return text;
|
||||
}
|
||||
@ -2396,11 +2396,10 @@ QString PDFEncoding::convertSmartFromByteStringToUnicode(const QByteArray& strea
|
||||
|
||||
if (hasUTF8LeadMarkings(stream))
|
||||
{
|
||||
QTextCodec::ConverterState state = { };
|
||||
QStringDecoder decoder(QStringDecoder::Utf8);
|
||||
QString text = decoder.decode(stream);
|
||||
|
||||
QTextCodec* codec = QTextCodec::codecForName("UTF-8");
|
||||
QString text = codec->toUnicode(stream.constData(), stream.length(), &state);
|
||||
if (state.invalidChars == 0)
|
||||
if (!decoder.hasError())
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
@ -1554,7 +1554,7 @@ PDFFontPointer PDFFont::createFont(const PDFObject& object, const PDFDocument* d
|
||||
{
|
||||
throw PDFException(PDFTranslationContext::tr("Invalid Type 3 font matrix."));
|
||||
}
|
||||
QMatrix fontMatrix(fontMatrixValues[0], fontMatrixValues[1], fontMatrixValues[2], fontMatrixValues[3], fontMatrixValues[4], fontMatrixValues[5]);
|
||||
QTransform fontMatrix(fontMatrixValues[0], fontMatrixValues[1], fontMatrixValues[2], fontMatrixValues[3], fontMatrixValues[4], fontMatrixValues[5]);
|
||||
|
||||
PDFObject charProcs = document->getObject(fontDictionary->get("CharProcs"));
|
||||
if (!charProcs.isDictionary())
|
||||
@ -2365,7 +2365,7 @@ PDFReal PDFType0Font::getGlyphAdvance(CID cid) const
|
||||
PDFType3Font::PDFType3Font(FontDescriptor fontDescriptor,
|
||||
int firstCharacterIndex,
|
||||
int lastCharacterIndex,
|
||||
QMatrix fontMatrix,
|
||||
QTransform fontMatrix,
|
||||
std::map<int, QByteArray>&& characterContentStreams,
|
||||
std::vector<double>&& widths,
|
||||
const PDFObject& resources,
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "pdfobject.h"
|
||||
|
||||
#include <QFont>
|
||||
#include <QMatrix>
|
||||
#include <QTransform>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include <set>
|
||||
@ -563,7 +563,7 @@ public:
|
||||
explicit PDFType3Font(FontDescriptor fontDescriptor,
|
||||
int firstCharacterIndex,
|
||||
int lastCharacterIndex,
|
||||
QMatrix fontMatrix,
|
||||
QTransform fontMatrix,
|
||||
std::map<int, QByteArray>&& characterContentStreams,
|
||||
std::vector<double>&& widths,
|
||||
const PDFObject& resources,
|
||||
@ -580,7 +580,7 @@ public:
|
||||
/// is returned.
|
||||
const QByteArray* getContentStream(int characterIndex) const;
|
||||
|
||||
const QMatrix& getFontMatrix() const { return m_fontMatrix; }
|
||||
const QTransform& getFontMatrix() const { return m_fontMatrix; }
|
||||
const PDFObject& getResources() const { return m_resources; }
|
||||
const std::map<int, QByteArray>& getContentStreams() const { return m_characterContentStreams; }
|
||||
|
||||
@ -591,7 +591,7 @@ public:
|
||||
private:
|
||||
int m_firstCharacterIndex;
|
||||
int m_lastCharacterIndex;
|
||||
QMatrix m_fontMatrix;
|
||||
QTransform m_fontMatrix;
|
||||
std::map<int, QByteArray> m_characterContentStreams;
|
||||
std::vector<double> m_widths;
|
||||
PDFObject m_resources;
|
||||
|
@ -232,7 +232,7 @@ private:
|
||||
bool hasContinuousSelection() const;
|
||||
|
||||
/// Creates transformation matrix, which transforms widget coordinates to page coordinates
|
||||
QMatrix createListBoxTransformMatrix() const;
|
||||
QTransform createListBoxTransformMatrix() const;
|
||||
|
||||
PDFFormField::FieldFlags m_flags;
|
||||
|
||||
@ -1464,7 +1464,7 @@ PDFFormManager::MouseEventInfo PDFFormManager::getMouseEventInfo(QWidget* widget
|
||||
{
|
||||
annotationRect = pageAnnotation.annotation->getRectangle();
|
||||
}
|
||||
QMatrix widgetToDevice = m_annotationManager->prepareTransformations(snapshotItem.pageToDeviceMatrix, widget, pageAnnotation.annotation->getEffectiveFlags(), m_document->getCatalog()->getPage(snapshotItem.pageIndex), annotationRect);
|
||||
QTransform widgetToDevice = m_annotationManager->prepareTransformations(snapshotItem.pageToDeviceMatrix, widget, pageAnnotation.annotation->getEffectiveFlags(), m_document->getCatalog()->getPage(snapshotItem.pageIndex), annotationRect);
|
||||
|
||||
QPainterPath path;
|
||||
path.addRect(annotationRect);
|
||||
@ -1490,7 +1490,7 @@ const std::optional<QCursor>& PDFFormManager::getCursor() const
|
||||
return m_mouseCursor;
|
||||
}
|
||||
|
||||
void PDFFormManager::drawXFAForm(const QMatrix& pagePointToDevicePointMatrix,
|
||||
void PDFFormManager::drawXFAForm(const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
QList<PDFRenderError>& errors,
|
||||
QPainter* painter)
|
||||
@ -2672,9 +2672,9 @@ void PDFListBoxPseudowidget::setAppearance(const PDFAnnotationDefaultAppearance&
|
||||
initialize(font, fontColor, textAlignment, rect, options, topIndex, qMove(selection));
|
||||
}
|
||||
|
||||
QMatrix PDFListBoxPseudowidget::createListBoxTransformMatrix() const
|
||||
QTransform PDFListBoxPseudowidget::createListBoxTransformMatrix() const
|
||||
{
|
||||
QMatrix matrix;
|
||||
QTransform matrix;
|
||||
matrix.translate(m_widgetRect.left(), m_widgetRect.bottom());
|
||||
matrix.scale(1.0, -1.0);
|
||||
return matrix;
|
||||
@ -2701,7 +2701,7 @@ void PDFListBoxPseudowidget::draw(AnnotationDrawParameters& parameters, bool edi
|
||||
return color;
|
||||
};
|
||||
|
||||
QMatrix matrix = createListBoxTransformMatrix();
|
||||
QTransform matrix = createListBoxTransformMatrix();
|
||||
|
||||
QPainter* painter = parameters.painter;
|
||||
|
||||
@ -2869,8 +2869,8 @@ int PDFListBoxPseudowidget::getValidIndex(int index) const
|
||||
|
||||
int PDFListBoxPseudowidget::getIndexFromWidgetPosition(const QPointF& point) const
|
||||
{
|
||||
QMatrix widgetToPageMatrix = createListBoxTransformMatrix();
|
||||
QMatrix pageToWidgetMatrix = widgetToPageMatrix.inverted();
|
||||
QTransform widgetToPageMatrix = createListBoxTransformMatrix();
|
||||
QTransform pageToWidgetMatrix = widgetToPageMatrix.inverted();
|
||||
|
||||
QPointF widgetPoint = pageToWidgetMatrix.map(point);
|
||||
const qreal y = widgetPoint.y();
|
||||
|
@ -636,7 +636,7 @@ public:
|
||||
QPointF mousePosition;
|
||||
|
||||
/// Matrix, which maps from device space to widget space
|
||||
QMatrix deviceToWidget;
|
||||
QTransform deviceToWidget;
|
||||
|
||||
/// Returns true, if mouse event info is valid, i.e.
|
||||
/// mouse event occurs above some form field.
|
||||
@ -682,7 +682,7 @@ public:
|
||||
/// \param page Page
|
||||
/// \param errors Error list (for reporting rendering errors)
|
||||
/// \param painter Painter
|
||||
void drawXFAForm(const QMatrix& pagePointToDevicePointMatrix,
|
||||
void drawXFAForm(const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
QList<PDFRenderError>& errors,
|
||||
QPainter* painter);
|
||||
|
@ -25,11 +25,15 @@
|
||||
#include <tuple>
|
||||
#include <array>
|
||||
|
||||
#include <pdf4qtlib_export.h>
|
||||
|
||||
#if !defined(PDF4QTLIBSHARED_EXPORT)
|
||||
#if defined(PDF4QTLIB_LIBRARY)
|
||||
# define PDF4QTLIBSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define PDF4QTLIBSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Compiler detection
|
||||
#if defined(_MSC_VER)
|
||||
|
@ -78,7 +78,7 @@ void PDFIconTheme::prepareTheme()
|
||||
{
|
||||
{
|
||||
QTextStream stream(&file);
|
||||
stream.setCodec("UTF8");
|
||||
stream.setEncoding(QStringConverter::Utf8);
|
||||
stream.setGenerateByteOrderMark(true);
|
||||
for (const QString& text : infoList)
|
||||
{
|
||||
|
@ -3915,7 +3915,7 @@ std::optional<int32_t> PDFJBIG2HuffmanDecoder::readSignedInteger()
|
||||
}
|
||||
else if (it->isLowValue())
|
||||
{
|
||||
return it->value - m_reader->read(32);
|
||||
return it->value - int32_t(m_reader->read(32));
|
||||
}
|
||||
else if (it->rangeBitLength == 0)
|
||||
{
|
||||
@ -3923,7 +3923,7 @@ std::optional<int32_t> PDFJBIG2HuffmanDecoder::readSignedInteger()
|
||||
}
|
||||
else
|
||||
{
|
||||
return it->value + m_reader->read(it->rangeBitLength);
|
||||
return it->value + int32_t(m_reader->read(it->rangeBitLength));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "pdfglobal.h"
|
||||
|
||||
#include <QMatrix>
|
||||
#include <QTransform>
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
@ -38,7 +38,7 @@ struct PDFMeshQualitySettings
|
||||
|
||||
/// Matrix, which transforms user space points (user space is target space of the shading)
|
||||
/// to the device space of the paint device.
|
||||
QMatrix userSpaceToDeviceSpaceMatrix;
|
||||
QTransform userSpaceToDeviceSpaceMatrix;
|
||||
|
||||
/// Rectangle in device space coordinate system, onto which is area meshed.
|
||||
QRectF deviceSpaceMeshingArea;
|
||||
|
@ -87,7 +87,7 @@ void PDFCreatePCElementTool::setTextAngle(PDFReal angle)
|
||||
}
|
||||
|
||||
QRectF PDFCreatePCElementTool::getRectangleFromPickTool(PDFPickTool* pickTool,
|
||||
const QMatrix& pagePointToDevicePointMatrix)
|
||||
const QTransform& pagePointToDevicePointMatrix)
|
||||
{
|
||||
const std::vector<QPointF>& points = pickTool->getPickedPoints();
|
||||
if (points.empty())
|
||||
@ -146,7 +146,7 @@ void PDFCreatePCElementRectangleTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
|
||||
@ -240,7 +240,7 @@ void PDFCreatePCElementLineTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
|
||||
@ -337,7 +337,7 @@ void PDFCreatePCElementImageTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
|
||||
@ -484,7 +484,7 @@ void PDFCreatePCElementDotTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
|
||||
@ -545,7 +545,7 @@ void PDFCreatePCElementFreehandCurveTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
|
||||
@ -689,7 +689,7 @@ void PDFCreatePCElementTextTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
virtual void setTextAngle(pdf::PDFReal angle);
|
||||
|
||||
protected:
|
||||
static QRectF getRectangleFromPickTool(PDFPickTool* pickTool, const QMatrix& pagePointToDevicePointMatrix);
|
||||
static QRectF getRectangleFromPickTool(PDFPickTool* pickTool, const QTransform& pagePointToDevicePointMatrix);
|
||||
|
||||
PDFPageContentScene* m_scene;
|
||||
};
|
||||
@ -77,7 +77,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual const PDFPageContentElement* getElement() const override;
|
||||
@ -111,7 +111,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual const PDFPageContentElement* getElement() const override;
|
||||
@ -151,7 +151,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual const PDFPageContentElement* getElement() const override;
|
||||
@ -185,7 +185,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual const PDFPageContentElement* getElement() const override;
|
||||
@ -217,7 +217,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual const PDFPageContentElement* getElement() const override;
|
||||
@ -255,7 +255,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual const PDFPageContentElement* getElement() const override;
|
||||
|
@ -269,7 +269,7 @@ void PDFPageContentElementRectangle::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -641,7 +641,7 @@ int PDFPageContentScene::getInputPriority() const
|
||||
void PDFPageContentScene::drawElements(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
@ -660,7 +660,7 @@ void PDFPageContentScene::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
if (!m_isActive)
|
||||
@ -952,7 +952,7 @@ void PDFPageContentElementLine::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -1134,7 +1134,7 @@ void PDFPageContentImageElement::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -1261,7 +1261,7 @@ void PDFPageContentElementDot::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -1349,7 +1349,7 @@ void PDFPageContentElementFreehandCurve::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -2264,7 +2264,7 @@ void PDFPageContentElementManipulator::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
// Draw selection
|
||||
@ -2374,7 +2374,7 @@ void PDFPageContentElementTextBox::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -2416,7 +2416,7 @@ void PDFPageContentElementTextBox::drawPage(QPainter* painter,
|
||||
{
|
||||
QRectF textBoundingRect = painter->boundingRect(textRect, getText(), option);
|
||||
|
||||
QMatrix matrix;
|
||||
QTransform matrix;
|
||||
matrix.rotate(getAngle());
|
||||
QRectF mappedTextBoundingRect = matrix.mapRect(textBoundingRect);
|
||||
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const = 0;
|
||||
|
||||
/// Returns manipulation mode. If manipulation mode is zero, then element
|
||||
@ -151,7 +151,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual uint getManipulationMode(const QPointF& point,
|
||||
@ -185,7 +185,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual uint getManipulationMode(const QPointF& point,
|
||||
@ -218,7 +218,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual uint getManipulationMode(const QPointF& point,
|
||||
@ -247,7 +247,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual uint getManipulationMode(const QPointF& point,
|
||||
@ -282,7 +282,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual uint getManipulationMode(const QPointF& point,
|
||||
@ -320,7 +320,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual uint getManipulationMode(const QPointF& point,
|
||||
@ -439,7 +439,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const;
|
||||
|
||||
/// Returns bounding box of whole selection
|
||||
@ -541,7 +541,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
PDFWidget* widget() const;
|
||||
@ -550,7 +550,7 @@ public:
|
||||
void drawElements(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
QList<PDFRenderError>& errors) const;
|
||||
|
||||
|
@ -225,7 +225,7 @@ PDFPageContentProcessor::PDFPageContentProcessor(const PDFPage* page,
|
||||
const PDFFontCache* fontCache,
|
||||
const PDFCMS* CMS,
|
||||
const PDFOptionalContentActivity* optionalContentActivity,
|
||||
QMatrix pagePointToDevicePointMatrix,
|
||||
QTransform pagePointToDevicePointMatrix,
|
||||
const PDFMeshQualitySettings& meshQualitySettings) :
|
||||
m_page(page),
|
||||
m_document(document),
|
||||
@ -729,7 +729,7 @@ void PDFPageContentProcessor::processContentStream(const PDFStream* stream)
|
||||
}
|
||||
}
|
||||
|
||||
void PDFPageContentProcessor::processForm(const QMatrix& matrix,
|
||||
void PDFPageContentProcessor::processForm(const QTransform& matrix,
|
||||
const QRectF& boundingBox,
|
||||
const PDFObject& resources,
|
||||
const PDFObject& transparencyGroup,
|
||||
@ -764,11 +764,11 @@ void PDFPageContentProcessor::processForm(const QMatrix& matrix,
|
||||
m_graphicState.setSoftMask(nullptr);
|
||||
}
|
||||
|
||||
QMatrix formMatrix = matrix * m_graphicState.getCurrentTransformationMatrix();
|
||||
QTransform formMatrix = matrix * m_graphicState.getCurrentTransformationMatrix();
|
||||
m_graphicState.setCurrentTransformationMatrix(formMatrix);
|
||||
updateGraphicState();
|
||||
|
||||
QMatrix patternMatrix = formMatrix * m_pagePointToDevicePointMatrix;
|
||||
QTransform patternMatrix = formMatrix * m_pagePointToDevicePointMatrix;
|
||||
PDFTemporaryValueChange patternMatrixGuard(&m_patternBaseMatrix, patternMatrix);
|
||||
|
||||
// If the clipping box is valid, then use clipping. Clipping box is in the form coordinate system
|
||||
@ -1029,9 +1029,9 @@ void PDFPageContentProcessor::processTillingPatternPainting(const PDFTilingPatte
|
||||
Q_ASSERT(m_pagePointToDevicePointMatrix.isInvertible());
|
||||
|
||||
// Initialize rendering matrix
|
||||
QMatrix patternMatrix = tilingPattern->getMatrix() * getPatternBaseMatrix();
|
||||
QMatrix matrix = patternMatrix * m_pagePointToDevicePointMatrix.inverted();
|
||||
QMatrix pathTransformationMatrix = m_graphicState.getCurrentTransformationMatrix() * matrix.inverted();
|
||||
QTransform patternMatrix = tilingPattern->getMatrix() * getPatternBaseMatrix();
|
||||
QTransform matrix = patternMatrix * m_pagePointToDevicePointMatrix.inverted();
|
||||
QTransform pathTransformationMatrix = m_graphicState.getCurrentTransformationMatrix() * matrix.inverted();
|
||||
m_graphicState.setCurrentTransformationMatrix(matrix);
|
||||
|
||||
int uncoloredTilingPatternFlag = 0;
|
||||
@ -1082,18 +1082,18 @@ void PDFPageContentProcessor::processTillingPatternPainting(const PDFTilingPatte
|
||||
const PDFInteger columns = qMax<PDFInteger>(qCeil(tilingArea.width() / xStep), 1);
|
||||
const PDFInteger rows = qMax<PDFInteger>(qCeil(tilingArea.height() / yStep), 1);
|
||||
|
||||
QMatrix baseTransformationMatrix = m_graphicState.getCurrentTransformationMatrix();
|
||||
QTransform baseTransformationMatrix = m_graphicState.getCurrentTransformationMatrix();
|
||||
for (PDFInteger column = 0; column < columns; ++column)
|
||||
{
|
||||
for (PDFInteger row = 0; row < rows; ++row)
|
||||
{
|
||||
PDFPageContentProcessorGraphicStateSaveRestoreGuard guard3(this);
|
||||
|
||||
QMatrix transformationMatrix = baseTransformationMatrix;
|
||||
QTransform transformationMatrix = baseTransformationMatrix;
|
||||
transformationMatrix.translate(tilingArea.left(), tilingArea.top());
|
||||
transformationMatrix.translate(column * xStep, row * yStep);
|
||||
|
||||
QMatrix currentPatternMatrix = transformationMatrix * m_pagePointToDevicePointMatrix;
|
||||
QTransform currentPatternMatrix = transformationMatrix * m_pagePointToDevicePointMatrix;
|
||||
PDFTemporaryValueChange patternMatrixGuard(&m_patternBaseMatrix, currentPatternMatrix);
|
||||
|
||||
m_graphicState.setCurrentTransformationMatrix(transformationMatrix);
|
||||
@ -1630,7 +1630,7 @@ void PDFPageContentProcessor::operatorSetLineWidth(PDFReal lineWidth)
|
||||
|
||||
Qt::PenCapStyle PDFPageContentProcessor::convertLineCapToPenCapStyle(PDFInteger lineCap)
|
||||
{
|
||||
lineCap = qBound<PDFInteger>(0, lineCap, 2);
|
||||
lineCap = qBound<PDFInteger>(PDFInteger(0), lineCap, PDFInteger(2));
|
||||
|
||||
Qt::PenCapStyle penCapStyle = Qt::FlatCap;
|
||||
switch (lineCap)
|
||||
@ -1693,7 +1693,7 @@ void PDFPageContentProcessor::operatorSetLineCap(PDFInteger lineCap)
|
||||
|
||||
Qt::PenJoinStyle PDFPageContentProcessor::convertLineJoinToPenJoinStyle(PDFInteger lineJoin)
|
||||
{
|
||||
lineJoin = qBound<PDFInteger>(0, lineJoin, 2);
|
||||
lineJoin = qBound<PDFInteger>(PDFInteger(0), lineJoin, PDFInteger(2));
|
||||
|
||||
Qt::PenJoinStyle penJoinStyle = Qt::MiterJoin;
|
||||
switch (lineJoin)
|
||||
@ -2079,7 +2079,7 @@ void PDFPageContentProcessor::operatorAdjustCurrentTransformationMatrix(PDFReal
|
||||
// [ a, b, 0 ]
|
||||
// [x', y', 1] = [ x, y, 1] * [ c, d, 0 ]
|
||||
// [ e, f, 1 ]
|
||||
// If we transpose this equation (we want this, because Qt uses transposed matrices (QMatrix).
|
||||
// If we transpose this equation (we want this, because Qt uses transposed matrices (QTransform).
|
||||
// So, we will get following result:
|
||||
//
|
||||
// [ x' ] [ a, c, e] [ x ]
|
||||
@ -2093,8 +2093,8 @@ void PDFPageContentProcessor::operatorAdjustCurrentTransformationMatrix(PDFReal
|
||||
// We must also check, that matrix is invertible. If it is not, then we will throw exception
|
||||
// to avoid errors later (for some operations, we assume matrix is invertible).
|
||||
|
||||
QMatrix matrix(a, b, c, d, e, f);
|
||||
QMatrix transformMatrix = matrix * m_graphicState.getCurrentTransformationMatrix();
|
||||
QTransform matrix(a, b, c, d, e, f);
|
||||
QTransform transformMatrix = matrix * m_graphicState.getCurrentTransformationMatrix();
|
||||
|
||||
if (!transformMatrix.isInvertible())
|
||||
{
|
||||
@ -2645,8 +2645,8 @@ void PDFPageContentProcessor::operatorColorSetDeviceCMYKFilling(PDFReal c, PDFRe
|
||||
void PDFPageContentProcessor::operatorTextBegin()
|
||||
{
|
||||
performTextBegin(ProcessOrder::BeforeOperation);
|
||||
m_graphicState.setTextMatrix(QMatrix());
|
||||
m_graphicState.setTextLineMatrix(QMatrix());
|
||||
m_graphicState.setTextMatrix(QTransform());
|
||||
m_graphicState.setTextLineMatrix(QTransform());
|
||||
updateGraphicState();
|
||||
|
||||
++m_textBeginEndState;
|
||||
@ -2738,7 +2738,7 @@ void PDFPageContentProcessor::operatorTextSetFontAndFontSize(PDFOperandName font
|
||||
|
||||
void PDFPageContentProcessor::operatorTextSetRenderMode(PDFInteger mode)
|
||||
{
|
||||
mode = qBound<PDFInteger>(0, mode, 7);
|
||||
mode = qBound<PDFInteger>(PDFInteger(0), mode, PDFInteger(7));
|
||||
m_graphicState.setTextRenderingMode(static_cast<TextRenderingMode>(mode));
|
||||
updateGraphicState();
|
||||
}
|
||||
@ -2751,8 +2751,8 @@ void PDFPageContentProcessor::operatorTextSetRise(PDFReal rise)
|
||||
|
||||
void PDFPageContentProcessor::operatorTextMoveByOffset(PDFReal t_x, PDFReal t_y)
|
||||
{
|
||||
const QMatrix& textLineMatrix = m_graphicState.getTextLineMatrix();
|
||||
QMatrix transformedMatrix = QMatrix(1, 0, 0, 1, t_x, t_y) * textLineMatrix;
|
||||
const QTransform& textLineMatrix = m_graphicState.getTextLineMatrix();
|
||||
QTransform transformedMatrix = QTransform(1, 0, 0, 1, t_x, t_y) * textLineMatrix;
|
||||
|
||||
m_graphicState.setTextMatrix(transformedMatrix);
|
||||
m_graphicState.setTextLineMatrix(transformedMatrix);
|
||||
@ -2773,7 +2773,7 @@ void PDFPageContentProcessor::operatorTextSetMatrix(PDFReal a, PDFReal b, PDFRea
|
||||
// [ a, b, 0 ]
|
||||
// [x', y', 1] = [ x, y, 1] * [ c, d, 0 ]
|
||||
// [ e, f, 1 ]
|
||||
// If we transpose this equation (we want this, because Qt uses transposed matrices (QMatrix).
|
||||
// If we transpose this equation (we want this, because Qt uses transposed matrices (QTransform).
|
||||
// So, we will get following result:
|
||||
//
|
||||
// [ x' ] [ a, c, e] [ x ]
|
||||
@ -2787,7 +2787,7 @@ void PDFPageContentProcessor::operatorTextSetMatrix(PDFReal a, PDFReal b, PDFRea
|
||||
// We must also check, that matrix is invertible. If it is not, then we will throw exception
|
||||
// to avoid errors later (for some operations, we assume matrix is invertible).
|
||||
|
||||
QMatrix matrix(a, b, c, d, e, f);
|
||||
QTransform matrix(a, b, c, d, e, f);
|
||||
|
||||
m_graphicState.setTextMatrix(matrix);
|
||||
m_graphicState.setTextLineMatrix(matrix);
|
||||
@ -2914,7 +2914,7 @@ void PDFPageContentProcessor::operatorShadingPaintShape(PDFPageContentProcessor:
|
||||
return;
|
||||
}
|
||||
|
||||
QMatrix matrix = getCurrentWorldMatrix();
|
||||
QTransform matrix = getCurrentWorldMatrix();
|
||||
PDFPageContentProcessorStateGuard guard(this);
|
||||
PDFTemporaryValueChange guard2(&m_patternBaseMatrix, matrix);
|
||||
|
||||
@ -2923,7 +2923,7 @@ void PDFPageContentProcessor::operatorShadingPaintShape(PDFPageContentProcessor:
|
||||
throw PDFRendererException(RenderErrorType::Error, PDFTranslationContext::tr("Shading '%1' not found.").arg(QString::fromLatin1(name.name)));
|
||||
}
|
||||
|
||||
PDFPatternPtr pattern = PDFPattern::createShadingPattern(m_colorSpaceDictionary, m_document, m_shadingDictionary->get(name.name), QMatrix(), PDFObject(), m_CMS, m_graphicState.getRenderingIntent(), this, true);
|
||||
PDFPatternPtr pattern = PDFPattern::createShadingPattern(m_colorSpaceDictionary, m_document, m_shadingDictionary->get(name.name), QTransform(), PDFObject(), m_CMS, m_graphicState.getRenderingIntent(), this, true);
|
||||
|
||||
// We will do a trick: we will set current fill color space, and then paint
|
||||
// bounding rectangle in the color pattern.
|
||||
@ -2931,7 +2931,7 @@ void PDFPageContentProcessor::operatorShadingPaintShape(PDFPageContentProcessor:
|
||||
updateGraphicState();
|
||||
|
||||
Q_ASSERT(matrix.isInvertible());
|
||||
QMatrix inverted = matrix.inverted();
|
||||
QTransform inverted = matrix.inverted();
|
||||
|
||||
QPainterPath deviceBoundingRectPath;
|
||||
deviceBoundingRectPath.addRect(m_pageBoundingRectDeviceSpace);
|
||||
@ -3007,7 +3007,7 @@ void PDFPageContentProcessor::processForm(const PDFStream* stream)
|
||||
QRectF boundingBox = loader.readRectangle(streamDictionary->get("BBox"), QRectF());
|
||||
|
||||
// Read the transformation matrix, if it is present
|
||||
QMatrix transformationMatrix = loader.readMatrixFromDictionary(streamDictionary, "Matrix", QMatrix());
|
||||
QTransform transformationMatrix = loader.readMatrixFromDictionary(streamDictionary, "Matrix", QTransform());
|
||||
|
||||
// Read the dictionary content
|
||||
QByteArray content = m_document->getDecodedStream(stream);
|
||||
@ -3176,8 +3176,8 @@ void PDFPageContentProcessor::drawText(const TextSequence& textSequence)
|
||||
const bool isHorizontalWritingSystem = font->isHorizontalWritingSystem();
|
||||
|
||||
// Calculate text rendering matrix
|
||||
QMatrix adjustMatrix(horizontalScaling, 0.0, 0.0, 1.0, 0.0, textRise);
|
||||
QMatrix textMatrix = m_graphicState.getTextMatrix();
|
||||
QTransform adjustMatrix(horizontalScaling, 0.0, 0.0, 1.0, 0.0, textRise);
|
||||
QTransform textMatrix = m_graphicState.getTextMatrix();
|
||||
|
||||
if (!isType3Font)
|
||||
{
|
||||
@ -3208,8 +3208,8 @@ void PDFPageContentProcessor::drawText(const TextSequence& textSequence)
|
||||
{
|
||||
const QPainterPath& glyphPath = *item.glyph;
|
||||
|
||||
QMatrix textRenderingMatrix = adjustMatrix * textMatrix;
|
||||
QMatrix toDeviceSpaceTransform = textRenderingMatrix * m_graphicState.getCurrentTransformationMatrix();
|
||||
QTransform textRenderingMatrix = adjustMatrix * textMatrix;
|
||||
QTransform toDeviceSpaceTransform = textRenderingMatrix * m_graphicState.getCurrentTransformationMatrix();
|
||||
|
||||
if (!glyphPath.isEmpty())
|
||||
{
|
||||
@ -3262,7 +3262,7 @@ void PDFPageContentProcessor::drawText(const TextSequence& textSequence)
|
||||
Q_ASSERT(dynamic_cast<const PDFType3Font*>(m_graphicState.getTextFont().get()));
|
||||
const PDFType3Font* parentFont = static_cast<const PDFType3Font*>(m_graphicState.getTextFont().get());
|
||||
|
||||
QMatrix fontMatrix = parentFont->getFontMatrix();
|
||||
QTransform fontMatrix = parentFont->getFontMatrix();
|
||||
if (!fontMatrix.isInvertible())
|
||||
{
|
||||
throw PDFRendererException(RenderErrorType::Error, PDFTranslationContext::tr("Type 3 font matrix is not invertible."));
|
||||
@ -3276,9 +3276,9 @@ void PDFPageContentProcessor::drawText(const TextSequence& textSequence)
|
||||
initDictionaries(resources);
|
||||
}
|
||||
|
||||
QMatrix scaleMatrix(fontSize, 0.0, 0.0, fontSize, 0.0, 0.0);
|
||||
QTransform scaleMatrix(fontSize, 0.0, 0.0, fontSize, 0.0, 0.0);
|
||||
adjustMatrix = scaleMatrix * adjustMatrix;
|
||||
QMatrix fontAdjustedMatrix = fontMatrix * adjustMatrix;
|
||||
QTransform fontAdjustedMatrix = fontMatrix * adjustMatrix;
|
||||
|
||||
for (const TextSequenceItem& item : textSequence.items)
|
||||
{
|
||||
@ -3298,7 +3298,7 @@ void PDFPageContentProcessor::drawText(const TextSequence& textSequence)
|
||||
// We must clear operands, because we are processing a new content stream
|
||||
m_operands.clear();
|
||||
|
||||
QMatrix worldMatrix = fontAdjustedMatrix * textMatrix * m_graphicState.getCurrentTransformationMatrix();
|
||||
QTransform worldMatrix = fontAdjustedMatrix * textMatrix * m_graphicState.getCurrentTransformationMatrix();
|
||||
m_graphicState.setCurrentTransformationMatrix(worldMatrix);
|
||||
updateGraphicState();
|
||||
|
||||
@ -3492,7 +3492,7 @@ PDFPageContentProcessor::PDFPageContentProcessorState& PDFPageContentProcessor::
|
||||
return *this;
|
||||
}
|
||||
|
||||
void PDFPageContentProcessor::PDFPageContentProcessorState::setCurrentTransformationMatrix(const QMatrix& currentTransformationMatrix)
|
||||
void PDFPageContentProcessor::PDFPageContentProcessorState::setCurrentTransformationMatrix(const QTransform& currentTransformationMatrix)
|
||||
{
|
||||
if (m_currentTransformationMatrix != currentTransformationMatrix)
|
||||
{
|
||||
@ -3638,7 +3638,7 @@ void PDFPageContentProcessor::PDFPageContentProcessorState::setTextKnockout(bool
|
||||
}
|
||||
}
|
||||
|
||||
void PDFPageContentProcessor::PDFPageContentProcessorState::setTextLineMatrix(const QMatrix& textLineMatrix)
|
||||
void PDFPageContentProcessor::PDFPageContentProcessorState::setTextLineMatrix(const QTransform& textLineMatrix)
|
||||
{
|
||||
if (m_textLineMatrix != textLineMatrix)
|
||||
{
|
||||
@ -3827,7 +3827,7 @@ void PDFPageContentProcessor::PDFPageContentProcessorState::setBlackGenerationFu
|
||||
}
|
||||
}
|
||||
|
||||
void PDFPageContentProcessor::PDFPageContentProcessorState::setTextMatrix(const QMatrix& textMatrix)
|
||||
void PDFPageContentProcessor::PDFPageContentProcessorState::setTextMatrix(const QTransform& textMatrix)
|
||||
{
|
||||
if (m_textMatrix != textMatrix)
|
||||
{
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "pdftextlayout.h"
|
||||
#include "pdfoperationcontrol.h"
|
||||
|
||||
#include <QMatrix>
|
||||
#include <QTransform>
|
||||
#include <QPainterPath>
|
||||
#include <QSharedPointer>
|
||||
|
||||
@ -82,7 +82,7 @@ public:
|
||||
const PDFFontCache* fontCache,
|
||||
const PDFCMS* CMS,
|
||||
const PDFOptionalContentActivity* optionalContentActivity,
|
||||
QMatrix pagePointToDevicePointMatrix,
|
||||
QTransform pagePointToDevicePointMatrix,
|
||||
const PDFMeshQualitySettings& meshQualitySettings);
|
||||
virtual ~PDFPageContentProcessor();
|
||||
|
||||
@ -223,7 +223,7 @@ public:
|
||||
/// \param transparencyGroup Transparency group object
|
||||
/// \param content Content stream of the form
|
||||
/// \param formStructuralParent Structural parent key for form
|
||||
void processForm(const QMatrix& matrix,
|
||||
void processForm(const QTransform& matrix,
|
||||
const QRectF& boundingBox,
|
||||
const PDFObject& resources,
|
||||
const PDFObject& transparencyGroup,
|
||||
@ -366,8 +366,8 @@ protected:
|
||||
|
||||
using StateFlags = PDFFlags<StateFlag>;
|
||||
|
||||
const QMatrix& getCurrentTransformationMatrix() const { return m_currentTransformationMatrix; }
|
||||
void setCurrentTransformationMatrix(const QMatrix& currentTransformationMatrix);
|
||||
const QTransform& getCurrentTransformationMatrix() const { return m_currentTransformationMatrix; }
|
||||
void setCurrentTransformationMatrix(const QTransform& currentTransformationMatrix);
|
||||
|
||||
const PDFAbstractColorSpace* getStrokeColorSpace() const { return m_strokeColorSpace.data(); }
|
||||
void setStrokeColorSpace(const QSharedPointer<PDFAbstractColorSpace>& strokeColorSpace);
|
||||
@ -437,11 +437,11 @@ protected:
|
||||
bool getTextKnockout() const { return m_textKnockout; }
|
||||
void setTextKnockout(bool textKnockout);
|
||||
|
||||
const QMatrix& getTextMatrix() const { return m_textMatrix; }
|
||||
void setTextMatrix(const QMatrix& textMatrix);
|
||||
const QTransform& getTextMatrix() const { return m_textMatrix; }
|
||||
void setTextMatrix(const QTransform& textMatrix);
|
||||
|
||||
const QMatrix& getTextLineMatrix() const { return m_textLineMatrix; }
|
||||
void setTextLineMatrix(const QMatrix& textLineMatrix);
|
||||
const QTransform& getTextLineMatrix() const { return m_textLineMatrix; }
|
||||
void setTextLineMatrix(const QTransform& textLineMatrix);
|
||||
|
||||
PDFReal getAlphaStroking() const { return m_alphaStroking; }
|
||||
void setAlphaStroking(PDFReal alpha);
|
||||
@ -492,7 +492,7 @@ protected:
|
||||
void setHalftoneOrigin(const QPointF& halftoneOrigin);
|
||||
|
||||
private:
|
||||
QMatrix m_currentTransformationMatrix;
|
||||
QTransform m_currentTransformationMatrix;
|
||||
PDFColorSpacePointer m_strokeColorSpace;
|
||||
PDFColorSpacePointer m_fillColorSpace;
|
||||
QColor m_strokeColor;
|
||||
@ -516,8 +516,8 @@ protected:
|
||||
TextRenderingMode m_textRenderingMode; // Text rendering mode
|
||||
PDFReal m_textRise; // T_rise
|
||||
bool m_textKnockout;
|
||||
QMatrix m_textMatrix;
|
||||
QMatrix m_textLineMatrix;
|
||||
QTransform m_textMatrix;
|
||||
QTransform m_textLineMatrix;
|
||||
PDFReal m_alphaStroking;
|
||||
PDFReal m_alphaFilling;
|
||||
BlendMode m_blendMode;
|
||||
@ -670,13 +670,13 @@ protected:
|
||||
bool isContentSuppressed() const;
|
||||
|
||||
/// Returns page point to device point matrix
|
||||
const QMatrix& getPagePointToDevicePointMatrix() const { return m_pagePointToDevicePointMatrix; }
|
||||
const QTransform& getPagePointToDevicePointMatrix() const { return m_pagePointToDevicePointMatrix; }
|
||||
|
||||
/// Returns base matrix for patterns
|
||||
const QMatrix& getPatternBaseMatrix() const { return m_patternBaseMatrix; }
|
||||
const QTransform& getPatternBaseMatrix() const { return m_patternBaseMatrix; }
|
||||
|
||||
/// Returns current world matrix (translating actual point to the device point)
|
||||
QMatrix getCurrentWorldMatrix() const { return getGraphicState()->getCurrentTransformationMatrix() * m_pagePointToDevicePointMatrix; }
|
||||
QTransform getCurrentWorldMatrix() const { return getGraphicState()->getCurrentTransformationMatrix() * m_pagePointToDevicePointMatrix; }
|
||||
|
||||
/// Returns page bounding rectangle in device space
|
||||
const QRectF& getPageBoundingRectDeviceSpace() const { return m_pageBoundingRectDeviceSpace; }
|
||||
@ -1071,10 +1071,10 @@ private:
|
||||
|
||||
/// Base matrix to be used when drawing patterns. Concatenate this matrix
|
||||
/// with pattern matrix to get transformation from pattern space to device space.
|
||||
QMatrix m_patternBaseMatrix;
|
||||
QTransform m_patternBaseMatrix;
|
||||
|
||||
/// Matrix mapping page points to the device points
|
||||
QMatrix m_pagePointToDevicePointMatrix;
|
||||
QTransform m_pagePointToDevicePointMatrix;
|
||||
|
||||
/// Bounding rectangle of pages media box in device space coordinates. If drawing rotation
|
||||
/// is zero, then it corresponds to the scaled media box of the page.
|
||||
|
@ -32,7 +32,7 @@ PDFPainterBase::PDFPainterBase(PDFRenderer::Features features,
|
||||
const PDFFontCache* fontCache,
|
||||
const PDFCMS* cms,
|
||||
const PDFOptionalContentActivity* optionalContentActivity,
|
||||
QMatrix pagePointToDevicePointMatrix,
|
||||
QTransform pagePointToDevicePointMatrix,
|
||||
const PDFMeshQualitySettings& meshQualitySettings) :
|
||||
BaseClass(page, document, fontCache, cms, optionalContentActivity, pagePointToDevicePointMatrix, meshQualitySettings),
|
||||
m_features(features)
|
||||
@ -240,7 +240,7 @@ void PDFPainterBase::performEndTransparencyGroup(ProcessOrder order, const PDFTr
|
||||
|
||||
PDFPainter::PDFPainter(QPainter* painter,
|
||||
PDFRenderer::Features features,
|
||||
QMatrix pagePointToDevicePointMatrix,
|
||||
QTransform pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
const PDFDocument* document,
|
||||
const PDFFontCache* fontCache,
|
||||
@ -389,7 +389,7 @@ void PDFPainter::performRestoreGraphicState(ProcessOrder order)
|
||||
}
|
||||
}
|
||||
|
||||
void PDFPainter::setWorldMatrix(const QMatrix& matrix)
|
||||
void PDFPainter::setWorldMatrix(const QTransform& matrix)
|
||||
{
|
||||
m_painter->setWorldTransform(QTransform(matrix), false);
|
||||
}
|
||||
@ -407,7 +407,7 @@ PDFPrecompiledPageGenerator::PDFPrecompiledPageGenerator(PDFPrecompiledPage* pre
|
||||
const PDFCMS* cms,
|
||||
const PDFOptionalContentActivity* optionalContentActivity,
|
||||
const PDFMeshQualitySettings& meshQualitySettings) :
|
||||
BaseClass(features, page, document, fontCache, cms, optionalContentActivity, QMatrix(), meshQualitySettings),
|
||||
BaseClass(features, page, document, fontCache, cms, optionalContentActivity, QTransform(), meshQualitySettings),
|
||||
m_precompiledPage(precompiledPage)
|
||||
{
|
||||
m_precompiledPage->setPaperColor(cms->getPaperColor());
|
||||
@ -439,7 +439,7 @@ void PDFPrecompiledPageGenerator::performImagePainting(const QImage& image)
|
||||
}
|
||||
|
||||
// Add snap info for image to the snapper
|
||||
QMatrix matrix = getCurrentWorldMatrix();
|
||||
QTransform matrix = getCurrentWorldMatrix();
|
||||
PDFSnapInfo* snapInfo = m_precompiledPage->getSnapInfo();
|
||||
snapInfo->addImage({
|
||||
matrix.map(QPointF(0.0, 0.0)),
|
||||
@ -494,7 +494,7 @@ void PDFPrecompiledPageGenerator::performRestoreGraphicState(PDFPageContentProce
|
||||
}
|
||||
}
|
||||
|
||||
void PDFPrecompiledPageGenerator::setWorldMatrix(const QMatrix& matrix)
|
||||
void PDFPrecompiledPageGenerator::setWorldMatrix(const QTransform& matrix)
|
||||
{
|
||||
m_precompiledPage->addSetWorldMatrix(matrix);
|
||||
}
|
||||
@ -506,7 +506,7 @@ void PDFPrecompiledPageGenerator::setCompositionMode(QPainter::CompositionMode m
|
||||
|
||||
void PDFPrecompiledPage::draw(QPainter* painter,
|
||||
const QRectF& cropBox,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
PDFRenderer::Features features,
|
||||
PDFReal opacity) const
|
||||
{
|
||||
@ -620,7 +620,7 @@ void PDFPrecompiledPage::draw(QPainter* painter,
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void PDFPrecompiledPage::redact(QPainterPath redactPath, const QMatrix& matrix, QColor color)
|
||||
void PDFPrecompiledPage::redact(QPainterPath redactPath, const QTransform& matrix, QColor color)
|
||||
{
|
||||
if (redactPath.isEmpty())
|
||||
{
|
||||
@ -628,7 +628,7 @@ void PDFPrecompiledPage::redact(QPainterPath redactPath, const QMatrix& matrix,
|
||||
return;
|
||||
}
|
||||
|
||||
std::stack<QMatrix> worldMatrixStack;
|
||||
std::stack<QTransform> worldMatrixStack;
|
||||
worldMatrixStack.push(matrix);
|
||||
|
||||
if (color.isValid())
|
||||
@ -643,7 +643,7 @@ void PDFPrecompiledPage::redact(QPainterPath redactPath, const QMatrix& matrix,
|
||||
{
|
||||
case InstructionType::DrawPath:
|
||||
{
|
||||
QMatrix currentMatrix = worldMatrixStack.top().inverted();
|
||||
QTransform currentMatrix = worldMatrixStack.top().inverted();
|
||||
QPainterPath mappedRedactPath = currentMatrix.map(redactPath);
|
||||
PathPaintData& path = m_paths[instruction.dataIndex];
|
||||
path.path = path.path.subtracted(mappedRedactPath);
|
||||
@ -676,7 +676,7 @@ void PDFPrecompiledPage::redact(QPainterPath redactPath, const QMatrix& matrix,
|
||||
|
||||
case InstructionType::Clip:
|
||||
{
|
||||
QMatrix currentMatrix = worldMatrixStack.top().inverted();
|
||||
QTransform currentMatrix = worldMatrixStack.top().inverted();
|
||||
QPainterPath mappedRedactPath = currentMatrix.map(redactPath);
|
||||
m_clips[instruction.dataIndex].clipPath = m_clips[instruction.dataIndex].clipPath.subtracted(mappedRedactPath);
|
||||
break;
|
||||
@ -743,7 +743,7 @@ void PDFPrecompiledPage::addMesh(PDFMesh mesh, PDFReal alpha)
|
||||
m_meshes.emplace_back(qMove(mesh), alpha);
|
||||
}
|
||||
|
||||
void PDFPrecompiledPage::addSetWorldMatrix(const QMatrix& matrix)
|
||||
void PDFPrecompiledPage::addSetWorldMatrix(const QTransform& matrix)
|
||||
{
|
||||
m_instructions.emplace_back(InstructionType::SetWorldMatrix, m_matrices.size());
|
||||
m_matrices.push_back(matrix);
|
||||
@ -810,7 +810,7 @@ void PDFPrecompiledPage::finalize(qint64 compilingTimeNS, QList<PDFRenderError>
|
||||
m_memoryConsumptionEstimate += sizeof(ClipData) * m_clips.capacity();
|
||||
m_memoryConsumptionEstimate += sizeof(ImageData) * m_images.capacity();
|
||||
m_memoryConsumptionEstimate += sizeof(MeshPaintData) * m_meshes.capacity();
|
||||
m_memoryConsumptionEstimate += sizeof(QMatrix) * m_matrices.capacity();
|
||||
m_memoryConsumptionEstimate += sizeof(QTransform) * m_matrices.capacity();
|
||||
m_memoryConsumptionEstimate += sizeof(QPainter::CompositionMode) * m_compositionModes.capacity();
|
||||
m_memoryConsumptionEstimate += sizeof(PDFRenderError) * m_errors.size();
|
||||
|
||||
@ -843,7 +843,7 @@ PDFPrecompiledPage::GraphicPieceInfos PDFPrecompiledPage::calculateGraphicPieceI
|
||||
|
||||
struct State
|
||||
{
|
||||
QMatrix matrix;
|
||||
QTransform matrix;
|
||||
};
|
||||
std::stack<State> stateStack;
|
||||
stateStack.emplace();
|
||||
@ -925,7 +925,7 @@ PDFPrecompiledPage::GraphicPieceInfos PDFPrecompiledPage::calculateGraphicPieceI
|
||||
QDataStream streamImage(&serializedImage, QIODevice::WriteOnly);
|
||||
|
||||
// Jakub Melka: serialize image position
|
||||
QMatrix worldMatrix = stateStack.top().matrix;
|
||||
QTransform worldMatrix = stateStack.top().matrix;
|
||||
|
||||
QPainterPath pagePath;
|
||||
pagePath.addRect(0, 0, 1, 1);
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
const PDFFontCache* fontCache,
|
||||
const PDFCMS* cms,
|
||||
const PDFOptionalContentActivity* optionalContentActivity,
|
||||
QMatrix pagePointToDevicePointMatrix,
|
||||
QTransform pagePointToDevicePointMatrix,
|
||||
const PDFMeshQualitySettings& meshQualitySettings);
|
||||
|
||||
virtual bool isContentSuppressedByOC(PDFObjectReference ocgOrOcmd) override;
|
||||
@ -54,7 +54,7 @@ protected:
|
||||
virtual void performUpdateGraphicsState(const PDFPageContentProcessorState& state) override;
|
||||
virtual void performBeginTransparencyGroup(ProcessOrder order, const PDFTransparencyGroup& transparencyGroup) override;
|
||||
virtual void performEndTransparencyGroup(ProcessOrder order, const PDFTransparencyGroup& transparencyGroup) override;
|
||||
virtual void setWorldMatrix(const QMatrix& matrix) = 0;
|
||||
virtual void setWorldMatrix(const QTransform& matrix) = 0;
|
||||
virtual void setCompositionMode(QPainter::CompositionMode mode) = 0;
|
||||
|
||||
/// Returns current pen
|
||||
@ -120,7 +120,7 @@ public:
|
||||
/// \param meshQualitySettings Mesh quality settings
|
||||
explicit PDFPainter(QPainter* painter,
|
||||
PDFRenderer::Features features,
|
||||
QMatrix pagePointToDevicePointMatrix,
|
||||
QTransform pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
const PDFDocument* document,
|
||||
const PDFFontCache* fontCache,
|
||||
@ -136,7 +136,7 @@ protected:
|
||||
virtual void performMeshPainting(const PDFMesh& mesh) override;
|
||||
virtual void performSaveGraphicState(ProcessOrder order) override;
|
||||
virtual void performRestoreGraphicState(ProcessOrder order) override;
|
||||
virtual void setWorldMatrix(const QMatrix& matrix) override;
|
||||
virtual void setWorldMatrix(const QTransform& matrix) override;
|
||||
virtual void setCompositionMode(QPainter::CompositionMode mode) override;
|
||||
|
||||
private:
|
||||
@ -191,7 +191,7 @@ public:
|
||||
/// \param opacity Opacity of page graphics
|
||||
void draw(QPainter* painter,
|
||||
const QRectF& cropBox,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
PDFRenderer::Features features,
|
||||
PDFReal opacity) const;
|
||||
|
||||
@ -199,7 +199,7 @@ public:
|
||||
/// and fill redact path with given color.
|
||||
/// \param redactPath Redaction path in page coordinates
|
||||
/// \param color Redaction color (if invalid, nothing is being drawn)
|
||||
void redact(QPainterPath redactPath, const QMatrix& matrix, QColor color);
|
||||
void redact(QPainterPath redactPath, const QTransform& matrix, QColor color);
|
||||
|
||||
void addPath(QPen pen, QBrush brush, QPainterPath path, bool isText);
|
||||
void addClip(QPainterPath path);
|
||||
@ -207,7 +207,7 @@ public:
|
||||
void addMesh(PDFMesh mesh, PDFReal alpha);
|
||||
void addSaveGraphicState() { m_instructions.emplace_back(InstructionType::SaveGraphicState, 0); }
|
||||
void addRestoreGraphicState() { m_instructions.emplace_back(InstructionType::RestoreGraphicState, 0); }
|
||||
void addSetWorldMatrix(const QMatrix& matrix);
|
||||
void addSetWorldMatrix(const QTransform& matrix);
|
||||
void addSetCompositionMode(QPainter::CompositionMode compositionMode);
|
||||
|
||||
/// Optimizes page memory allocation to contain less space
|
||||
@ -354,7 +354,7 @@ private:
|
||||
std::vector<ClipData> m_clips;
|
||||
std::vector<ImageData> m_images;
|
||||
std::vector<MeshPaintData> m_meshes;
|
||||
std::vector<QMatrix> m_matrices;
|
||||
std::vector<QTransform> m_matrices;
|
||||
std::vector<QPainter::CompositionMode> m_compositionModes;
|
||||
QList<PDFRenderError> m_errors;
|
||||
PDFSnapInfo m_snapInfo;
|
||||
@ -384,7 +384,7 @@ protected:
|
||||
virtual void performMeshPainting(const PDFMesh& mesh) override;
|
||||
virtual void performSaveGraphicState(ProcessOrder order) override;
|
||||
virtual void performRestoreGraphicState(ProcessOrder order) override;
|
||||
virtual void setWorldMatrix(const QMatrix& matrix) override;
|
||||
virtual void setWorldMatrix(const QTransform& matrix) override;
|
||||
virtual void setCompositionMode(QPainter::CompositionMode mode) override;
|
||||
|
||||
private:
|
||||
|
@ -41,17 +41,17 @@ const PDFAbstractColorSpace* PDFShadingPattern::getColorSpace() const
|
||||
return m_colorSpace.data();
|
||||
}
|
||||
|
||||
QMatrix PDFShadingPattern::getPatternSpaceToDeviceSpaceMatrix(const PDFMeshQualitySettings& settings) const
|
||||
QTransform PDFShadingPattern::getPatternSpaceToDeviceSpaceMatrix(const PDFMeshQualitySettings& settings) const
|
||||
{
|
||||
return m_matrix * settings.userSpaceToDeviceSpaceMatrix;
|
||||
}
|
||||
|
||||
QMatrix PDFShadingPattern::getPatternSpaceToDeviceSpaceMatrix(const QMatrix& userSpaceToDeviceSpaceMatrix) const
|
||||
QTransform PDFShadingPattern::getPatternSpaceToDeviceSpaceMatrix(const QTransform& userSpaceToDeviceSpaceMatrix) const
|
||||
{
|
||||
return m_matrix * userSpaceToDeviceSpaceMatrix;
|
||||
}
|
||||
|
||||
PDFShadingSampler* PDFShadingPattern::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
|
||||
PDFShadingSampler* PDFShadingPattern::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
|
||||
{
|
||||
Q_UNUSED(userSpaceToDeviceSpaceMatrix);
|
||||
|
||||
@ -100,7 +100,7 @@ PDFPatternPtr PDFPattern::createPattern(const PDFDictionary* colorSpaceDictionar
|
||||
const PDFReal xStep = loader.readNumberFromDictionary(patternDictionary, "XStep", 0.0);
|
||||
const PDFReal yStep = loader.readNumberFromDictionary(patternDictionary, "YStep", 0.0);
|
||||
PDFObject resources = document->getObject(patternDictionary->get("Resources"));
|
||||
QMatrix matrix = loader.readMatrixFromDictionary(patternDictionary, "Matrix", QMatrix());
|
||||
QTransform matrix = loader.readMatrixFromDictionary(patternDictionary, "Matrix", QTransform());
|
||||
|
||||
// Verify the data
|
||||
if (paintType != PDFTilingPattern::PaintType::Colored && paintType != PDFTilingPattern::PaintType::Uncolored)
|
||||
@ -136,7 +136,7 @@ PDFPatternPtr PDFPattern::createPattern(const PDFDictionary* colorSpaceDictionar
|
||||
case PatternType::Shading:
|
||||
{
|
||||
PDFObject patternGraphicState = document->getObject(patternDictionary->get("ExtGState"));
|
||||
QMatrix matrix = loader.readMatrixFromDictionary(patternDictionary, "Matrix", QMatrix());
|
||||
QTransform matrix = loader.readMatrixFromDictionary(patternDictionary, "Matrix", QTransform());
|
||||
return createShadingPattern(colorSpaceDictionary, document, patternDictionary->get("Shading"), matrix, patternGraphicState, cms, intent, reporter, false);
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ PDFPatternPtr PDFPattern::createPattern(const PDFDictionary* colorSpaceDictionar
|
||||
PDFPatternPtr PDFPattern::createShadingPattern(const PDFDictionary* colorSpaceDictionary,
|
||||
const PDFDocument* document,
|
||||
const PDFObject& shadingObject,
|
||||
const QMatrix& matrix,
|
||||
const QTransform& matrix,
|
||||
const PDFObject& patternGraphicState,
|
||||
const PDFCMS* cms,
|
||||
RenderingIntent intent,
|
||||
@ -252,7 +252,7 @@ PDFPatternPtr PDFPattern::createShadingPattern(const PDFDictionary* colorSpaceDi
|
||||
throw PDFException(PDFTranslationContext::tr("Invalid function shading pattern domain. Invalid domain ranges."));
|
||||
}
|
||||
|
||||
QMatrix domainToTargetTransform = loader.readMatrixFromDictionary(shadingDictionary, "Matrix", QMatrix());
|
||||
QTransform domainToTargetTransform = loader.readMatrixFromDictionary(shadingDictionary, "Matrix", QTransform());
|
||||
|
||||
size_t colorComponentCount = colorSpace->getColorComponentCount();
|
||||
if (functions.size() > 1 && colorComponentCount != functions.size())
|
||||
@ -505,13 +505,13 @@ PDFPatternPtr PDFPattern::createShadingPattern(const PDFDictionary* colorSpaceDi
|
||||
class PDFFunctionShadingSampler : public PDFShadingSampler
|
||||
{
|
||||
public:
|
||||
PDFFunctionShadingSampler(const PDFFunctionShading* functionShadingPattern, QMatrix userSpaceToDeviceSpaceMatrix) :
|
||||
PDFFunctionShadingSampler(const PDFFunctionShading* functionShadingPattern, QTransform userSpaceToDeviceSpaceMatrix) :
|
||||
PDFShadingSampler(functionShadingPattern),
|
||||
m_functionShadingPattern(functionShadingPattern),
|
||||
m_domain(functionShadingPattern->getDomain())
|
||||
{
|
||||
QMatrix patternSpaceToDeviceSpaceMatrix = functionShadingPattern->getMatrix() * userSpaceToDeviceSpaceMatrix;
|
||||
QMatrix domainToDeviceSpaceMatrix = functionShadingPattern->getDomainToTargetTransform() * patternSpaceToDeviceSpaceMatrix;
|
||||
QTransform patternSpaceToDeviceSpaceMatrix = functionShadingPattern->getMatrix() * userSpaceToDeviceSpaceMatrix;
|
||||
QTransform domainToDeviceSpaceMatrix = functionShadingPattern->getDomainToTargetTransform() * patternSpaceToDeviceSpaceMatrix;
|
||||
|
||||
if (domainToDeviceSpaceMatrix.isInvertible())
|
||||
{
|
||||
@ -519,7 +519,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceSpaceToDomainMatrix = QMatrix();
|
||||
m_deviceSpaceToDomainMatrix = QTransform();
|
||||
}
|
||||
}
|
||||
|
||||
@ -594,7 +594,7 @@ public:
|
||||
private:
|
||||
const PDFFunctionShading* m_functionShadingPattern;
|
||||
QRectF m_domain;
|
||||
QMatrix m_deviceSpaceToDomainMatrix;
|
||||
QTransform m_deviceSpaceToDomainMatrix;
|
||||
};
|
||||
|
||||
ShadingType PDFFunctionShading::getShadingType() const
|
||||
@ -612,13 +612,13 @@ PDFMesh PDFFunctionShading::createMesh(const PDFMeshQualitySettings& settings,
|
||||
|
||||
Q_UNUSED(operationControl);
|
||||
|
||||
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(settings);
|
||||
QMatrix domainToDeviceSpaceMatrix = m_domainToTargetTransform * patternSpaceToDeviceSpaceMatrix;
|
||||
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(settings);
|
||||
QTransform domainToDeviceSpaceMatrix = m_domainToTargetTransform * patternSpaceToDeviceSpaceMatrix;
|
||||
QLineF topLine(m_domain.topLeft(), m_domain.topRight());
|
||||
QLineF leftLine(m_domain.topLeft(), m_domain.bottomLeft());
|
||||
|
||||
Q_ASSERT(domainToDeviceSpaceMatrix.isInvertible());
|
||||
QMatrix deviceSpaceToDomainMatrix = domainToDeviceSpaceMatrix.inverted();
|
||||
QTransform deviceSpaceToDomainMatrix = domainToDeviceSpaceMatrix.inverted();
|
||||
|
||||
QLineF topLineDS = domainToDeviceSpaceMatrix.map(topLine);
|
||||
QLineF leftLineDS = domainToDeviceSpaceMatrix.map(leftLine);
|
||||
@ -911,7 +911,7 @@ PDFMesh PDFFunctionShading::createMesh(const PDFMeshQualitySettings& settings,
|
||||
return mesh;
|
||||
}
|
||||
|
||||
PDFShadingSampler* PDFFunctionShading::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
|
||||
PDFShadingSampler* PDFFunctionShading::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
|
||||
{
|
||||
return new PDFFunctionShadingSampler(this, userSpaceToDeviceSpaceMatrix);
|
||||
}
|
||||
@ -926,7 +926,7 @@ PDFMesh PDFAxialShading::createMesh(const PDFMeshQualitySettings& settings,
|
||||
|
||||
Q_UNUSED(operationControl);
|
||||
|
||||
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(settings);
|
||||
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(settings);
|
||||
QPointF p1 = patternSpaceToDeviceSpaceMatrix.map(m_startPoint);
|
||||
QPointF p2 = patternSpaceToDeviceSpaceMatrix.map(m_endPoint);
|
||||
|
||||
@ -939,10 +939,10 @@ PDFMesh PDFAxialShading::createMesh(const PDFMeshQualitySettings& settings,
|
||||
// Matrix p1p2LCS is local coordinate system of line p1-p2. It transforms
|
||||
// points on the line to the global coordinate system. So, point (0, 0) will
|
||||
// map onto p1 and point (length(p1-p2), 0) will map onto p2.
|
||||
QMatrix p1p2LCS;
|
||||
QTransform p1p2LCS;
|
||||
p1p2LCS.translate(p1.x(), p1.y());
|
||||
p1p2LCS.rotate(angle);
|
||||
QMatrix p1p2GCS = p1p2LCS.inverted();
|
||||
QTransform p1p2GCS = p1p2LCS.inverted();
|
||||
|
||||
QPointF p1m = p1p2GCS.map(p1);
|
||||
QPointF p2m = p1p2GCS.map(p2);
|
||||
@ -1150,7 +1150,7 @@ PDFMesh PDFAxialShading::createMesh(const PDFMeshQualitySettings& settings,
|
||||
class PDFAxialShadingSampler : public PDFShadingSampler
|
||||
{
|
||||
public:
|
||||
PDFAxialShadingSampler(const PDFAxialShading* axialShadingPattern, QMatrix userSpaceToDeviceSpaceMatrix) :
|
||||
PDFAxialShadingSampler(const PDFAxialShading* axialShadingPattern, QTransform userSpaceToDeviceSpaceMatrix) :
|
||||
PDFShadingSampler(axialShadingPattern),
|
||||
m_axialShadingPattern(axialShadingPattern),
|
||||
m_xStart(0.0),
|
||||
@ -1160,7 +1160,7 @@ public:
|
||||
m_tMin(0.0),
|
||||
m_tMax(0.0)
|
||||
{
|
||||
QMatrix patternSpaceToDeviceSpace = axialShadingPattern->getMatrix() * userSpaceToDeviceSpaceMatrix;
|
||||
QTransform patternSpaceToDeviceSpace = axialShadingPattern->getMatrix() * userSpaceToDeviceSpaceMatrix;
|
||||
|
||||
QPointF p1 = patternSpaceToDeviceSpace.map(axialShadingPattern->getStartPoint());
|
||||
QPointF p2 = patternSpaceToDeviceSpace.map(axialShadingPattern->getEndPoint());
|
||||
@ -1174,10 +1174,10 @@ public:
|
||||
// Matrix p1p2LCS is local coordinate system of line p1-p2. It transforms
|
||||
// points on the line to the global coordinate system. So, point (0, 0) will
|
||||
// map onto p1 and point (length(p1-p2), 0) will map onto p2.
|
||||
QMatrix p1p2LCS;
|
||||
QTransform p1p2LCS;
|
||||
p1p2LCS.translate(p1.x(), p1.y());
|
||||
p1p2LCS.rotate(angle);
|
||||
QMatrix p1p2GCS = p1p2LCS.inverted();
|
||||
QTransform p1p2GCS = p1p2LCS.inverted();
|
||||
|
||||
QPointF p1m = p1p2GCS.map(p1);
|
||||
QPointF p2m = p1p2GCS.map(p2);
|
||||
@ -1297,7 +1297,7 @@ public:
|
||||
|
||||
private:
|
||||
const PDFAxialShading* m_axialShadingPattern;
|
||||
QMatrix m_p1p2GCS;
|
||||
QTransform m_p1p2GCS;
|
||||
PDFReal m_xStart;
|
||||
PDFReal m_xEnd;
|
||||
PDFReal m_tAtStart;
|
||||
@ -1306,7 +1306,7 @@ private:
|
||||
PDFReal m_tMax;
|
||||
};
|
||||
|
||||
PDFShadingSampler* PDFAxialShading::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
|
||||
PDFShadingSampler* PDFAxialShading::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
|
||||
{
|
||||
return new PDFAxialShadingSampler(this, userSpaceToDeviceSpaceMatrix);
|
||||
}
|
||||
@ -1357,7 +1357,7 @@ void PDFMesh::paint(QPainter* painter, PDFReal alpha) const
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void PDFMesh::transform(const QMatrix& matrix)
|
||||
void PDFMesh::transform(const QTransform& matrix)
|
||||
{
|
||||
for (QPointF& vertex : m_vertices)
|
||||
{
|
||||
@ -1439,7 +1439,7 @@ PDFMesh PDFRadialShading::createMesh(const PDFMeshQualitySettings& settings,
|
||||
|
||||
Q_UNUSED(operationControl);
|
||||
|
||||
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(settings);
|
||||
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(settings);
|
||||
QPointF p1 = patternSpaceToDeviceSpaceMatrix.map(m_startPoint);
|
||||
QPointF p2 = patternSpaceToDeviceSpaceMatrix.map(m_endPoint);
|
||||
|
||||
@ -1458,10 +1458,10 @@ PDFMesh PDFRadialShading::createMesh(const PDFMeshQualitySettings& settings,
|
||||
// Matrix p1p2LCS is local coordinate system of line p1-p2. It transforms
|
||||
// points on the line to the global coordinate system. So, point (0, 0) will
|
||||
// map onto p1 and point (length(p1-p2), 0) will map onto p2.
|
||||
QMatrix p1p2LCS;
|
||||
QTransform p1p2LCS;
|
||||
p1p2LCS.translate(p1.x(), p1.y());
|
||||
p1p2LCS.rotate(angle);
|
||||
QMatrix p1p2GCS = p1p2LCS.inverted();
|
||||
QTransform p1p2GCS = p1p2LCS.inverted();
|
||||
|
||||
QPointF p1m = p1p2GCS.map(p1);
|
||||
QPointF p2m = p1p2GCS.map(p2);
|
||||
@ -1723,7 +1723,7 @@ PDFMesh PDFRadialShading::createMesh(const PDFMeshQualitySettings& settings,
|
||||
class PDFRadialShadingSampler : public PDFShadingSampler
|
||||
{
|
||||
public:
|
||||
PDFRadialShadingSampler(const PDFRadialShading* radialShadingPattern, QMatrix userSpaceToDeviceSpaceMatrix) :
|
||||
PDFRadialShadingSampler(const PDFRadialShading* radialShadingPattern, QTransform userSpaceToDeviceSpaceMatrix) :
|
||||
PDFShadingSampler(radialShadingPattern),
|
||||
m_radialShadingPattern(radialShadingPattern),
|
||||
m_xStart(0.0),
|
||||
@ -1735,7 +1735,7 @@ public:
|
||||
m_r0(0.0),
|
||||
m_r1(0.0)
|
||||
{
|
||||
QMatrix patternSpaceToDeviceSpace = radialShadingPattern->getMatrix() * userSpaceToDeviceSpaceMatrix;
|
||||
QTransform patternSpaceToDeviceSpace = radialShadingPattern->getMatrix() * userSpaceToDeviceSpaceMatrix;
|
||||
|
||||
QPointF p1 = patternSpaceToDeviceSpace.map(radialShadingPattern->getStartPoint());
|
||||
QPointF p2 = patternSpaceToDeviceSpace.map(radialShadingPattern->getEndPoint());
|
||||
@ -1754,10 +1754,10 @@ public:
|
||||
// Matrix p1p2LCS is local coordinate system of line p1-p2. It transforms
|
||||
// points on the line to the global coordinate system. So, point (0, 0) will
|
||||
// map onto p1 and point (length(p1-p2), 0) will map onto p2.
|
||||
QMatrix p1p2LCS;
|
||||
QTransform p1p2LCS;
|
||||
p1p2LCS.translate(p1.x(), p1.y());
|
||||
p1p2LCS.rotate(angle);
|
||||
QMatrix p1p2GCS = p1p2LCS.inverted();
|
||||
QTransform p1p2GCS = p1p2LCS.inverted();
|
||||
|
||||
QPointF p1m = p1p2GCS.map(p1);
|
||||
QPointF p2m = p1p2GCS.map(p2);
|
||||
@ -1970,7 +1970,7 @@ public:
|
||||
|
||||
private:
|
||||
const PDFRadialShading* m_radialShadingPattern;
|
||||
QMatrix m_p1p2GCS;
|
||||
QTransform m_p1p2GCS;
|
||||
PDFReal m_xStart;
|
||||
PDFReal m_xEnd;
|
||||
PDFReal m_tAtStart;
|
||||
@ -1981,7 +1981,7 @@ private:
|
||||
PDFReal m_r1;
|
||||
};
|
||||
|
||||
PDFShadingSampler* PDFRadialShading::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
|
||||
PDFShadingSampler* PDFRadialShading::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
|
||||
{
|
||||
return new PDFRadialShadingSampler(this, userSpaceToDeviceSpaceMatrix);
|
||||
}
|
||||
@ -1993,11 +1993,11 @@ private:
|
||||
{
|
||||
std::array<uint32_t, 3> vertexIndices = { };
|
||||
std::array<PDFColor, 3> vertexColors;
|
||||
QMatrix barycentricCoordinateMatrix;
|
||||
QTransform barycentricCoordinateMatrix;
|
||||
};
|
||||
|
||||
public:
|
||||
PDFTriangleShadingSampler(const PDFType4567Shading* shadingPattern, QMatrix userSpaceToDeviceSpaceMatrix) :
|
||||
PDFTriangleShadingSampler(const PDFType4567Shading* shadingPattern, QTransform userSpaceToDeviceSpaceMatrix) :
|
||||
PDFShadingSampler(shadingPattern),
|
||||
m_type4567ShadingPattern(shadingPattern)
|
||||
{
|
||||
@ -2098,7 +2098,7 @@ public:
|
||||
QPointF p1p3 = p1 - p3;
|
||||
QPointF p2p3 = p2 - p3;
|
||||
|
||||
QMatrix B(p1p3.x(), p1p3.y(), p2p3.x(), p2p3.y(), 0.0, 0.0);
|
||||
QTransform B(p1p3.x(), p1p3.y(), p2p3.x(), p2p3.y(), 0.0, 0.0);
|
||||
|
||||
if (!B.isInvertible())
|
||||
{
|
||||
@ -2108,9 +2108,9 @@ public:
|
||||
|
||||
// We precalculate B^-1 * (-p3), so we do not have it to compute it
|
||||
// in each iteration.
|
||||
QMatrix Binv = B.inverted();
|
||||
QTransform Binv = B.inverted();
|
||||
QPointF pt = Binv.map(-p3);
|
||||
Binv.setMatrix(Binv.m11(), Binv.m12(), Binv.m21(), Binv.m22(), pt.x(), pt.y());
|
||||
Binv = QTransform(Binv.m11(), Binv.m12(), Binv.m21(), Binv.m22(), pt.x(), pt.y());
|
||||
|
||||
triangle.barycentricCoordinateMatrix = Binv;
|
||||
m_triangles.emplace_back(qMove(triangle));
|
||||
@ -2132,10 +2132,10 @@ ShadingType PDFFreeFormGouradTriangleShading::getShadingType() const
|
||||
|
||||
bool PDFFreeFormGouradTriangleShading::processTriangles(InitializeFunction initializeMeshFunction,
|
||||
AddTriangleFunction addTriangle,
|
||||
const QMatrix& userSpaceToDeviceSpaceMatrix,
|
||||
const QTransform& userSpaceToDeviceSpaceMatrix,
|
||||
bool convertColors) const
|
||||
{
|
||||
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
|
||||
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
|
||||
size_t bitsPerVertex = m_bitsPerFlag + 2 * m_bitsPerCoordinate + m_colorComponentCount * m_bitsPerComponent;
|
||||
size_t remainder = (8 - (bitsPerVertex % 8)) % 8;
|
||||
bitsPerVertex += remainder;
|
||||
@ -2292,7 +2292,7 @@ PDFMesh PDFFreeFormGouradTriangleShading::createMesh(const PDFMeshQualitySetting
|
||||
return mesh;
|
||||
}
|
||||
|
||||
PDFShadingSampler* PDFFreeFormGouradTriangleShading::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
|
||||
PDFShadingSampler* PDFFreeFormGouradTriangleShading::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
|
||||
{
|
||||
PDFTriangleShadingSampler* sampler = new PDFTriangleShadingSampler(this, userSpaceToDeviceSpaceMatrix);
|
||||
|
||||
@ -2328,10 +2328,10 @@ ShadingType PDFLatticeFormGouradTriangleShading::getShadingType() const
|
||||
|
||||
bool PDFLatticeFormGouradTriangleShading::processTriangles(InitializeFunction initializeMeshFunction,
|
||||
AddTriangleFunction addTriangle,
|
||||
const QMatrix& userSpaceToDeviceSpaceMatrix,
|
||||
const QTransform& userSpaceToDeviceSpaceMatrix,
|
||||
bool convertColors) const
|
||||
{
|
||||
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
|
||||
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
|
||||
size_t bitsPerVertex = 2 * m_bitsPerCoordinate + m_colorComponentCount * m_bitsPerComponent;
|
||||
size_t remainder = (8 - (bitsPerVertex % 8)) % 8;
|
||||
bitsPerVertex += remainder;
|
||||
@ -2460,7 +2460,7 @@ PDFMesh PDFLatticeFormGouradTriangleShading::createMesh(const PDFMeshQualitySett
|
||||
return mesh;
|
||||
}
|
||||
|
||||
PDFShadingSampler* PDFLatticeFormGouradTriangleShading::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
|
||||
PDFShadingSampler* PDFLatticeFormGouradTriangleShading::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
|
||||
{
|
||||
PDFTriangleShadingSampler* sampler = new PDFTriangleShadingSampler(this, userSpaceToDeviceSpaceMatrix);
|
||||
|
||||
@ -2874,9 +2874,9 @@ ShadingType PDFTensorProductPatchShading::getShadingType() const
|
||||
return ShadingType::TensorProductPatchMesh;
|
||||
}
|
||||
|
||||
PDFTensorPatches PDFTensorProductPatchShading::createPatches(QMatrix userSpaceToDeviceSpaceMatrix, bool transformColor) const
|
||||
PDFTensorPatches PDFTensorProductPatchShading::createPatches(QTransform userSpaceToDeviceSpaceMatrix, bool transformColor) const
|
||||
{
|
||||
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
|
||||
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
|
||||
|
||||
size_t bitsPerPatch = m_bitsPerFlag + 16 * 2 * m_bitsPerCoordinate + 4 * m_colorComponentCount * m_bitsPerComponent;
|
||||
size_t remainder = (8 - (bitsPerPatch % 8)) % 8;
|
||||
@ -3158,7 +3158,7 @@ struct PDFTensorProductPatchShadingBase::Triangle
|
||||
class PDFTensorPatchesSample : public PDFShadingSampler
|
||||
{
|
||||
public:
|
||||
PDFTensorPatchesSample(const PDFTensorProductPatchShadingBase* shadingPattern, QMatrix userSpaceToDeviceSpaceMatrix) :
|
||||
PDFTensorPatchesSample(const PDFTensorProductPatchShadingBase* shadingPattern, QTransform userSpaceToDeviceSpaceMatrix) :
|
||||
PDFShadingSampler(shadingPattern),
|
||||
m_tensorProductShadingPattern(shadingPattern)
|
||||
{
|
||||
@ -3238,7 +3238,7 @@ private:
|
||||
PDFTensorPatches m_patches;
|
||||
};
|
||||
|
||||
PDFShadingSampler* PDFTensorProductPatchShadingBase::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
|
||||
PDFShadingSampler* PDFTensorProductPatchShadingBase::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
|
||||
{
|
||||
PDFTensorPatches patches = createPatches(userSpaceToDeviceSpaceMatrix, false);
|
||||
|
||||
@ -3448,7 +3448,7 @@ void PDFTensorProductPatchShadingBase::fillMesh(PDFMesh& mesh,
|
||||
}
|
||||
|
||||
void PDFTensorProductPatchShadingBase::fillMesh(PDFMesh& mesh,
|
||||
const QMatrix& patternSpaceToDeviceSpaceMatrix,
|
||||
const QTransform& patternSpaceToDeviceSpaceMatrix,
|
||||
const PDFMeshQualitySettings& settings,
|
||||
const PDFTensorPatches& patches,
|
||||
const PDFCMS* cms,
|
||||
@ -3495,9 +3495,9 @@ ShadingType PDFCoonsPatchShading::getShadingType() const
|
||||
return ShadingType::CoonsPatchMesh;
|
||||
}
|
||||
|
||||
PDFTensorPatches PDFCoonsPatchShading::createPatches(QMatrix userSpaceToDeviceSpaceMatrix, bool transformColor) const
|
||||
PDFTensorPatches PDFCoonsPatchShading::createPatches(QTransform userSpaceToDeviceSpaceMatrix, bool transformColor) const
|
||||
{
|
||||
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
|
||||
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
|
||||
|
||||
size_t bitsPerPatch = m_bitsPerFlag + 16 * 2 * m_bitsPerCoordinate + 4 * m_colorComponentCount * m_bitsPerComponent;
|
||||
size_t remainder = (8 - (bitsPerPatch % 8)) % 8;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "pdfcolorspaces.h"
|
||||
#include "pdfmeshqualitysettings.h"
|
||||
|
||||
#include <QMatrix>
|
||||
#include <QTransform>
|
||||
#include <QPainterPath>
|
||||
|
||||
#include <memory>
|
||||
@ -95,7 +95,7 @@ public:
|
||||
|
||||
/// Transforms the mesh according to the matrix transform
|
||||
/// \param matrix Matrix transform to be performed
|
||||
void transform(const QMatrix& matrix);
|
||||
void transform(const QTransform& matrix);
|
||||
|
||||
/// Reserves memory for meshing - both number of vertices and triangles.
|
||||
/// Use this function, if number of vertices and triangles is known.
|
||||
@ -172,7 +172,7 @@ public:
|
||||
|
||||
/// Returns transformation matrix from pattern space to the default
|
||||
/// target space.
|
||||
const QMatrix& getMatrix() const { return m_matrix; }
|
||||
const QTransform& getMatrix() const { return m_matrix; }
|
||||
|
||||
/// Create pattern from the object. If error occurs, exception is thrown
|
||||
/// \param colorSpaceDictionary Color space dictionary
|
||||
@ -201,7 +201,7 @@ public:
|
||||
static PDFPatternPtr createShadingPattern(const PDFDictionary* colorSpaceDictionary,
|
||||
const PDFDocument* document,
|
||||
const PDFObject& shadingObject,
|
||||
const QMatrix& matrix,
|
||||
const QTransform& matrix,
|
||||
const PDFObject& patternGraphicState,
|
||||
const PDFCMS* cms,
|
||||
RenderingIntent intent,
|
||||
@ -210,7 +210,7 @@ public:
|
||||
|
||||
protected:
|
||||
QRectF m_boundingBox;
|
||||
QMatrix m_matrix;
|
||||
QTransform m_matrix;
|
||||
};
|
||||
|
||||
class PDFInvalidPattern : public PDFPattern
|
||||
@ -338,16 +338,16 @@ public:
|
||||
bool isAntialiasing() const { return m_antiAlias; }
|
||||
|
||||
/// Returns matrix transforming pattern space to device space
|
||||
QMatrix getPatternSpaceToDeviceSpaceMatrix(const PDFMeshQualitySettings& settings) const;
|
||||
QTransform getPatternSpaceToDeviceSpaceMatrix(const PDFMeshQualitySettings& settings) const;
|
||||
|
||||
/// Returns matrix transforming pattern space to device space
|
||||
QMatrix getPatternSpaceToDeviceSpaceMatrix(const QMatrix& userSpaceToDeviceSpaceMatrix) const;
|
||||
QTransform getPatternSpaceToDeviceSpaceMatrix(const QTransform& userSpaceToDeviceSpaceMatrix) const;
|
||||
|
||||
/// Create sampler which can compute shading colors in device space coordinates. If sampler can't
|
||||
/// be created (or shading is invalid), then nullptr is returned.
|
||||
/// \param userSpaceToDeviceSpaceMatrix Matrix, which transforms user space points
|
||||
/// (user space is target space of the shading) to the device space of the paint device.
|
||||
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const;
|
||||
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const;
|
||||
|
||||
protected:
|
||||
friend class PDFPattern;
|
||||
@ -395,17 +395,17 @@ public:
|
||||
RenderingIntent intent,
|
||||
PDFRenderErrorReporter* reporter,
|
||||
const PDFOperationControl* operationControl) const override;
|
||||
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const override;
|
||||
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const override;
|
||||
|
||||
const QRectF& getDomain() const { return m_domain; }
|
||||
const QMatrix& getDomainToTargetTransform() const { return m_domainToTargetTransform; }
|
||||
const QTransform& getDomainToTargetTransform() const { return m_domainToTargetTransform; }
|
||||
const std::vector<PDFFunctionPtr>& getFunctions() const { return m_functions; }
|
||||
|
||||
private:
|
||||
friend class PDFPattern;
|
||||
|
||||
QRectF m_domain; ///< Domain of the color function
|
||||
QMatrix m_domainToTargetTransform; ///< Transformation mapping from domain to shading coordinate space
|
||||
QTransform m_domainToTargetTransform; ///< Transformation mapping from domain to shading coordinate space
|
||||
std::vector<PDFFunctionPtr> m_functions; ///< Color functions
|
||||
};
|
||||
|
||||
@ -420,7 +420,7 @@ public:
|
||||
RenderingIntent intent,
|
||||
PDFRenderErrorReporter* reporter,
|
||||
const PDFOperationControl* operationControl) const override;
|
||||
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const override;
|
||||
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const override;
|
||||
|
||||
private:
|
||||
friend class PDFPattern;
|
||||
@ -437,7 +437,7 @@ public:
|
||||
RenderingIntent intent,
|
||||
PDFRenderErrorReporter* reporter,
|
||||
const PDFOperationControl* operationControl) const override;
|
||||
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const override;
|
||||
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const override;
|
||||
|
||||
PDFReal getR0() const { return m_r0; }
|
||||
PDFReal getR1() const { return m_r1; }
|
||||
@ -501,7 +501,7 @@ public:
|
||||
RenderingIntent intent,
|
||||
PDFRenderErrorReporter* reporter,
|
||||
const PDFOperationControl* operationControl) const override;
|
||||
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const override;
|
||||
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const override;
|
||||
|
||||
private:
|
||||
struct VertexData
|
||||
@ -519,7 +519,7 @@ private:
|
||||
|
||||
bool processTriangles(InitializeFunction initializeMeshFunction,
|
||||
AddTriangleFunction addTriangle,
|
||||
const QMatrix& userSpaceToDeviceSpaceMatrix,
|
||||
const QTransform& userSpaceToDeviceSpaceMatrix,
|
||||
bool convertColors) const;
|
||||
};
|
||||
|
||||
@ -534,7 +534,7 @@ public:
|
||||
RenderingIntent intent,
|
||||
PDFRenderErrorReporter* reporter,
|
||||
const PDFOperationControl* operationControl) const override;
|
||||
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const override;
|
||||
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const override;
|
||||
|
||||
private:
|
||||
friend class PDFPattern;
|
||||
@ -551,7 +551,7 @@ private:
|
||||
|
||||
bool processTriangles(InitializeFunction initializeMeshFunction,
|
||||
AddTriangleFunction addTriangle,
|
||||
const QMatrix& userSpaceToDeviceSpaceMatrix,
|
||||
const QTransform& userSpaceToDeviceSpaceMatrix,
|
||||
bool convertColors) const;
|
||||
|
||||
PDFInteger m_verticesPerRow = 0;
|
||||
@ -693,14 +693,14 @@ class PDFTensorProductPatchShadingBase : public PDFType4567Shading
|
||||
public:
|
||||
explicit inline PDFTensorProductPatchShadingBase() = default;
|
||||
|
||||
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const override;
|
||||
virtual PDFTensorPatches createPatches(QMatrix userSpaceToDeviceSpaceMatrix, bool transformColor) const = 0;
|
||||
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const override;
|
||||
virtual PDFTensorPatches createPatches(QTransform userSpaceToDeviceSpaceMatrix, bool transformColor) const = 0;
|
||||
|
||||
protected:
|
||||
struct Triangle;
|
||||
|
||||
void fillMesh(PDFMesh& mesh, const PDFMeshQualitySettings& settings, const PDFTensorPatch& patch, const PDFCMS* cms, RenderingIntent intent, PDFRenderErrorReporter* reporter, bool fastAlgorithm, const PDFOperationControl* operationControl) const;
|
||||
void fillMesh(PDFMesh& mesh, const QMatrix& patternSpaceToDeviceSpaceMatrix, const PDFMeshQualitySettings& settings, const PDFTensorPatches& patches, const PDFCMS* cms, RenderingIntent intent, PDFRenderErrorReporter* reporter, const PDFOperationControl* operationControl) const;
|
||||
void fillMesh(PDFMesh& mesh, const QTransform& patternSpaceToDeviceSpaceMatrix, const PDFMeshQualitySettings& settings, const PDFTensorPatches& patches, const PDFCMS* cms, RenderingIntent intent, PDFRenderErrorReporter* reporter, const PDFOperationControl* operationControl) const;
|
||||
static void addTriangle(std::vector<Triangle>& triangles, const PDFTensorPatch& patch, std::array<QPointF, 3> uvCoordinates);
|
||||
|
||||
private:
|
||||
@ -718,7 +718,7 @@ public:
|
||||
RenderingIntent intent,
|
||||
PDFRenderErrorReporter* reporter,
|
||||
const PDFOperationControl* operationControl) const override;
|
||||
virtual PDFTensorPatches createPatches(QMatrix userSpaceToDeviceSpaceMatrix, bool transformColor) const override;
|
||||
virtual PDFTensorPatches createPatches(QTransform userSpaceToDeviceSpaceMatrix, bool transformColor) const override;
|
||||
|
||||
private:
|
||||
friend class PDFPattern;
|
||||
@ -735,7 +735,7 @@ public:
|
||||
RenderingIntent intent,
|
||||
PDFRenderErrorReporter* reporter,
|
||||
const PDFOperationControl* operationControl) const override;
|
||||
virtual PDFTensorPatches createPatches(QMatrix userSpaceToDeviceSpaceMatrix, bool transformColor) const override;
|
||||
virtual PDFTensorPatches createPatches(QTransform userSpaceToDeviceSpaceMatrix, bool transformColor) const override;
|
||||
|
||||
private:
|
||||
friend class PDFPattern;
|
||||
|
@ -101,7 +101,7 @@ PDFDocument PDFRedact::perform(Options options)
|
||||
redactPath.addPath(redactAnnotation->getRedactionRegion().getPath());
|
||||
}
|
||||
|
||||
QMatrix matrix;
|
||||
QTransform matrix;
|
||||
matrix.translate(0, page->getMediaBox().height());
|
||||
matrix.scale(1.0, -1.0);
|
||||
|
||||
|
@ -50,7 +50,7 @@ PDFRenderer::PDFRenderer(const PDFDocument* document,
|
||||
Q_ASSERT(document);
|
||||
}
|
||||
|
||||
QMatrix PDFRenderer::createPagePointToDevicePointMatrix(const PDFPage* page,
|
||||
QTransform PDFRenderer::createPagePointToDevicePointMatrix(const PDFPage* page,
|
||||
const QRectF& rectangle,
|
||||
PageRotation extraRotation)
|
||||
{
|
||||
@ -60,11 +60,11 @@ QMatrix PDFRenderer::createPagePointToDevicePointMatrix(const PDFPage* page,
|
||||
return createMediaBoxToDevicePointMatrix(mediaBox, rectangle, pageRotation);
|
||||
}
|
||||
|
||||
QMatrix PDFRenderer::createMediaBoxToDevicePointMatrix(const QRectF& mediaBox,
|
||||
QTransform PDFRenderer::createMediaBoxToDevicePointMatrix(const QRectF& mediaBox,
|
||||
const QRectF& rectangle,
|
||||
PageRotation rotation)
|
||||
{
|
||||
QMatrix matrix;
|
||||
QTransform matrix;
|
||||
switch (rotation)
|
||||
{
|
||||
case PageRotation::None:
|
||||
@ -130,14 +130,14 @@ QList<PDFRenderError> PDFRenderer::render(QPainter* painter, const QRectF& recta
|
||||
const PDFPage* page = catalog->getPage(pageIndex);
|
||||
Q_ASSERT(page);
|
||||
|
||||
QMatrix matrix = createPagePointToDevicePointMatrix(page, rectangle);
|
||||
QTransform matrix = createPagePointToDevicePointMatrix(page, rectangle);
|
||||
|
||||
PDFPainter processor(painter, m_features, matrix, page, m_document, m_fontCache, m_cms, m_optionalContentActivity, m_meshQualitySettings);
|
||||
processor.setOperationControl(m_operationControl);
|
||||
return processor.processContents();
|
||||
}
|
||||
|
||||
QList<PDFRenderError> PDFRenderer::render(QPainter* painter, const QMatrix& matrix, size_t pageIndex) const
|
||||
QList<PDFRenderError> PDFRenderer::render(QPainter* painter, const QTransform& matrix, size_t pageIndex) const
|
||||
{
|
||||
const PDFCatalog* catalog = m_document->getCatalog();
|
||||
if (pageIndex >= catalog->getPageCount() || !catalog->getPage(pageIndex))
|
||||
@ -229,7 +229,7 @@ QImage PDFRasterizer::render(PDFInteger pageIndex,
|
||||
{
|
||||
QImage image;
|
||||
|
||||
QMatrix matrix = PDFRenderer::createPagePointToDevicePointMatrix(page, QRect(QPoint(0, 0), size), extraRotation);
|
||||
QTransform matrix = PDFRenderer::createPagePointToDevicePointMatrix(page, QRect(QPoint(0, 0), size), extraRotation);
|
||||
if (m_features.testFlag(UseOpenGL) && m_features.testFlag(ValidOpenGL))
|
||||
{
|
||||
// We have valid OpenGL context, try to select it and possibly create framebuffer object
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
/// Paints desired page onto the painter. Page is painted using \p matrix, which maps page coordinates
|
||||
/// to the device coordinates. If the page doesn't exist, then error is returned. No exception is thrown.
|
||||
/// Rendering errors are reported and returned in the error list. If no error occured, empty list is returned.
|
||||
QList<PDFRenderError> render(QPainter* painter, const QMatrix& matrix, size_t pageIndex) const;
|
||||
QList<PDFRenderError> render(QPainter* painter, const QTransform& matrix, size_t pageIndex) const;
|
||||
|
||||
/// Compiles page (i.e. prepares compiled page). \p page should be empty page, onto which
|
||||
/// are graphics commands written. No exception is thrown. Rendering errors are reported and written
|
||||
@ -99,17 +99,17 @@ public:
|
||||
/// \param page Page, for which we want to create matrix
|
||||
/// \param rectangle Page rectangle, to which is page media box transformed
|
||||
/// \param extraRotation Extra rotation applied to the page rotation
|
||||
static QMatrix createPagePointToDevicePointMatrix(const PDFPage* page,
|
||||
const QRectF& rectangle,
|
||||
PageRotation extraRotation = PageRotation::None);
|
||||
static QTransform createPagePointToDevicePointMatrix(const PDFPage* page,
|
||||
const QRectF& rectangle,
|
||||
PageRotation extraRotation = PageRotation::None);
|
||||
|
||||
/// Creates media box to device point matrix for the given media box.
|
||||
/// \param mediaBox Media box
|
||||
/// \param rectangle Page rectangle, to which is page media box transformed
|
||||
/// \param rotation Rotation
|
||||
static QMatrix createMediaBoxToDevicePointMatrix(const QRectF& mediaBox,
|
||||
const QRectF& rectangle,
|
||||
PageRotation rotation);
|
||||
static QTransform createMediaBoxToDevicePointMatrix(const QRectF& mediaBox,
|
||||
const QRectF& rectangle,
|
||||
PageRotation rotation);
|
||||
|
||||
/// Returns default renderer features
|
||||
static constexpr Features getDefaultFeatures() { return Features(Antialiasing | TextAntialiasing | ClipToCropBox | DisplayAnnotations); }
|
||||
|
@ -42,6 +42,11 @@ namespace pdf
|
||||
template<typename T>
|
||||
using openssl_ptr = std::unique_ptr<T, void(*)(T*)>;
|
||||
|
||||
void sk_x509_free_impl(STACK_OF(X509)* ptr)
|
||||
{
|
||||
sk_X509_free(ptr);
|
||||
}
|
||||
|
||||
// Padding password
|
||||
static constexpr std::array<uint8_t, 32> PDFPasswordPadding = {
|
||||
0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41,
|
||||
@ -1993,7 +1998,7 @@ PDFSecurityHandlerPointer PDFSecurityHandlerFactory::createSecurityHandler(const
|
||||
{
|
||||
openssl_ptr<EVP_PKEY> key(keyPtr, EVP_PKEY_free);
|
||||
openssl_ptr<X509> certificate(certificatePtr, X509_free);
|
||||
openssl_ptr<STACK_OF(X509)> certificates(certificatesPtr, sk_X509_free);
|
||||
openssl_ptr<STACK_OF(X509)> certificates(certificatesPtr, sk_x509_free_impl);
|
||||
openssl_ptr<BIO> dataToBeSigned(BIO_new(BIO_s_mem()), BIO_free_all);
|
||||
|
||||
uint32_t permissions = qToLittleEndian(publicKeyHandler->m_permissions);
|
||||
@ -2002,7 +2007,7 @@ PDFSecurityHandlerPointer PDFSecurityHandlerFactory::createSecurityHandler(const
|
||||
BIO_write(dataToBeSigned.get(), randomKey.data(), randomKey.length());
|
||||
BIO_write(dataToBeSigned.get(), &permissions, sizeof(permissions));
|
||||
|
||||
openssl_ptr<STACK_OF(X509)> recipientCertificates(sk_X509_new_null(), sk_X509_free);
|
||||
openssl_ptr<STACK_OF(X509)> recipientCertificates(sk_X509_new_null(), sk_x509_free_impl);
|
||||
sk_X509_push(recipientCertificates.get(), certificate.get());
|
||||
|
||||
openssl_ptr<PKCS7> pkcs7(PKCS7_encrypt(recipientCertificates.get(), dataToBeSigned.get(), EVP_aes_256_cbc(), PKCS7_BINARY), PKCS7_free);
|
||||
@ -2444,7 +2449,7 @@ PDFSecurityHandler::AuthorizationResult PDFPublicKeySecurityHandler::authenticat
|
||||
|
||||
openssl_ptr<EVP_PKEY> key(keyPtr, EVP_PKEY_free);
|
||||
openssl_ptr<X509> certificate(certificatePtr, X509_free);
|
||||
openssl_ptr<STACK_OF(X509)> certificates2(certificatesPtr, sk_X509_free);
|
||||
openssl_ptr<STACK_OF(X509)> certificates2(certificatesPtr, sk_x509_free_impl);
|
||||
|
||||
for (const auto& recipientItem : recipients)
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ namespace pdf
|
||||
template<typename T>
|
||||
using openssl_ptr = std::unique_ptr<T, void(*)(T*)>;
|
||||
|
||||
static QMutex s_globalOpenSSLMutex(QMutex::Recursive);
|
||||
static QRecursiveMutex s_globalOpenSSLMutex;
|
||||
|
||||
/// OpenSSL is not thread safe.
|
||||
class PDFOpenSSLGlobalLock
|
||||
@ -56,7 +56,7 @@ public:
|
||||
inline ~PDFOpenSSLGlobalLock() = default;
|
||||
|
||||
private:
|
||||
QMutexLocker m_mutexLocker;
|
||||
QMutexLocker<QRecursiveMutex> m_mutexLocker;
|
||||
};
|
||||
|
||||
PDFSignatureReference PDFSignatureReference::parse(const PDFObjectStorage* storage, PDFObject object)
|
||||
|
@ -35,7 +35,7 @@ PDFTextEditPseudowidget::PDFTextEditPseudowidget(PDFFormField::FieldFlags flags)
|
||||
m_maxTextLength(0)
|
||||
{
|
||||
m_textLayout.setCacheEnabled(true);
|
||||
m_passwordReplacementCharacter = QApplication::style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter);
|
||||
m_passwordReplacementCharacter = QChar(QApplication::style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter));
|
||||
}
|
||||
|
||||
void PDFTextEditPseudowidget::shortcutOverrideEvent(QWidget* widget, QKeyEvent* event)
|
||||
@ -559,9 +559,9 @@ void PDFTextEditPseudowidget::performInsertText(const QString& text)
|
||||
updateTextLayout();
|
||||
}
|
||||
|
||||
QMatrix PDFTextEditPseudowidget::createTextBoxTransformMatrix(bool edit) const
|
||||
QTransform PDFTextEditPseudowidget::createTextBoxTransformMatrix(bool edit) const
|
||||
{
|
||||
QMatrix matrix;
|
||||
QTransform matrix;
|
||||
|
||||
matrix.translate(m_widgetRect.left(), m_widgetRect.bottom());
|
||||
matrix.scale(1.0, -1.0);
|
||||
@ -759,8 +759,8 @@ void PDFTextEditPseudowidget::draw(AnnotationDrawParameters& parameters, bool ed
|
||||
|
||||
int PDFTextEditPseudowidget::getCursorPositionFromWidgetPosition(const QPointF& point, bool edit) const
|
||||
{
|
||||
QMatrix textBoxSpaceToPageSpace = createTextBoxTransformMatrix(edit);
|
||||
QMatrix pageSpaceToTextBoxSpace = textBoxSpaceToPageSpace.inverted();
|
||||
QTransform textBoxSpaceToPageSpace = createTextBoxTransformMatrix(edit);
|
||||
QTransform pageSpaceToTextBoxSpace = textBoxSpaceToPageSpace.inverted();
|
||||
|
||||
QPointF textBoxPoint = pageSpaceToTextBoxSpace.map(point);
|
||||
|
||||
|
@ -177,7 +177,7 @@ private:
|
||||
/// Creates text box transform matrix, which transforms from
|
||||
/// widget space to page space.
|
||||
/// \param edit Create matrix for text editing?
|
||||
QMatrix createTextBoxTransformMatrix(bool edit) const;
|
||||
QTransform createTextBoxTransformMatrix(bool edit) const;
|
||||
|
||||
/// Returns vector of cursor positions (which may be not equal
|
||||
/// to edit string length, because edit string can contain surrogates,
|
||||
|
@ -324,7 +324,7 @@ PDFTextSelection PDFTextLayout::createTextSelection(PDFInteger pageIndex, const
|
||||
size_t blockId = 0;
|
||||
for (PDFTextBlock& block : m_blocks)
|
||||
{
|
||||
QMatrix angleMatrix;
|
||||
QTransform angleMatrix;
|
||||
angleMatrix.rotate(block.getAngle());
|
||||
block.applyTransform(angleMatrix);
|
||||
|
||||
@ -613,7 +613,7 @@ void PDFTextLayout::performDoLayout(PDFReal angle)
|
||||
TextCharacters characters = getCharactersForAngle(angle);
|
||||
|
||||
// Step 1) - rotate blocks
|
||||
QMatrix angleMatrix;
|
||||
QTransform angleMatrix;
|
||||
angleMatrix.rotate(angle);
|
||||
applyTransform(characters, angleMatrix);
|
||||
|
||||
@ -840,7 +840,7 @@ void PDFTextLayout::performDoLayout(PDFReal angle)
|
||||
}
|
||||
|
||||
// Topological sort
|
||||
QMatrix invertedAngleMatrix = angleMatrix.inverted();
|
||||
QTransform invertedAngleMatrix = angleMatrix.inverted();
|
||||
while (!workBlocks.empty())
|
||||
{
|
||||
auto it = std::min_element(workBlocks.begin(), workBlocks.end(), [&orderingEdges](const size_t l, const size_t r) { return orderingEdges[l].size() < orderingEdges[r].size(); });
|
||||
@ -863,7 +863,7 @@ TextCharacters PDFTextLayout::getCharactersForAngle(PDFReal angle) const
|
||||
return result;
|
||||
}
|
||||
|
||||
void PDFTextLayout::applyTransform(TextCharacters& characters, const QMatrix& matrix)
|
||||
void PDFTextLayout::applyTransform(TextCharacters& characters, const QTransform& matrix)
|
||||
{
|
||||
for (TextCharacter& character : characters)
|
||||
{
|
||||
@ -896,7 +896,7 @@ PDFReal PDFTextLine::getAngle() const
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
void PDFTextLine::applyTransform(const QMatrix& matrix)
|
||||
void PDFTextLine::applyTransform(const QTransform& matrix)
|
||||
{
|
||||
m_boundingBox = matrix.map(m_boundingBox);
|
||||
m_topLeft = matrix.map(m_topLeft);
|
||||
@ -956,7 +956,7 @@ PDFReal PDFTextBlock::getAngle() const
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
void PDFTextBlock::applyTransform(const QMatrix& matrix)
|
||||
void PDFTextBlock::applyTransform(const QTransform& matrix)
|
||||
{
|
||||
m_boundingBox = matrix.map(m_boundingBox);
|
||||
m_topLeft = matrix.map(m_topLeft);
|
||||
@ -982,7 +982,7 @@ QDataStream& operator<<(QDataStream& stream, const PDFTextBlock& block)
|
||||
return stream;
|
||||
}
|
||||
|
||||
void TextCharacter::applyTransform(const QMatrix& matrix)
|
||||
void TextCharacter::applyTransform(const QTransform& matrix)
|
||||
{
|
||||
position = matrix.map(position);
|
||||
boundingBox = matrix.map(boundingBox);
|
||||
@ -1427,7 +1427,7 @@ PDFTextLayout PDFTextLayoutStorageGetter::getTextLayoutImpl() const
|
||||
return m_storage ? m_storage->getTextLayout(m_pageIndex) : PDFTextLayout();
|
||||
}
|
||||
|
||||
void PDFTextSelectionPainter::draw(QPainter* painter, PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QMatrix& matrix)
|
||||
void PDFTextSelectionPainter::draw(QPainter* painter, PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QTransform& matrix)
|
||||
{
|
||||
Q_ASSERT(painter);
|
||||
|
||||
@ -1462,7 +1462,7 @@ void PDFTextSelectionPainter::draw(QPainter* painter, PDFInteger pageIndex, PDFT
|
||||
PDFTextBlock block = blocks[start.blockIndex];
|
||||
|
||||
// Fix angle of block, so we will get correct selection rectangles (parallel to lines)
|
||||
QMatrix angleMatrix;
|
||||
QTransform angleMatrix;
|
||||
angleMatrix.rotate(block.getAngle());
|
||||
block.applyTransform(angleMatrix);
|
||||
|
||||
@ -1524,7 +1524,7 @@ void PDFTextSelectionPainter::draw(QPainter* painter, PDFInteger pageIndex, PDFT
|
||||
}
|
||||
}
|
||||
|
||||
QMatrix transformMatrix = angleMatrix.inverted() * matrix;
|
||||
QTransform transformMatrix = angleMatrix.inverted() * matrix;
|
||||
path = transformMatrix.map(path);
|
||||
|
||||
QColor penColor = item.color.darker();
|
||||
@ -1539,7 +1539,7 @@ void PDFTextSelectionPainter::draw(QPainter* painter, PDFInteger pageIndex, PDFT
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
QPainterPath PDFTextSelectionPainter::prepareGeometry(PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QMatrix& matrix, QPolygonF* quadrilaterals)
|
||||
QPainterPath PDFTextSelectionPainter::prepareGeometry(PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QTransform& matrix, QPolygonF* quadrilaterals)
|
||||
{
|
||||
QPainterPath path;
|
||||
|
||||
@ -1572,7 +1572,7 @@ QPainterPath PDFTextSelectionPainter::prepareGeometry(PDFInteger pageIndex, PDFT
|
||||
PDFTextBlock block = blocks[start.blockIndex];
|
||||
|
||||
// Fix angle of block, so we will get correct selection rectangles (parallel to lines)
|
||||
QMatrix angleMatrix;
|
||||
QTransform angleMatrix;
|
||||
angleMatrix.rotate(block.getAngle());
|
||||
block.applyTransform(angleMatrix);
|
||||
|
||||
@ -1640,7 +1640,7 @@ QPainterPath PDFTextSelectionPainter::prepareGeometry(PDFInteger pageIndex, PDFT
|
||||
}
|
||||
}
|
||||
|
||||
QMatrix transformMatrix = angleMatrix.inverted() * matrix;
|
||||
QTransform transformMatrix = angleMatrix.inverted() * matrix;
|
||||
currentPath = transformMatrix.map(currentPath);
|
||||
|
||||
if (quadrilaterals)
|
||||
|
@ -53,7 +53,7 @@ struct PDFTextCharacterInfo
|
||||
PDFReal fontSize = 0.0;
|
||||
|
||||
/// Transformation matrix from character space to device space
|
||||
QMatrix matrix;
|
||||
QTransform matrix;
|
||||
};
|
||||
|
||||
struct PDFTextLayoutSettings
|
||||
@ -99,7 +99,7 @@ struct TextCharacter
|
||||
|
||||
size_t index = 0; // Just temporary index, it is not serialized, just for text layout algorithm
|
||||
|
||||
void applyTransform(const QMatrix& matrix);
|
||||
void applyTransform(const QTransform& matrix);
|
||||
|
||||
friend QDataStream& operator<<(QDataStream& stream, const TextCharacter& character);
|
||||
friend QDataStream& operator>>(QDataStream& stream, TextCharacter& character);
|
||||
@ -125,7 +125,7 @@ public:
|
||||
/// Get angle inclination of block
|
||||
PDFReal getAngle() const;
|
||||
|
||||
void applyTransform(const QMatrix& matrix);
|
||||
void applyTransform(const QTransform& matrix);
|
||||
|
||||
friend QDataStream& operator<<(QDataStream& stream, const PDFTextLine& line);
|
||||
friend QDataStream& operator>>(QDataStream& stream, PDFTextLine& line);
|
||||
@ -152,7 +152,7 @@ public:
|
||||
/// Get angle inclination of block
|
||||
PDFReal getAngle() const;
|
||||
|
||||
void applyTransform(const QMatrix& matrix);
|
||||
void applyTransform(const QTransform& matrix);
|
||||
|
||||
friend QDataStream& operator<<(QDataStream& stream, const PDFTextBlock& block);
|
||||
friend QDataStream& operator>>(QDataStream& stream, PDFTextBlock& block);
|
||||
@ -414,7 +414,7 @@ private:
|
||||
/// Applies transform to text characters (positions and bounding boxes)
|
||||
/// \param characters Characters
|
||||
/// \param matrix Transform matrix
|
||||
static void applyTransform(TextCharacters& characters, const QMatrix& matrix);
|
||||
static void applyTransform(TextCharacters& characters, const QTransform& matrix);
|
||||
|
||||
TextCharacters m_characters;
|
||||
std::set<PDFReal> m_angles;
|
||||
@ -507,14 +507,14 @@ public:
|
||||
/// \param pageIndex Page index
|
||||
/// \param textLayoutGetter Text layout getter
|
||||
/// \param matrix Matrix which translates from page space to device space
|
||||
void draw(QPainter* painter, PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QMatrix& matrix);
|
||||
void draw(QPainter* painter, PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QTransform& matrix);
|
||||
|
||||
/// Prepares geometry for text selection drawing, using text layout and matrix. If current text selection
|
||||
/// doesn't contain items from active page, then text layout is not accessed.
|
||||
/// \param pageIndex Page index
|
||||
/// \param textLayoutGetter Text layout getter
|
||||
/// \param matrix Matrix which translates from page space to device space
|
||||
QPainterPath prepareGeometry(PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QMatrix& matrix, QPolygonF* quadrilaterals);
|
||||
QPainterPath prepareGeometry(PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QTransform& matrix, QPolygonF* quadrilaterals);
|
||||
|
||||
private:
|
||||
static constexpr const PDFReal HEIGHT_INCREASE_FACTOR = 0.40;
|
||||
|
@ -986,7 +986,7 @@ PDFTransparencyRenderer::PDFTransparencyRenderer(const PDFPage* page,
|
||||
const PDFOptionalContentActivity* optionalContentActivity,
|
||||
const PDFInkMapper* inkMapper,
|
||||
PDFTransparencyRendererSettings settings,
|
||||
QMatrix pagePointToDevicePointMatrix) :
|
||||
QTransform pagePointToDevicePointMatrix) :
|
||||
BaseClass(page, document, fontCache, cms, optionalContentActivity, pagePointToDevicePointMatrix, PDFMeshQualitySettings()),
|
||||
m_inkMapper(inkMapper),
|
||||
m_active(false),
|
||||
@ -1295,7 +1295,7 @@ void PDFTransparencyRenderer::performFillFragmentFromTexture(const PDFReal shape
|
||||
const uint8_t colorChannelEnd,
|
||||
int x,
|
||||
int y,
|
||||
const QMatrix& worldToTextureMatrix,
|
||||
const QTransform& worldToTextureMatrix,
|
||||
const PDFFloatBitmap& texture,
|
||||
const PDFPainterPathSampler& clipSampler)
|
||||
{
|
||||
@ -2102,7 +2102,7 @@ void PDFTransparencyRenderer::performPathPainting(const QPainterPath& path, bool
|
||||
Q_UNUSED(text);
|
||||
Q_UNUSED(fillRule);
|
||||
|
||||
QMatrix worldMatrix = getCurrentWorldMatrix();
|
||||
QTransform worldMatrix = getCurrentWorldMatrix();
|
||||
|
||||
const PDFReal shapeStroking = getShapeStroking();
|
||||
const PDFReal opacityStroking = getOpacityStroking();
|
||||
@ -2262,7 +2262,7 @@ bool PDFTransparencyRenderer::performPathPaintingUsingShading(const QPainterPath
|
||||
// Exactly one of stroke/fill must be true and other must be false
|
||||
Q_ASSERT(stroke != fill);
|
||||
|
||||
QMatrix worldMatrix = getCurrentWorldMatrix();
|
||||
QTransform worldMatrix = getCurrentWorldMatrix();
|
||||
QPainterPath worldPath = worldMatrix.map(path);
|
||||
QRect fillRect = getActualFillRect(worldPath.controlPointRect());
|
||||
|
||||
@ -2626,7 +2626,7 @@ bool PDFTransparencyRenderer::performOriginalImagePainting(const PDFImage& image
|
||||
// 2) We are shrinking the image
|
||||
// 3) Aspect ratio of the image is the same
|
||||
|
||||
QMatrix matrix = getCurrentWorldMatrix();
|
||||
QTransform matrix = getCurrentWorldMatrix();
|
||||
QLineF mappedWidthVector = matrix.map(QLineF(0, 0, texture.getWidth(), 0));
|
||||
QLineF mappedHeightVector = matrix.map(QLineF(0, 0, 0, texture.getHeight()));
|
||||
qreal angle = mappedWidthVector.angleTo(mappedHeightVector);
|
||||
@ -2649,8 +2649,8 @@ bool PDFTransparencyRenderer::performOriginalImagePainting(const PDFImage& image
|
||||
}
|
||||
}
|
||||
|
||||
QMatrix imageTransform(1.0 / qreal(texture.getWidth()), 0, 0, 1.0 / qreal(texture.getHeight()), 0, 0);
|
||||
QMatrix worldMatrix = imageTransform * getCurrentWorldMatrix();
|
||||
QTransform imageTransform(1.0 / qreal(texture.getWidth()), 0, 0, 1.0 / qreal(texture.getHeight()), 0, 0);
|
||||
QTransform worldMatrix = imageTransform * getCurrentWorldMatrix();
|
||||
|
||||
// Because Qt uses opposite axis direction than PDF, then we must transform the y-axis
|
||||
// to the opposite (so the image is then unchanged)
|
||||
@ -2663,7 +2663,7 @@ bool PDFTransparencyRenderer::performOriginalImagePainting(const PDFImage& image
|
||||
imagePolygon << QPointF(texture.getWidth(), texture.getHeight());
|
||||
imagePolygon << QPointF(texture.getWidth(), 0.0);
|
||||
|
||||
QMatrix worldToTextureMatrix = worldMatrix.inverted();
|
||||
QTransform worldToTextureMatrix = worldMatrix.inverted();
|
||||
QRectF boundingRectangle = worldMatrix.map(imagePolygon).boundingRect();
|
||||
QRect fillRect = getActualFillRect(boundingRectangle);
|
||||
|
||||
@ -3920,7 +3920,7 @@ void PDFInkCoverageCalculator::perform(QSize size, const std::vector<PDFInteger>
|
||||
settings.flags.setFlag(PDFTransparencyRendererSettings::SeparationSimulation, true);
|
||||
settings.activeColorMask = PDFPixelFormat::getAllColorsMask();
|
||||
|
||||
QMatrix pagePointToDevicePoint = pdf::PDFRenderer::createPagePointToDevicePointMatrix(page, QRect(QPoint(0, 0), imageSize));
|
||||
QTransform pagePointToDevicePoint = pdf::PDFRenderer::createPagePointToDevicePointMatrix(page, QRect(QPoint(0, 0), imageSize));
|
||||
pdf::PDFCMSPointer cms = m_cmsManager->getCurrentCMS();
|
||||
pdf::PDFTransparencyRenderer renderer(page, m_document, m_fontCache, cms.data(), m_optionalContentActivity,
|
||||
m_inkMapper, settings, pagePointToDevicePoint);
|
||||
|
@ -646,7 +646,7 @@ public:
|
||||
const PDFOptionalContentActivity* optionalContentActivity,
|
||||
const PDFInkMapper* inkMapper,
|
||||
PDFTransparencyRendererSettings settings,
|
||||
QMatrix pagePointToDevicePointMatrix);
|
||||
QTransform pagePointToDevicePointMatrix);
|
||||
|
||||
/// Sets device color space. This is final color space, to which
|
||||
/// is painted page transformed.
|
||||
@ -879,7 +879,7 @@ private:
|
||||
const uint8_t colorChannelEnd,
|
||||
int x,
|
||||
int y,
|
||||
const QMatrix& worldToTextureMatrix,
|
||||
const QTransform& worldToTextureMatrix,
|
||||
const PDFFloatBitmap& texture,
|
||||
const PDFPainterPathSampler& clipSampler);
|
||||
|
||||
|
@ -472,16 +472,16 @@ constexpr bool isRectangleVerticallyOverlapped(const QRectF& r1, const QRectF& r
|
||||
|
||||
inline QColor invertColor(QColor color)
|
||||
{
|
||||
qreal r = 0.0;
|
||||
qreal g = 0.0;
|
||||
qreal b = 0.0;
|
||||
qreal a = 0.0;
|
||||
float r = 0.0;
|
||||
float g = 0.0;
|
||||
float b = 0.0;
|
||||
float a = 0.0;
|
||||
|
||||
color.getRgbF(&r, &g, &b, &a);
|
||||
|
||||
r = 1.0 - r;
|
||||
g = 1.0 - g;
|
||||
b = 1.0 - b;
|
||||
r = 1.0f - r;
|
||||
g = 1.0f - g;
|
||||
b = 1.0f - b;
|
||||
return QColor::fromRgbF(r, g, b, a);
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ void PDFFindTextTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -542,7 +542,7 @@ void PDFSelectTextTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -1091,7 +1091,7 @@ void PDFPickTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -1386,7 +1386,7 @@ void PDFSelectTableTool::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
|
||||
|
@ -166,7 +166,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
protected:
|
||||
@ -233,7 +233,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual void mousePressEvent(QWidget* widget, QMouseEvent* event) override;
|
||||
@ -326,7 +326,7 @@ public:
|
||||
virtual void drawPage(QPainter* painter, PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
virtual void drawPostRendering(QPainter* painter, QRect rect) const override;
|
||||
virtual void mousePressEvent(QWidget* widget, QMouseEvent* event) override;
|
||||
@ -393,7 +393,7 @@ public:
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
virtual void shortcutOverrideEvent(QWidget* widget, QKeyEvent* event) override;
|
||||
|
@ -9688,7 +9688,7 @@ public:
|
||||
inline void setLayoutItems(PDFInteger pageIndex, LayoutItems layoutItems) { m_layout.layoutItems[pageIndex] = std::move(layoutItems); }
|
||||
inline void setParagraphSettings(std::vector<xfa::XFA_ParagraphSettings> paragraphSettings) { m_layout.paragraphSettings = std::move(paragraphSettings); }
|
||||
|
||||
void draw(const QMatrix& pagePointToDevicePointMatrix,
|
||||
void draw(const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
QList<PDFRenderError>& errors,
|
||||
QPainter* painter);
|
||||
@ -11609,7 +11609,7 @@ std::vector<QSizeF> PDFXFAEngine::getPageSizes() const
|
||||
return m_impl->getPageSizes();
|
||||
}
|
||||
|
||||
void PDFXFAEngine::draw(const QMatrix& pagePointToDevicePointMatrix,
|
||||
void PDFXFAEngine::draw(const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
QList<PDFRenderError>& errors,
|
||||
QPainter* painter)
|
||||
@ -11694,7 +11694,7 @@ void PDFXFAEngineImpl::setDocument(const PDFModifiedDocument& document, PDFForm*
|
||||
}
|
||||
}
|
||||
|
||||
void PDFXFAEngineImpl::draw(const QMatrix& pagePointToDevicePointMatrix,
|
||||
void PDFXFAEngineImpl::draw(const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
QList<PDFRenderError>& errors,
|
||||
QPainter* painter)
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
/// \param page Page
|
||||
/// \param errors Error list (for reporting rendering errors)
|
||||
/// \param painter Painter
|
||||
void draw(const QMatrix& pagePointToDevicePointMatrix,
|
||||
void draw(const QTransform& pagePointToDevicePointMatrix,
|
||||
const PDFPage* page,
|
||||
QList<PDFRenderError>& errors,
|
||||
QPainter* painter);
|
||||
|
@ -46,5 +46,15 @@ add_library(Pdf4QtViewer SHARED
|
||||
pdf4qtviewer.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(Pdf4QtViewer PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::PrintSupport Qt6::TextToSpeech Qt6::Xml)
|
||||
add_compile_definitions(QT_INSTALL_DIRECTORY="${QT6_INSTALL_PREFIX}")
|
||||
|
||||
include(GenerateExportHeader)
|
||||
|
||||
GENERATE_EXPORT_HEADER(Pdf4QtViewer
|
||||
EXPORT_MACRO_NAME
|
||||
PDF4QTVIEWERLIBSHARED_EXPORT
|
||||
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtviewer_export.h")
|
||||
|
||||
target_link_libraries(Pdf4QtViewer PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::PrintSupport Qt6::TextToSpeech Qt6::Xml Qt6::OpenGLWidgets)
|
||||
target_include_directories(Pdf4QtViewer INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(Pdf4QtViewer PUBLIC ${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR})
|
||||
|
@ -194,7 +194,7 @@ void PDFAdvancedFindWidget::drawPage(QPainter* painter,
|
||||
pdf::PDFInteger pageIndex,
|
||||
const pdf::PDFPrecompiledPage* compiledPage,
|
||||
pdf::PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<pdf::PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
pdf::PDFInteger pageIndex,
|
||||
const pdf::PDFPrecompiledPage* compiledPage,
|
||||
pdf::PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<pdf::PDFRenderError>& errors) const override;
|
||||
|
||||
void setDocument(const pdf::PDFModifiedDocument& document);
|
||||
|
@ -49,7 +49,6 @@
|
||||
#include <QFileDialog>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QInputDialog>
|
||||
#include <QDesktopWidget>
|
||||
#include <QMainWindow>
|
||||
#include <QToolBar>
|
||||
#include <QXmlStreamWriter>
|
||||
@ -1376,7 +1375,7 @@ void PDFProgramController::readSettings(Settings settingsFlags)
|
||||
QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
|
||||
if (geometry.isEmpty())
|
||||
{
|
||||
QRect availableGeometry = QApplication::desktop()->availableGeometry(m_mainWindow);
|
||||
QRect availableGeometry = QApplication::primaryScreen()->availableGeometry();
|
||||
QRect windowRect(0, 0, availableGeometry.width() / 2, availableGeometry.height() / 2);
|
||||
windowRect = windowRect.translated(availableGeometry.center() - windowRect.center());
|
||||
m_mainWindow->setGeometry(windowRect);
|
||||
@ -1457,7 +1456,7 @@ void PDFProgramController::setPageLayout(pdf::PageLayout pageLayout)
|
||||
void PDFProgramController::updateActionsAvailability()
|
||||
{
|
||||
const bool isBusy = (m_futureWatcher && m_futureWatcher->isRunning()) || m_isBusy;
|
||||
const bool hasDocument = m_pdfDocument;
|
||||
const bool hasDocument = m_pdfDocument != nullptr;
|
||||
const bool hasValidDocument = !isBusy && hasDocument;
|
||||
bool canPrint = false;
|
||||
if (m_pdfDocument)
|
||||
|
@ -340,7 +340,6 @@ void PDFRenderToImagesDialog::on_buttonBox_clicked(QAbstractButton* button)
|
||||
imageWriter.setSubType(m_imageWriterSettings.getCurrentSubtype());
|
||||
imageWriter.setCompression(m_imageWriterSettings.getCompression());
|
||||
imageWriter.setQuality(m_imageWriterSettings.getQuality());
|
||||
imageWriter.setGamma(m_imageWriterSettings.getGamma());
|
||||
imageWriter.setOptimizedWrite(m_imageWriterSettings.hasOptimizedWrite());
|
||||
imageWriter.setProgressiveScanWrite(m_imageWriterSettings.hasProgressiveScanWrite());
|
||||
|
||||
|
@ -490,7 +490,7 @@ void PDFTextToSpeech::updatePlay()
|
||||
m_state = Ready;
|
||||
}
|
||||
}
|
||||
else if (state == QTextToSpeech::BackendError)
|
||||
else if (state == QTextToSpeech::Error)
|
||||
{
|
||||
m_state = Error;
|
||||
}
|
||||
|
@ -18,10 +18,16 @@
|
||||
#ifndef PDFVIEWERGLOBAL_H
|
||||
#define PDFVIEWERGLOBAL_H
|
||||
|
||||
#include <pdf4qtviewer_export.h>
|
||||
|
||||
#if !defined(PDF4QTVIEWERLIBSHARED_EXPORT)
|
||||
|
||||
#if defined(PDF4QTVIEWER_LIBRARY)
|
||||
# define PDF4QTVIEWERLIBSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define PDF4QTVIEWERLIBSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif // PDFVIEWERGLOBAL_H
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QStandardPaths>
|
||||
#include <QDockWidget>
|
||||
#include <QTreeView>
|
||||
@ -91,7 +90,7 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
|
||||
m_pageZoomSpinBox(nullptr),
|
||||
m_isLoadingUI(false),
|
||||
m_progress(new pdf::PDFProgress(this)),
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_taskbarButton(new QWinTaskbarButton(this)),
|
||||
m_progressTaskbarIndicator(nullptr),
|
||||
#endif
|
||||
@ -107,7 +106,7 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
|
||||
ui->mainToolBar->setWindowTitle(tr("Standard"));
|
||||
|
||||
// Initialize task bar progress
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_progressTaskbarIndicator = m_taskbarButton->progress();
|
||||
#endif
|
||||
|
||||
@ -356,7 +355,7 @@ void PDFViewerMainWindow::onProgressStarted(pdf::ProgressStartupInfo info)
|
||||
m_progressDialog->setCancelButton(nullptr);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_progressTaskbarIndicator->setRange(0, 100);
|
||||
m_progressTaskbarIndicator->reset();
|
||||
m_progressTaskbarIndicator->show();
|
||||
@ -380,7 +379,7 @@ void PDFViewerMainWindow::onProgressStep(int percentage)
|
||||
m_progressDialog->setValue(percentage);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_progressTaskbarIndicator->setValue(percentage);
|
||||
#endif
|
||||
}
|
||||
@ -393,7 +392,7 @@ void PDFViewerMainWindow::onProgressFinished()
|
||||
m_progressDialog->deleteLater();
|
||||
m_progressDialog = nullptr;
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_progressTaskbarIndicator->hide();
|
||||
#endif
|
||||
|
||||
@ -522,7 +521,7 @@ void PDFViewerMainWindow::closeEvent(QCloseEvent* event)
|
||||
void PDFViewerMainWindow::showEvent(QShowEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_taskbarButton->setWindow(windowHandle());
|
||||
#endif
|
||||
}
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <QFuture>
|
||||
#include <QTreeView>
|
||||
#include <QMainWindow>
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
#include <QWinTaskbarButton>
|
||||
#include <QWinTaskbarProgress>
|
||||
#endif
|
||||
@ -120,7 +120,7 @@ private:
|
||||
QDoubleSpinBox* m_pageZoomSpinBox;
|
||||
bool m_isLoadingUI;
|
||||
pdf::PDFProgress* m_progress;
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
QWinTaskbarButton* m_taskbarButton;
|
||||
QWinTaskbarProgress* m_progressTaskbarIndicator;
|
||||
#endif
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QStandardPaths>
|
||||
#include <QDockWidget>
|
||||
#include <QTreeView>
|
||||
@ -89,7 +88,7 @@ PDFViewerMainWindowLite::PDFViewerMainWindowLite(QWidget* parent) :
|
||||
m_pageZoomSpinBox(nullptr),
|
||||
m_isLoadingUI(false),
|
||||
m_progress(new pdf::PDFProgress(this)),
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_taskbarButton(new QWinTaskbarButton(this)),
|
||||
m_progressTaskbarIndicator(nullptr),
|
||||
#endif
|
||||
@ -105,7 +104,7 @@ PDFViewerMainWindowLite::PDFViewerMainWindowLite(QWidget* parent) :
|
||||
ui->mainToolBar->setWindowTitle(tr("Standard"));
|
||||
|
||||
// Initialize task bar progress
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_progressTaskbarIndicator = m_taskbarButton->progress();
|
||||
#endif
|
||||
|
||||
@ -278,7 +277,7 @@ void PDFViewerMainWindowLite::onProgressStarted(pdf::ProgressStartupInfo info)
|
||||
m_progressDialog->setCancelButton(nullptr);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_progressTaskbarIndicator->setRange(0, 100);
|
||||
m_progressTaskbarIndicator->reset();
|
||||
m_progressTaskbarIndicator->show();
|
||||
@ -302,7 +301,7 @@ void PDFViewerMainWindowLite::onProgressStep(int percentage)
|
||||
m_progressDialog->setValue(percentage);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_progressTaskbarIndicator->setValue(percentage);
|
||||
#endif
|
||||
}
|
||||
@ -315,7 +314,7 @@ void PDFViewerMainWindowLite::onProgressFinished()
|
||||
m_progressDialog->deleteLater();
|
||||
m_progressDialog = nullptr;
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_progressTaskbarIndicator->hide();
|
||||
#endif
|
||||
|
||||
@ -423,7 +422,7 @@ void PDFViewerMainWindowLite::closeEvent(QCloseEvent* event)
|
||||
void PDFViewerMainWindowLite::showEvent(QShowEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
m_taskbarButton->setWindow(windowHandle());
|
||||
#endif
|
||||
}
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <QFuture>
|
||||
#include <QTreeView>
|
||||
#include <QMainWindow>
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
#include <QWinTaskbarButton>
|
||||
#include <QWinTaskbarProgress>
|
||||
#endif
|
||||
@ -116,7 +116,7 @@ private:
|
||||
QDoubleSpinBox* m_pageZoomSpinBox;
|
||||
bool m_isLoadingUI;
|
||||
pdf::PDFProgress* m_progress;
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
QWinTaskbarButton* m_taskbarButton;
|
||||
QWinTaskbarProgress* m_progressTaskbarIndicator;
|
||||
#endif
|
||||
|
@ -19,7 +19,7 @@ add_executable(Pdf4QtViewerLite
|
||||
main.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(Pdf4QtViewerLite PRIVATE Pdf4QtViewer Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
target_link_libraries(Pdf4QtViewerLite PRIVATE Pdf4QtLib Pdf4QtViewer Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
||||
set_target_properties(Pdf4QtViewerLite PROPERTIES
|
||||
WIN32_EXECUTABLE ON
|
||||
|
@ -164,7 +164,7 @@ void AudioBookPlugin::drawPage(QPainter* painter,
|
||||
pdf::PDFInteger pageIndex,
|
||||
const pdf::PDFPrecompiledPage* compiledPage,
|
||||
pdf::PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<pdf::PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
pdf::PDFInteger pageIndex,
|
||||
const pdf::PDFPrecompiledPage* compiledPage,
|
||||
pdf::PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<pdf::PDFRenderError>& errors) const override;
|
||||
|
||||
// IDrawWidgetInputInterface interface
|
||||
|
@ -144,7 +144,7 @@ void DimensionsPlugin::drawPage(QPainter* painter,
|
||||
pdf::PDFInteger pageIndex,
|
||||
const pdf::PDFPrecompiledPage* compiledPage,
|
||||
pdf::PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<pdf::PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -306,7 +306,7 @@ void DimensionsPlugin::drawPage(QPainter* painter,
|
||||
painter->drawPoint(line1.p2());
|
||||
painter->drawPoint(line2.p2());
|
||||
|
||||
QMatrix textMatrix;
|
||||
QTransform textMatrix;
|
||||
textMatrix.translate(line1.x1(), line1.y1());
|
||||
textMatrix.rotate(-line1.angle() + dimension.getMeasuredValue() * 0.5);
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
pdf::PDFInteger pageIndex,
|
||||
const pdf::PDFPrecompiledPage* compiledPage,
|
||||
pdf::PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<pdf::PDFRenderError>& errors) const override;
|
||||
|
||||
private:
|
||||
|
@ -40,7 +40,7 @@ void DimensionTool::drawPage(QPainter* painter,
|
||||
pdf::PDFInteger pageIndex,
|
||||
const pdf::PDFPrecompiledPage* compiledPage,
|
||||
pdf::PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<pdf::PDFRenderError>& errors) const
|
||||
{
|
||||
Q_UNUSED(compiledPage);
|
||||
@ -68,7 +68,7 @@ void DimensionTool::drawPage(QPainter* painter,
|
||||
|
||||
if (!points.empty())
|
||||
{
|
||||
QMatrix inverted = pagePointToDevicePointMatrix.inverted();
|
||||
QTransform inverted = pagePointToDevicePointMatrix.inverted();
|
||||
QPointF adjustedPoint = adjustPagePoint(inverted.map(m_pickTool->getSnappedPoint()));
|
||||
painter->drawLine(pagePointToDevicePointMatrix.map(points.back()), pagePointToDevicePointMatrix.map(adjustedPoint));
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
pdf::PDFInteger pageIndex,
|
||||
const pdf::PDFPrecompiledPage* compiledPage,
|
||||
pdf::PDFTextLayoutGetter& layoutGetter,
|
||||
const QMatrix& pagePointToDevicePointMatrix,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<pdf::PDFRenderError>& errors) const override;
|
||||
|
||||
signals:
|
||||
|
@ -360,7 +360,7 @@ OutputPreviewDialog::RenderedImage OutputPreviewDialog::renderPage(const pdf::PD
|
||||
settings.flags.setFlag(pdf::PDFTransparencyRendererSettings::SeparationSimulation, m_inkMapperForRendering.getActiveSpotColorCount() > 0);
|
||||
settings.activeColorMask = activeColorMask;
|
||||
|
||||
QMatrix pagePointToDevicePoint = pdf::PDFRenderer::createPagePointToDevicePointMatrix(page, QRect(QPoint(0, 0), imageSize));
|
||||
QTransform pagePointToDevicePoint = pdf::PDFRenderer::createPagePointToDevicePointMatrix(page, QRect(QPoint(0, 0), imageSize));
|
||||
pdf::PDFDrawWidgetProxy* proxy = m_widget->getDrawWidgetProxy();
|
||||
pdf::PDFCMSPointer cms = proxy->getCMSManager()->getCurrentCMS();
|
||||
pdf::PDFTransparencyRenderer renderer(page, m_document, proxy->getFontCache(), cms.data(), proxy->getOptionalContentActivity(),
|
||||
|
@ -121,7 +121,7 @@ void RedactPlugin::onRedactTextSelectionTriggered()
|
||||
|
||||
QPolygonF quadrilaterals;
|
||||
pdf::PDFTextSelectionPainter textSelectionPainter(&selectedText);
|
||||
QPainterPath path = textSelectionPainter.prepareGeometry(pageIndex, textLayoutGetter, QMatrix(), &quadrilaterals);
|
||||
QPainterPath path = textSelectionPainter.prepareGeometry(pageIndex, textLayoutGetter, QTransform(), &quadrilaterals);
|
||||
|
||||
if (!path.isEmpty())
|
||||
{
|
||||
|
@ -296,7 +296,7 @@ void SignaturePlugin::onSignElectronically()
|
||||
QPainter* painter = pageContentStreamBuilder.begin(page->getPageReference());
|
||||
QList<pdf::PDFRenderError> errors;
|
||||
pdf::PDFTextLayoutGetter nullGetter(nullptr, pageIndex);
|
||||
m_scene.drawElements(painter, pageIndex, nullGetter, QMatrix(), nullptr, errors);
|
||||
m_scene.drawElements(painter, pageIndex, nullGetter, QTransform(), nullptr, errors);
|
||||
pageContentStreamBuilder.end(painter);
|
||||
modifier.markPageContentsChanged();
|
||||
}
|
||||
@ -365,7 +365,7 @@ void SignaturePlugin::onSignDigitally()
|
||||
QPainter* painter = contentBuilder.begin();
|
||||
QList<pdf::PDFRenderError> errors;
|
||||
pdf::PDFTextLayoutGetter nullGetter(nullptr, pageIndex);
|
||||
m_scene.drawPage(painter, pageIndex, nullptr, nullGetter, QMatrix(), errors);
|
||||
m_scene.drawPage(painter, pageIndex, nullptr, nullGetter, QTransform(), errors);
|
||||
pdf::PDFContentStreamBuilder::ContentStream contentStream = contentBuilder.end(painter);
|
||||
|
||||
QRectF boundingRect = m_scene.getBoundingBox(pageIndex);
|
||||
|
@ -19,7 +19,7 @@ add_executable(Pdf4QtViewerProfi
|
||||
main.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(Pdf4QtViewerProfi PRIVATE Pdf4QtViewer Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
target_link_libraries(Pdf4QtViewerProfi PRIVATE Pdf4QtLib Pdf4QtViewer Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
||||
set_target_properties(Pdf4QtViewerProfi PROPERTIES
|
||||
WIN32_EXECUTABLE ON
|
||||
|
@ -46,4 +46,4 @@ add_executable(PdfTool
|
||||
pdftoolxml.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(PdfTool PRIVATE Pdf4QtLib Qt6::Core)
|
||||
target_link_libraries(PdfTool PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Xml)
|
||||
|
@ -18,11 +18,11 @@
|
||||
#include "pdfoutputformatter.h"
|
||||
|
||||
#include <QMutex>
|
||||
#include <QTextCodec>
|
||||
#include <QTextStream>
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QCoreApplication>
|
||||
#include <QDataStream>
|
||||
#include <QStringEncoder>
|
||||
|
||||
#include <stack>
|
||||
|
||||
@ -94,7 +94,7 @@ private:
|
||||
class PDFXmlOutputFormatterImpl : public PDFOutputFormatterImpl
|
||||
{
|
||||
public:
|
||||
PDFXmlOutputFormatterImpl(QString codec);
|
||||
PDFXmlOutputFormatterImpl();
|
||||
|
||||
virtual void beginElement(PDFOutputFormatter::Element type, QString name, QString description, Qt::Alignment alignment, int reference) override;
|
||||
virtual void endElement() override;
|
||||
@ -112,7 +112,7 @@ private:
|
||||
class PDFHtmlOutputFormatterImpl : public PDFOutputFormatterImpl
|
||||
{
|
||||
public:
|
||||
PDFHtmlOutputFormatterImpl(QString codecName);
|
||||
PDFHtmlOutputFormatterImpl();
|
||||
|
||||
virtual void beginElement(PDFOutputFormatter::Element type, QString name, QString description, Qt::Alignment alignment, int reference) override;
|
||||
virtual void endElement() override;
|
||||
@ -311,17 +311,14 @@ const PDFTextOutputFormatterImpl::TableCell& PDFTextOutputFormatterImpl::getTabl
|
||||
return dummy;
|
||||
}
|
||||
|
||||
PDFHtmlOutputFormatterImpl::PDFHtmlOutputFormatterImpl(QString codecName) :
|
||||
PDFHtmlOutputFormatterImpl::PDFHtmlOutputFormatterImpl() :
|
||||
m_string(),
|
||||
m_streamWriter(&m_string),
|
||||
m_depth(0),
|
||||
m_headerDepth(1),
|
||||
m_elementStack()
|
||||
{
|
||||
if (QTextCodec* codec = QTextCodec::codecForName(codecName.toLatin1()))
|
||||
{
|
||||
m_streamWriter.setCodec(codec);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PDFHtmlOutputFormatterImpl::beginElement(PDFOutputFormatter::Element type, QString name, QString description, Qt::Alignment alignment, int reference)
|
||||
@ -489,7 +486,7 @@ void PDFHtmlOutputFormatterImpl::endl()
|
||||
m_streamWriter.writeEndElement();
|
||||
}
|
||||
|
||||
PDFXmlOutputFormatterImpl::PDFXmlOutputFormatterImpl(QString codecName) :
|
||||
PDFXmlOutputFormatterImpl::PDFXmlOutputFormatterImpl() :
|
||||
m_string(),
|
||||
m_streamWriter(&m_string),
|
||||
m_depth(0)
|
||||
@ -497,11 +494,6 @@ PDFXmlOutputFormatterImpl::PDFXmlOutputFormatterImpl(QString codecName) :
|
||||
m_streamWriter.setAutoFormatting(true);
|
||||
m_streamWriter.setAutoFormattingIndent(2);
|
||||
|
||||
if (QTextCodec* codec = QTextCodec::codecForName(codecName.toLatin1()))
|
||||
{
|
||||
m_streamWriter.setCodec(codec);
|
||||
}
|
||||
|
||||
m_namespace = "https://github.com/JakubMelka/PDF4QT";
|
||||
m_prefix = "pdftool";
|
||||
}
|
||||
@ -596,7 +588,7 @@ QString PDFXmlOutputFormatterImpl::getString() const
|
||||
return m_string;
|
||||
}
|
||||
|
||||
PDFOutputFormatter::PDFOutputFormatter(Style style, QString codecName) :
|
||||
PDFOutputFormatter::PDFOutputFormatter(Style style) :
|
||||
m_impl(nullptr)
|
||||
{
|
||||
switch (style)
|
||||
@ -606,11 +598,11 @@ PDFOutputFormatter::PDFOutputFormatter(Style style, QString codecName) :
|
||||
break;
|
||||
|
||||
case Style::Xml:
|
||||
m_impl = new PDFXmlOutputFormatterImpl(codecName);
|
||||
m_impl = new PDFXmlOutputFormatterImpl();
|
||||
break;
|
||||
|
||||
case Style::Html:
|
||||
m_impl = new PDFHtmlOutputFormatterImpl(codecName);
|
||||
m_impl = new PDFHtmlOutputFormatterImpl();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -642,7 +634,7 @@ QString PDFOutputFormatter::getString() const
|
||||
return m_impl->getString();
|
||||
}
|
||||
|
||||
void PDFConsole::writeText(QString text, QString codecName)
|
||||
void PDFConsole::writeText(QString text, QStringConverter::Encoding encoding)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
HANDLE outputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
@ -650,18 +642,10 @@ void PDFConsole::writeText(QString text, QString codecName)
|
||||
{
|
||||
// Write console failed. This can happen only, if outputHandle is not handle
|
||||
// to console screen buffer, but, for example a file or a pipe.
|
||||
QTextCodec* codec = QTextCodec::codecForName(codecName.toLatin1());
|
||||
if (!codec)
|
||||
{
|
||||
codec = QTextCodec::codecForName("UTF-8");
|
||||
writeError(QString("No codec found for '%1'. Defaulting to text codec '%2'.").arg(codecName, QString::fromLatin1(codec->name())), codecName);
|
||||
}
|
||||
|
||||
if (codec)
|
||||
{
|
||||
QByteArray encodedData = codec->fromUnicode(text);
|
||||
WriteFile(outputHandle, encodedData.constData(), encodedData.size(), nullptr, nullptr);
|
||||
}
|
||||
QStringEncoder encoder(encoding);
|
||||
QByteArray encodedData = encoder.encode(text);
|
||||
WriteFile(outputHandle, encodedData.constData(), encodedData.size(), nullptr, nullptr);
|
||||
}
|
||||
#else
|
||||
QTextStream(stdout) << text;
|
||||
@ -670,7 +654,7 @@ void PDFConsole::writeText(QString text, QString codecName)
|
||||
|
||||
QMutex s_writeErrorMutex;
|
||||
|
||||
void PDFConsole::writeError(QString text, QString codecName)
|
||||
void PDFConsole::writeError(QString text, QStringConverter::Encoding encoding)
|
||||
{
|
||||
if (text.isEmpty())
|
||||
{
|
||||
@ -687,17 +671,10 @@ void PDFConsole::writeError(QString text, QString codecName)
|
||||
{
|
||||
// Write console failed. This can happen only, if outputHandle is not handle
|
||||
// to console screen buffer, but, for example a file or a pipe.
|
||||
QTextCodec* codec = QTextCodec::codecForName(codecName.toLatin1());
|
||||
if (!codec)
|
||||
{
|
||||
codec = QTextCodec::codecForName("UTF-8");
|
||||
}
|
||||
|
||||
if (codec)
|
||||
{
|
||||
QByteArray encodedData = codec->fromUnicode(text);
|
||||
WriteFile(outputHandle, encodedData.constData(), encodedData.size(), nullptr, nullptr);
|
||||
}
|
||||
QStringEncoder encoder(encoding);
|
||||
QByteArray encodedData = encoder.encode(text);
|
||||
WriteFile(outputHandle, encodedData.constData(), encodedData.size(), nullptr, nullptr);
|
||||
}
|
||||
#else
|
||||
QTextStream stream(stdout);
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define PDFOUTPUTFORMATTER_H
|
||||
|
||||
#include <QString>
|
||||
#include <QStringConverter>
|
||||
|
||||
namespace pdftool
|
||||
{
|
||||
@ -37,7 +38,7 @@ public:
|
||||
Html
|
||||
};
|
||||
|
||||
explicit PDFOutputFormatter(Style style, QString codecName);
|
||||
explicit PDFOutputFormatter(Style style);
|
||||
~PDFOutputFormatter();
|
||||
|
||||
enum class Element
|
||||
@ -97,10 +98,10 @@ class PDFConsole
|
||||
public:
|
||||
|
||||
/// Writes text to the console
|
||||
static void writeText(QString text, QString codecName);
|
||||
static void writeText(QString text, QStringConverter::Encoding encoding);
|
||||
|
||||
/// Writes error to the console
|
||||
static void writeError(QString text, QString codecName);
|
||||
static void writeError(QString text, QStringConverter::Encoding encoding);
|
||||
|
||||
/// Writes binary data to the console
|
||||
static void writeData(const QByteArray& data);
|
||||
|
@ -59,7 +59,7 @@ QString PDFToolHelpApplication::getStandardString(StandardString standardString)
|
||||
|
||||
int PDFToolHelpApplication::execute(const PDFToolOptions& options)
|
||||
{
|
||||
PDFOutputFormatter formatter(options.outputStyle, options.outputCodec);
|
||||
PDFOutputFormatter formatter(options.outputStyle);
|
||||
formatter.beginDocument("help", PDFToolTranslationContext::tr("PDFTool help"));
|
||||
formatter.endl();
|
||||
|
||||
@ -114,7 +114,7 @@ int PDFToolHelpApplication::execute(const PDFToolOptions& options)
|
||||
formatter.writeText("header", PDFToolTranslationContext::tr("When you redirect console to a file, then specific codec is used to transform output text to target encoding. UTF-8 encoding is used by default. For XML output, you should use only UTF-8 codec. Available codecs:"));
|
||||
formatter.endl();
|
||||
|
||||
QList<QByteArray> codecs = QTextCodec::availableCodecs();
|
||||
QList<QByteArray> codecs = getAvailableEncodings();
|
||||
QStringList codecNames;
|
||||
for (const QByteArray& codecName : codecs)
|
||||
{
|
||||
@ -122,7 +122,7 @@ int PDFToolHelpApplication::execute(const PDFToolOptions& options)
|
||||
}
|
||||
formatter.writeText("codecs", codecNames.join(", "));
|
||||
formatter.endl();
|
||||
formatter.writeText("default-codec", PDFToolTranslationContext::tr("Suggested codec: UTF-8 or %1").arg(QString::fromLatin1(QTextCodec::codecForLocale()->name())));
|
||||
formatter.writeText("default-codec", PDFToolTranslationContext::tr("Suggested codec: UTF-8 or %1").arg(QString::fromLatin1(getDefaultEncoding())));
|
||||
|
||||
formatter.endHeader();
|
||||
|
||||
@ -373,7 +373,7 @@ PDFToolOptions PDFToolAbstractApplication::getOptions(QCommandLineParser* parser
|
||||
options.outputStyle = PDFOutputFormatter::Style::Text;
|
||||
}
|
||||
|
||||
options.outputCodec = parser->value("text-codec");
|
||||
options.outputCodec = getEncoding(parser->value("text-codec"));
|
||||
}
|
||||
|
||||
if (optionFlags.testFlag(DateFormat))
|
||||
@ -1042,6 +1042,40 @@ bool PDFToolAbstractApplication::readDocument(const PDFToolOptions& options, pdf
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<QByteArray> PDFToolAbstractApplication::getAvailableEncodings()
|
||||
{
|
||||
QList<QByteArray> encodings;
|
||||
encodings << "utf8";
|
||||
encodings << "latin1";
|
||||
encodings << "system";
|
||||
return encodings;
|
||||
}
|
||||
|
||||
QByteArray PDFToolAbstractApplication::getDefaultEncoding()
|
||||
{
|
||||
return getAvailableEncodings().front();
|
||||
}
|
||||
|
||||
QStringConverter::Encoding PDFToolAbstractApplication::getEncoding(const QString& encodingName)
|
||||
{
|
||||
if (encodingName == "utf8")
|
||||
{
|
||||
return QStringConverter::Utf8;
|
||||
}
|
||||
|
||||
if (encodingName == "latin1")
|
||||
{
|
||||
return QStringConverter::Latin1;
|
||||
}
|
||||
|
||||
if (encodingName == "system")
|
||||
{
|
||||
return QStringConverter::System;
|
||||
}
|
||||
|
||||
return QStringConverter::System;
|
||||
}
|
||||
|
||||
PDFToolAbstractApplication* PDFToolApplicationStorage::getApplicationByCommand(const QString& command)
|
||||
{
|
||||
for (PDFToolAbstractApplication* application : getInstance()->m_applications)
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
#include <QCoreApplication>
|
||||
#include <QStringConverter>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -54,7 +55,7 @@ struct PDFToolOptions
|
||||
|
||||
// For option 'ConsoleFormat'
|
||||
PDFOutputFormatter::Style outputStyle = PDFOutputFormatter::Style::Text;
|
||||
QString outputCodec = "UTF-8";
|
||||
QStringConverter::Encoding outputCodec = QStringConverter::Utf8;
|
||||
|
||||
// For option 'DateFormat'
|
||||
DateFormat outputDateFormat = LocaleShortDate;
|
||||
@ -271,6 +272,15 @@ protected:
|
||||
/// \param[out] sourceData Pointer, to which source data are stored
|
||||
/// \param authorizeOwnerOnly Require to authorize as owner
|
||||
bool readDocument(const PDFToolOptions& options, pdf::PDFDocument& document, QByteArray* sourceData, bool authorizeOwnerOnly);
|
||||
|
||||
/// Returns a list of available encodings
|
||||
static QList<QByteArray> getAvailableEncodings();
|
||||
|
||||
/// Returns default encoding
|
||||
static QByteArray getDefaultEncoding();
|
||||
|
||||
/// Converts string to encoding
|
||||
static QStringConverter::Encoding getEncoding(const QString& encodingName);
|
||||
};
|
||||
|
||||
/// This class stores information about all applications available. Application
|
||||
|
@ -110,7 +110,7 @@ int PDFToolAttachmentsApplication::execute(const PDFToolOptions& options)
|
||||
if (savedFileCount == 0)
|
||||
{
|
||||
// Just print a list of embedded files
|
||||
PDFOutputFormatter formatter(options.outputStyle, options.outputCodec);
|
||||
PDFOutputFormatter formatter(options.outputStyle);
|
||||
formatter.beginDocument("attachments", PDFToolTranslationContext::tr("Attached files of document %1").arg(options.document));
|
||||
formatter.endl();
|
||||
|
||||
|
@ -228,7 +228,7 @@ int PDFToolAudioBookBase::showVoiceList(const PDFToolOptions& options)
|
||||
PDFVoiceInfoList voices;
|
||||
int result = fillVoices(options, voices, false);
|
||||
|
||||
PDFOutputFormatter formatter(options.outputStyle, options.outputCodec);
|
||||
PDFOutputFormatter formatter(options.outputStyle);
|
||||
formatter.beginDocument("voices", PDFToolTranslationContext::tr("Available voices for given settings:"));
|
||||
formatter.endl();
|
||||
|
||||
|
@ -63,7 +63,7 @@ int PDFToolCertStore::execute(const PDFToolOptions& options)
|
||||
certificates.insert(certificates.end(), std::make_move_iterator(systemCertificates.begin()), std::make_move_iterator(systemCertificates.end()));
|
||||
}
|
||||
|
||||
PDFOutputFormatter formatter(options.outputStyle, options.outputCodec);
|
||||
PDFOutputFormatter formatter(options.outputStyle);
|
||||
formatter.beginDocument("cert-store", PDFToolTranslationContext::tr("Certificates used in signature verification"));
|
||||
formatter.endl();
|
||||
|
||||
|
@ -46,7 +46,7 @@ QString PDFToolColorProfiles::getStandardString(StandardString standardString) c
|
||||
|
||||
int PDFToolColorProfiles::execute(const PDFToolOptions& options)
|
||||
{
|
||||
PDFOutputFormatter formatter(options.outputStyle, options.outputCodec);
|
||||
PDFOutputFormatter formatter(options.outputStyle);
|
||||
formatter.beginDocument("color-profiles", PDFToolTranslationContext::tr("Available Color Profiles"));
|
||||
formatter.endl();
|
||||
|
||||
|
@ -89,7 +89,7 @@ int PDFToolDiff::execute(const PDFToolOptions& options)
|
||||
const pdf::PDFDiffResult& result = diff.getResult();
|
||||
if (result.getResult())
|
||||
{
|
||||
PDFOutputFormatter formatter(options.outputStyle, options.outputCodec);
|
||||
PDFOutputFormatter formatter(options.outputStyle);
|
||||
formatter.beginDocument("diff", PDFToolTranslationContext::tr("Difference Report").arg(options.document));
|
||||
formatter.endl();
|
||||
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
const pdf::PDFFontCache* fontCache,
|
||||
const pdf::PDFCMS* cms,
|
||||
const pdf::PDFOptionalContentActivity* optionalContentActivity,
|
||||
QMatrix pagePointToDevicePointMatrix,
|
||||
QTransform pagePointToDevicePointMatrix,
|
||||
const pdf::PDFMeshQualitySettings& meshQualitySettings,
|
||||
pdf::PDFInteger pageIndex,
|
||||
PDFToolFetchImages* tool) :
|
||||
@ -173,7 +173,7 @@ int PDFToolFetchImages::execute(const PDFToolOptions& options)
|
||||
Q_ASSERT(page);
|
||||
|
||||
PDFImageContentExtractorProcessor processor(page, &document, &fontCache, cms.data(), &optionalContentActivity,
|
||||
QMatrix(), meshQualitySettings, pageIndex, this);
|
||||
QTransform(), meshQualitySettings, pageIndex, this);
|
||||
processor.processContents();
|
||||
};
|
||||
|
||||
@ -187,7 +187,7 @@ int PDFToolFetchImages::execute(const PDFToolOptions& options)
|
||||
std::sort(m_images.begin(), m_images.end(), comparator);
|
||||
|
||||
// Write information about images
|
||||
PDFOutputFormatter formatter(options.outputStyle, options.outputCodec);
|
||||
PDFOutputFormatter formatter(options.outputStyle);
|
||||
formatter.beginDocument("images", PDFToolTranslationContext::tr("Images fetched from document %1").arg(options.document));
|
||||
formatter.endl();
|
||||
|
||||
@ -235,7 +235,6 @@ int PDFToolFetchImages::execute(const PDFToolOptions& options)
|
||||
imageWriter.setSubType(options.imageWriterSettings.getCurrentSubtype());
|
||||
imageWriter.setCompression(options.imageWriterSettings.getCompression());
|
||||
imageWriter.setQuality(options.imageWriterSettings.getQuality());
|
||||
imageWriter.setGamma(options.imageWriterSettings.getGamma());
|
||||
imageWriter.setOptimizedWrite(options.imageWriterSettings.hasOptimizedWrite());
|
||||
imageWriter.setProgressiveScanWrite(options.imageWriterSettings.hasProgressiveScanWrite());
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user