Snapper, some code for screenshot tool

This commit is contained in:
Jakub Melka
2020-02-23 18:59:54 +01:00
parent e9bad256dc
commit a27216e752
18 changed files with 636 additions and 58 deletions

View File

@@ -402,6 +402,7 @@ PDFPrecompiledPageGenerator::PDFPrecompiledPageGenerator(PDFPrecompiledPage* pre
m_precompiledPage(precompiledPage)
{
m_precompiledPage->setPaperColor(cms->getPaperColor());
m_precompiledPage->getSnapInfo()->addPageMediaBox(page->getRotatedMediaBox());
}
void PDFPrecompiledPageGenerator::performPathPainting(const QPainterPath& path, bool stroke, bool fill, bool text, Qt::FillRule fillRule)
@@ -428,6 +429,17 @@ void PDFPrecompiledPageGenerator::performImagePainting(const QImage& image)
return;
}
// Add snap info for image to the snapper
QMatrix matrix = getCurrentWorldMatrix();
PDFSnapInfo* snapInfo = m_precompiledPage->getSnapInfo();
snapInfo->addImage({
matrix.map(QPointF(0.0, 0.0)),
matrix.map(QPointF(1.0, 0.0)),
matrix.map(QPointF(1.0, 1.0)),
matrix.map(QPointF(0.0, 1.0)),
matrix.map(QPointF(0.5, 0.5)),
});
if (isTransparencyGroupActive())
{
PDFReal alpha = getEffectiveFillingAlpha();