mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Finalization of axial shading
This commit is contained in:
@ -16,6 +16,7 @@
|
||||
// along with PDFForQt. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfpainter.h"
|
||||
#include "pdfpattern.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
@ -31,8 +32,7 @@ PDFPainter::PDFPainter(QPainter* painter,
|
||||
const PDFOptionalContentActivity* optionalContentActivity) :
|
||||
PDFPageContentProcessor(page, document, fontCache, optionalContentActivity, pagePointToDevicePointMatrix),
|
||||
m_painter(painter),
|
||||
m_features(features),
|
||||
m_pagePointToDevicePointMatrix(pagePointToDevicePointMatrix)
|
||||
m_features(features)
|
||||
{
|
||||
Q_ASSERT(painter);
|
||||
Q_ASSERT(pagePointToDevicePointMatrix.isInvertible());
|
||||
@ -60,6 +60,24 @@ void PDFPainter::performPathPainting(const QPainterPath& path, bool stroke, bool
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Temporary
|
||||
if (const PDFPatternColorSpace* ps = dynamic_cast<const PDFPatternColorSpace*>(getGraphicState()->getFillColorSpace()))
|
||||
{
|
||||
m_painter->save();
|
||||
const PDFAxialShading* pattern = (PDFAxialShading*)ps->getPattern();
|
||||
m_painter->setClipPath(path, Qt::IntersectClip);
|
||||
|
||||
PDFMeshQualitySettings settings;
|
||||
settings.deviceSpaceMeshingArea = getPageBoundingRectDeviceSpace();
|
||||
settings.userSpaceToDeviceSpaceMatrix = getPatternBaseMatrix();
|
||||
settings.initDefaultResolution();
|
||||
|
||||
PDFMesh mesh = pattern->createMesh(settings);
|
||||
mesh.paint(m_painter);
|
||||
m_painter->restore();
|
||||
return;
|
||||
}
|
||||
|
||||
// Set antialiasing
|
||||
const bool antialiasing = (text && m_features.testFlag(PDFRenderer::TextAntialiasing)) || (!text && m_features.testFlag(PDFRenderer::Antialiasing));
|
||||
m_painter->setRenderHint(QPainter::Antialiasing, antialiasing);
|
||||
@ -153,7 +171,7 @@ void PDFPainter::performUpdateGraphicsState(const PDFPageContentProcessorState&
|
||||
// If current transformation matrix has changed, then update it
|
||||
if (flags.testFlag(PDFPageContentProcessorState::StateCurrentTransformationMatrix))
|
||||
{
|
||||
m_painter->setWorldMatrix(state.getCurrentTransformationMatrix() * m_pagePointToDevicePointMatrix, false);
|
||||
m_painter->setWorldMatrix(getCurrentWorldMatrix(), false);
|
||||
}
|
||||
|
||||
if (flags.testFlag(PDFPageContentProcessorState::StateStrokeColor) ||
|
||||
|
Reference in New Issue
Block a user