7#include <QLoggingCategory>
9#include <QtGui/qimageiohandler.h>
14#include <QtGui/private/qoutlinemapper_p.h>
22#if !defined(QT_SVG_SIZE_LIMIT)
23# define QT_SVG_SIZE_LIMIT QT_RASTER_COORD_LIMIT
29 m_displayMode(BlockMode)
53 QRectF boundsRect = xf.mapRect(localRect);
56 proxy = filterNode->applyFilter(
this,
proxy,
p, localRect);
59 localRect =
p->transform().inverted().mapRect(boundsRect);
80 if (
Q_UNLIKELY(lcSvgTiming().isDebugEnabled()))
81 qCDebug(lcSvgTiming) <<
"Drawing" <<
typeName() <<
"took" << (qtSvgTimer.nsecsElapsed() / 1000000.0f) <<
"ms";
87 qreal oldOpacity =
p->opacity();
89 QPen oldPen =
p->pen();
91 p->setOpacity(oldOpacity *
states.fillOpacity);
99 p->setOpacity(oldOpacity *
states.strokeOpacity);
104 p->setBrush(oldBrush);
106 p->setOpacity(oldOpacity);
118 p->drawImage(boundsRect,
proxy);
126 qCWarning(lcSvgDraw) <<
"The requested buffer size is too big, ignoring";
129 proxy.setOffset(boundsRect.topLeft());
132 proxyPainter.setPen(
p->pen());
133 proxyPainter.setBrush(
p->brush());
134 proxyPainter.setFont(
p->font());
135 proxyPainter.translate(-boundsRect.topLeft());
136 proxyPainter.setTransform(
p->transform(),
true);
137 proxyPainter.setRenderHints(
p->renderHints());
149 proxyPainter.resetTransform();
176 switch (prop->
type()) {
195 if (doc && !
id.isEmpty())
201 if (doc && !
id.isEmpty())
207 if (doc && !
id.isEmpty())
227 qDebug(
"QSvgNode: Trying to append unknown property!");
340 return QRectF(0, 0, 0, 0);
346 return m_cachedBounds;
356 QStack<QSvgNode*> parentApplyStack;
359 parentApplyStack.push(
parent);
363 for (
int i = parentApplyStack.size() - 1;
i >= 0; --
i)
369 return m_cachedBounds;
424 m_requiredFeatures = lst;
429 return m_requiredFeatures;
434 m_requiredExtensions = lst;
439 return m_requiredExtensions;
444 m_requiredLanguages = lst;
449 return m_requiredLanguages;
454 m_requiredFormats = lst;
459 return m_requiredFormats;
464 m_requiredFonts = lst;
469 return m_requiredFonts;
478 if (m_parent && visible && !m_parent->
isVisible())
538 return m_markerStartId;
543 m_markerStartId =
str;
550 return !m_markerStartId.
isEmpty();
555 return m_markerMidId;
567 return !m_markerMidId.
isEmpty();
572 return m_markerEndId;
584 return !m_markerEndId.
isEmpty();
596 m_displayMode =
mode;
601 return m_displayMode;
606 const QPen &pen =
p->pen();
640 qCWarning(lcSvgDraw) <<
"Shape of type" <<
type() <<
"ignored because it will take too long to rasterize (bounding rect=" << brect <<
")."
641 <<
"Set QT_SVG_DISABLE_SIZE_LIMIT=1 to disable this check.";
Qt::BrushStyle style() const
Returns the brush style.
void start() noexcept
\typealias QElapsedTimer::Duration Synonym for std::chrono::nanoseconds.
int pixelSize() const
Returns the pixel size of the font if it was set with setPixelSize().
int pointSize() const
Returns the point size of the font.
void setPointSizeF(qreal)
Sets the point size to pointSize.
static bool allocateImage(QSize size, QImage::Format format, QImage *image)
bool isEmpty() const noexcept
void append(parameter_type t)
The QPainter class performs low-level painting on widgets and other paint devices.
@ CompositionMode_DestinationOut
qreal widthF() const
Returns the pen width with floating point precision.
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
void setMiterLimit(qreal limit)
Sets the miter limit of this pen to the given limit.
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
Qt::PenStyle style() const
Returns the pen style.
\inmodule QtCore\reentrant
constexpr bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
QString & remove(qsizetype i, qsizetype len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Type type() const override
QImage drawIntoBuffer(QPainter *p, QSvgExtraStates &states, const QRect &boundsRect)
void setMarkerMidId(const QString &str)
bool hasAnyMarker() const
void setRequiredFeatures(const QStringList &lst)
void setMaskId(const QString &str)
QString markerStartId() const
void setXmlClass(const QString &str)
void revertStyle(QPainter *p, QSvgExtraStates &states) const
void applyBufferToCanvas(QPainter *p, QImage proxy) const
bool hasMarkerMid() const
virtual bool separateFillStroke() const
static qreal strokeWidth(QPainter *p)
void applyMaskToBuffer(QImage *proxy, QImage mask) const
void setMarkerEndId(const QString &str)
QString markerMidId() const
bool hasMarkerEnd() const
bool isDescendantOf(const QSvgNode *parent) const
QSvgStyleProperty * styleProperty(QSvgStyleProperty::Type type) const
void setRequiredExtensions(const QStringList &lst)
void setMarkerStartId(const QString &str)
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
void setFilterId(const QString &str)
void setRequiredFonts(const QStringList &lst)
const QStringList & requiredLanguages() const
void setNodeId(const QString &i)
QSvgNode * parent() const
void applyStyle(QPainter *p, QSvgExtraStates &states) const
bool hasMarkerStart() const
const QStringList & requiredFonts() const
const QStringList & requiredFormats() const
void applyStyleRecursive(QPainter *p, QSvgExtraStates &states) const
DisplayMode displayMode() const
void appendStyleProperty(QSvgStyleProperty *prop, const QString &id)
void fillThenStroke(QPainter *p, QSvgExtraStates &states)
void setDisplayMode(DisplayMode display)
virtual bool shouldDrawNode(QPainter *p, QSvgExtraStates &states) const
void draw(QPainter *p, QSvgExtraStates &states)
QString markerEndId() const
virtual QRectF fastBounds(QPainter *p, QSvgExtraStates &states) const
QRectF transformedBounds() const
QSvgNode(QSvgNode *parent=0)
static void initPainter(QPainter *p)
const QStringList & requiredFeatures() const
void setRequiredLanguages(const QStringList &lst)
QSvgTinyDocument * document() const
virtual Type type() const =0
virtual void drawCommand(QPainter *p, QSvgExtraStates &states)=0
void setVisible(bool visible)
const QStringList & requiredExtensions() const
void setRequiredFormats(const QStringList &lst)
void drawWithMask(QPainter *p, QSvgExtraStates &states, const QImage &mask, const QRect &boundsRect)
virtual Type type() const =0
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states)
QSvgRefCounter< QSvgSolidColorStyle > solidColor
QSvgRefCounter< QSvgOpacityStyle > opacity
QSvgRefCounter< QSvgPatternStyle > pattern
QSvgRefCounter< QSvgViewportFillStyle > viewportFill
QList< QSvgRefCounter< QSvgAnimateTransform > > animateTransforms
QSvgRefCounter< QSvgFontStyle > font
QSvgRefCounter< QSvgTransformStyle > transform
QSvgRefCounter< QSvgStrokeStyle > stroke
QSvgRefCounter< QSvgAnimateColor > animateColor
QSvgRefCounter< QSvgQualityStyle > quality
QSvgRefCounter< QSvgFillStyle > fill
QSvgRefCounter< QSvgCompOpStyle > compop
QSvgRefCounter< QSvgGradientStyle > gradient
void revert(QPainter *p, QSvgExtraStates &states)
QSvgNode * namedNode(const QString &id) const
void addNamedStyle(const QString &id, QSvgPaintStyleProperty *style)
QSvgPaintStyleProperty * namedStyle(const QString &id) const
Combined button and popup list for selecting options.
#define Q_LOGGING_CATEGORY(name,...)
#define qCWarning(category,...)
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
#define QStringLiteral(str)
#define QT_SVG_SIZE_LIMIT
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
bool testFlag(MaskType mask, FlagType flag)
\inmodule QtCore \reentrant