24 textAnchor(
Qt::AlignLeft),
26 fillRule(
Qt::WindingFill),
39 Q_ASSERT(!
"This should not be called!");
44 Q_ASSERT(!
"This should not be called!");
51 , m_imageRenderingSet(0)
57 m_imageRendering =
hint;
58 m_imageRenderingSet = 1;
63 m_oldImageRendering =
states.imageRendering;
64 if (m_imageRenderingSet) {
65 states.imageRendering = m_imageRendering;
67 if (m_imageRenderingSet) {
80 if (m_imageRenderingSet) {
81 states.imageRendering = m_oldImageRendering;
93 , m_fillRule(
Qt::WindingFill)
94 , m_oldFillRule(
Qt::WindingFill)
97 , m_gradientResolved(1)
112 m_fillOpacitySet = 1;
113 m_fillOpacity = opacity;
124 m_fill = std::move(
brush);
131 m_oldFill =
p->brush();
132 m_oldFillRule =
states.fillRule;
133 m_oldFillOpacity =
states.fillOpacity;
136 states.fillRule = m_fillRule;
143 if (m_fillOpacitySet)
144 states.fillOpacity = m_fillOpacity;
149 if (m_fillOpacitySet)
150 states.fillOpacity = m_oldFillOpacity;
152 p->setBrush(m_oldFill);
154 states.fillRule = m_oldFillRule;
158 : m_viewportFill(
brush)
164 m_oldFill =
p->brush();
165 p->setBrush(m_viewportFill);
170 p->setBrush(m_oldFill);
199 m_oldQFont =
p->font();
200 m_oldSvgFont =
states.svgFont;
201 m_oldTextAnchor =
states.textAnchor;
202 m_oldWeight =
states.fontWeight;
205 states.textAnchor = m_textAnchor;
209 states.svgFont = m_svgFont;
225 }
else if (m_weight ==
LIGHTER) {
228 states.fontWeight = m_weight;
240 p->setFont(m_oldQFont);
241 states.svgFont = m_oldSvgFont;
242 states.textAnchor = m_oldTextAnchor;
243 states.fontWeight = m_oldWeight;
247 : m_strokeOpacity(1.0)
248 , m_oldStrokeOpacity(0.0)
249 , m_strokeDashOffset(0)
250 , m_oldStrokeDashOffset(0)
252 , m_gradientResolved(1)
254 , m_oldVectorEffect(0)
256 , m_strokeDashArraySet(0)
257 , m_strokeDashOffsetSet(0)
258 , m_strokeLineCapSet(0)
259 , m_strokeLineJoinSet(0)
260 , m_strokeMiterLimitSet(0)
261 , m_strokeOpacitySet(0)
262 , m_strokeWidthSet(0)
263 , m_vectorEffectSet(0)
269 m_oldStroke =
p->pen();
270 m_oldStrokeOpacity =
states.strokeOpacity;
271 m_oldStrokeDashOffset =
states.strokeDashOffset;
272 m_oldVectorEffect =
states.vectorEffect;
284 if (m_strokeOpacitySet)
285 states.strokeOpacity = m_strokeOpacity;
287 if (m_vectorEffectSet)
288 states.vectorEffect = m_vectorEffect;
297 if (m_strokeWidthSet)
300 bool setDashOffsetNeeded =
false;
302 if (m_strokeDashOffsetSet) {
303 states.strokeDashOffset = m_strokeDashOffset;
304 setDashOffsetNeeded =
true;
307 if (m_strokeDashArraySet) {
310 }
else if (m_strokeWidthSet || oldWidth == 1) {
313 setDashOffsetNeeded =
true;
317 for (
int i = 0;
i < dashes.
size(); ++
i)
318 dashes[
i] /= oldWidth;
320 setDashOffsetNeeded =
true;
325 for (
int i = 0;
i < dashes.
size(); ++
i)
328 setDashOffsetNeeded =
true;
331 if (m_strokeLineCapSet)
333 if (m_strokeLineJoinSet)
335 if (m_strokeMiterLimitSet)
343 if (currentWidth == 0)
355 p->setPen(m_oldStroke);
356 states.strokeOpacity = m_oldStrokeOpacity;
357 states.strokeDashOffset = m_oldStrokeDashOffset;
358 states.vectorEffect = m_oldVectorEffect;
363 if (m_strokeWidthSet) {
366 if (
w != 0 &&
w != 1) {
367 for (
int i = 0;
i <
d.size(); ++
i)
374 m_strokeDashArraySet = 1;
378 : m_solidColor(
color)
383 : m_gradient(grad), m_gradientStopsSet(
false)
394 if (!m_gradientStopsSet) {
396 m_gradientStopsSet =
true;
402 b.setTransform(m_transform);
420 m_oldWorldTransform =
p->worldTransform();
421 p->setWorldTransform(m_transform,
true);
426 p->setWorldTransform(m_oldWorldTransform,
false );
478 m_oldMode =
p->compositionMode();
479 p->setCompositionMode(m_mode);
484 p->setCompositionMode(m_oldMode);
535 if ((*itr)->animActive(totalTimeElapsed)
546 if ((*itr)->animActive(totalTimeElapsed))
547 (*itr)->apply(
p, node,
states);
587 if ((*itr)->transformApplied()) {
593 (*itr)->clearTransformApplied();
616 m_totalRunningTime(endMs - startMs),
623 m_transformApplied(
false)
632 m_additive = additive;
639 m_oldWorldTransform =
p->worldTransform();
641 p->setWorldTransform(m_transform,
true);
642 m_transformApplied =
true;
647 p->setWorldTransform(m_oldWorldTransform,
false );
648 m_transformApplied =
false;
654 if (totalTimeElapsed < m_from || m_finished)
657 qreal animationFrame = 0;
658 if (m_totalRunningTime != 0) {
659 animationFrame = (totalTimeElapsed - m_from) / m_totalRunningTime;
661 if (m_repeatCount >= 0 && m_repeatCount < animationFrame) {
663 animationFrame = m_repeatCount;
667 qreal percentOfAnimation = animationFrame;
668 if (percentOfAnimation > 1) {
669 percentOfAnimation -= ((int)percentOfAnimation);
672 qreal currentPosition = percentOfAnimation * (m_count - 1);
673 int endElem =
qCeil(currentPosition);
674 int startElem =
qMax(endElem - 1, 0);
683 from1 = m_args[startElem++];
684 from2 = m_args[startElem++];
685 to1 = m_args[endElem++];
686 to2 = m_args[endElem++];
688 qreal transXDiff = (to1-from1) * percentOfAnimation;
689 qreal transX = from1 + transXDiff;
690 qreal transYDiff = (to2-from2) * percentOfAnimation;
691 qreal transY = from2 + transYDiff;
701 from1 = m_args[startElem++];
702 from2 = m_args[startElem++];
703 to1 = m_args[endElem++];
704 to2 = m_args[endElem++];
706 qreal transXDiff = (to1-from1) * percentOfAnimation;
707 qreal transX = from1 + transXDiff;
708 qreal transYDiff = (to2-from2) * percentOfAnimation;
709 qreal transY = from2 + transYDiff;
713 m_transform.
scale(transX, transY);
719 qreal from1, from2, from3;
721 from1 = m_args[startElem++];
722 from2 = m_args[startElem++];
723 from3 = m_args[startElem++];
724 to1 = m_args[endElem++];
725 to2 = m_args[endElem++];
726 to3 = m_args[endElem++];
728 qreal rotationDiff = (to1 - from1) * percentOfAnimation;
731 qreal transXDiff = (to2-from2) * percentOfAnimation;
732 qreal transX = from2 + transXDiff;
733 qreal transYDiff = (to3-from3) * percentOfAnimation;
734 qreal transY = from3 + transYDiff;
737 m_transform.
rotate(rotationDiff);
746 from1 = m_args[startElem++];
747 to1 = m_args[endElem++];
749 qreal transXDiff = (to1-from1) * percentOfAnimation;
750 qreal transX = from1 + transXDiff;
760 from1 = m_args[startElem++];
761 to1 = m_args[endElem++];
764 qreal transYDiff = (to1 - from1) * percentOfAnimation;
765 qreal transY = from1 + transYDiff;
787 m_repeatCount = repeatCount;
793 m_totalRunningTime(endMs - startMs),
816 m_repeatCount = repeatCount;
822 if (totalTimeElapsed < m_from || m_finished)
825 qreal animationFrame = 0;
826 if (m_totalRunningTime != 0)
827 animationFrame = (totalTimeElapsed - m_from) / m_totalRunningTime;
829 if (m_repeatCount >= 0 && m_repeatCount < animationFrame) {
831 animationFrame = m_repeatCount;
834 qreal percentOfAnimation = animationFrame;
835 if (percentOfAnimation > 1) {
836 percentOfAnimation -= ((int)percentOfAnimation);
839 qreal currentPosition = percentOfAnimation * (m_colors.
size() - 1);
841 int startElem =
qFloor(currentPosition);
842 int endElem =
qCeil(currentPosition);
846 qreal percentOfColorMorph = currentPosition;
847 if (percentOfColorMorph > 1) {
848 percentOfColorMorph -= ((int)percentOfColorMorph);
852 qreal aDiff = (
end.alpha() -
start.alpha()) * percentOfColorMorph;
853 qreal rDiff = (
end.red() -
start.red()) * percentOfColorMorph;
854 qreal gDiff = (
end.green() -
start.green()) * percentOfColorMorph;
855 qreal bDiff = (
end.blue() -
start.blue()) * percentOfColorMorph;
880 p->setBrush(m_oldBrush);
892 : m_opacity(opacity), m_oldOpacity(0)
899 m_oldOpacity =
p->opacity();
900 p->setOpacity(m_opacity * m_oldOpacity);
905 p->setOpacity(m_oldOpacity);
927 if (!m_link.
isEmpty() && m_doc) {
929 if (prop && !visited->contains(m_link)) {
930 visited->append(m_link);
The QColor class provides colors based on RGB, HSV or CMYK values.
void setStyle(Style style)
Sets the style of the font to style.
void setFamilies(const QStringList &)
void setCapitalization(Capitalization)
Capitalization capitalization() const
QStringList families() const
qreal pointSizeF() const
Returns the point size of the font.
Style style() const
Returns the style of the font.
void setPointSizeF(qreal)
Sets the point size to pointSize.
Weight
Qt uses a weighting scale from 1 to 1000 compatible with OpenType.
void setWeight(Weight weight)
Sets the weight of the font to weight, using the scale defined by \l QFont::Weight enumeration.
void setStops(const QGradientStops &stops)
Replaces the current set of stop points with the given stopPoints.
QGradientStops stops() const
Returns the stop points for this gradient.
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_iterator constBegin() const noexcept
const_iterator constEnd() const noexcept
The QPainter class performs low-level painting on widgets and other paint devices.
CompositionMode
Defines the modes supported for digital image compositing.
void setCapStyle(Qt::PenCapStyle pcs)
Sets the pen's cap style to the given style.
qreal widthF() const
Returns the pen width with floating point precision.
void setStyle(Qt::PenStyle)
[0]
QList< qreal > dashPattern() const
Returns the dash pattern of this pen.
void setWidthF(qreal width)
Sets the pen width to the given width in pixels with floating point precision.
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
void setColor(const QColor &color)
Sets the color of this pen's brush to the given color.
void setBrush(const QBrush &brush)
Sets the brush used to fill strokes generated with this pen to the given brush.
void setJoinStyle(Qt::PenJoinStyle pcs)
Sets the pen's join style to the given style.
void setDashOffset(qreal doffset)
Sets the dash offset (the starting point on the dash pattern) for this pen to the offset specified.
void setMiterLimit(qreal limit)
Sets the miter limit of this pen to the given limit.
Qt::PenJoinStyle joinStyle() const
Returns the pen's join style.
void setCosmetic(bool cosmetic)
Sets this pen to cosmetic or non-cosmetic, depending on the value of cosmetic.
void setDashPattern(const QList< qreal > &pattern)
Sets the dash pattern for this pen to the given pattern.
qreal miterLimit() const
Returns the miter limit of the pen.
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
Qt::PenStyle style() const
Returns the pen style.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void revert(QPainter *p, QSvgExtraStates &states) override
void setRepeatCount(qreal repeatCount)
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states) override
void setFreeze(bool freeze)
void setArgs(bool fill, const QList< QColor > &colors)
Type type() const override
QSvgAnimateColor(int startMs, int endMs, int by=0)
QSvgCompOpStyle(QPainter::CompositionMode mode)
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states) override
Type type() const override
void revert(QPainter *p, QSvgExtraStates &states) override
virtual QBrush brush(QPainter *p, QSvgExtraStates &states)=0
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states) override
void revert(QPainter *p, QSvgExtraStates &states) override
void setFillRule(Qt::FillRule f)
void setFillOpacity(qreal opacity)
void revert(QPainter *p, QSvgExtraStates &states) override
void setBrush(QBrush brush)
Type type() const override
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states) override
void setFillStyle(QSvgFillStyleProperty *style)
QSvgFillStyleProperty * style() const
Type type() const override
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states) override
void revert(QPainter *p, QSvgExtraStates &states) override
Type type() const override
bool gradientStopsSet() const
void setTransform(const QTransform &transform)
void resolveStops_helper(QStringList *visited)
void setStopLink(const QString &link, QSvgTinyDocument *doc)
QSvgGradientStyle(QGradient *grad)
QGradient * qgradient() const
QBrush brush(QPainter *, QSvgExtraStates &) override
QSvgStyleProperty * styleProperty(QSvgStyleProperty::Type type) const
QSvgTinyDocument * document() const
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states) override
QSvgOpacityStyle(qreal opacity)
void revert(QPainter *p, QSvgExtraStates &states) override
Type type() const override
void revert(QPainter *p, QSvgExtraStates &states) override
Type type() const override
void setImageRendering(ImageRendering)
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states) override
@ ImageRenderingOptimizeQuality
QSvgQualityStyle(int color)
QSvgSolidColorStyle(const QColor &color)
Type type() const override
void setDashArray(const QList< qreal > &dashes)
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states) override
void revert(QPainter *p, QSvgExtraStates &states) override
Type type() const override
virtual Type type() const =0
virtual ~QSvgStyleProperty()
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states)
QSvgRefCounter< QSvgOpacityStyle > opacity
QSvgRefCounter< QSvgViewportFillStyle > viewportFill
QList< QSvgRefCounter< QSvgAnimateTransform > > animateTransforms
QSvgRefCounter< QSvgFontStyle > font
QSvgRefCounter< QSvgStrokeStyle > stroke
QSvgRefCounter< QSvgAnimateColor > animateColor
QSvgRefCounter< QSvgQualityStyle > quality
QSvgRefCounter< QSvgFillStyle > fill
QSvgRefCounter< QSvgCompOpStyle > compop
void revert(QPainter *p, QSvgExtraStates &states)
int currentElapsed() const
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states) override
QSvgViewportFillStyle(const QBrush &brush)
void revert(QPainter *p, QSvgExtraStates &states) override
Type type() const override
Combined button and popup list for selecting options.
QPair< qreal, QColor > QGradientStop
QList< QGradientStop > QGradientStops
constexpr float qDegreesToRadians(float degrees)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
GLboolean GLboolean GLboolean b
GLfloat GLfloat GLfloat w
[0]
GLuint GLenum GLenum transform
GLfloat GLfloat GLfloat alpha
GLenum GLenum GLenum GLenum GLenum scale
static QT_BEGIN_NAMESPACE const QRgb colors[][14]
#define qPrintable(string)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)