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_paintStyleResolved(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_paintStyleResolved(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) {
364 QList<qreal>
d = dashes;
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);
434 m_oldWorldTransform =
p->worldTransform();
435 p->setWorldTransform(m_transform,
true);
440 p->setWorldTransform(m_oldWorldTransform,
false );
497 m_oldMode =
p->compositionMode();
498 p->setCompositionMode(m_mode);
503 p->setCompositionMode(m_oldMode);
554 if ((*itr)->animActive(totalTimeElapsed)
565 if ((*itr)->animActive(totalTimeElapsed))
566 (*itr)->apply(
p, node,
states);
606 if ((*itr)->transformApplied()) {
612 (*itr)->clearTransformApplied();
635 m_totalRunningTime(endMs - startMs),
642 m_transformApplied(
false)
651 m_additive = additive;
658 m_oldWorldTransform =
p->worldTransform();
660 p->setWorldTransform(m_transform,
true);
661 m_transformApplied =
true;
666 p->setWorldTransform(m_oldWorldTransform,
false );
667 m_transformApplied =
false;
673 if (totalTimeElapsed < m_from || m_finished)
676 qreal fractionOfTotalTime = 0;
677 if (m_totalRunningTime != 0) {
678 fractionOfTotalTime = (totalTimeElapsed - m_from) / m_totalRunningTime;
680 if (m_repeatCount >= 0 && m_repeatCount < fractionOfTotalTime) {
682 fractionOfTotalTime = m_repeatCount;
686 qreal fractionOfCurrentIterationTime = fractionOfTotalTime - std::trunc(fractionOfTotalTime);
688 qreal currentIndexPosition = fractionOfCurrentIterationTime * (m_count - 1);
689 int endElem =
qCeil(currentIndexPosition);
690 int startElem =
qMax(endElem - 1, 0);
692 qreal fractionOfCurrentElement = currentIndexPosition - std::trunc(currentIndexPosition);
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) * fractionOfCurrentElement;
707 qreal transX = from1 + transXDiff;
708 qreal transYDiff = (to2 - from2) * fractionOfCurrentElement;
709 qreal transY = from2 + transYDiff;
719 from1 = m_args[startElem++];
720 from2 = m_args[startElem++];
721 to1 = m_args[endElem++];
722 to2 = m_args[endElem++];
724 qreal transXDiff = (to1 - from1) * fractionOfCurrentElement;
725 qreal transX = from1 + transXDiff;
726 qreal transYDiff = (to2 - from2) * fractionOfCurrentElement;
727 qreal transY = from2 + transYDiff;
731 m_transform.
scale(transX, transY);
737 qreal from1, from2, from3;
739 from1 = m_args[startElem++];
740 from2 = m_args[startElem++];
741 from3 = m_args[startElem++];
742 to1 = m_args[endElem++];
743 to2 = m_args[endElem++];
744 to3 = m_args[endElem++];
746 qreal rotationDiff = (to1 - from1) * fractionOfCurrentElement;
749 qreal transXDiff = (to2 - from2) * fractionOfCurrentElement;
750 qreal transX = from2 + transXDiff;
751 qreal transYDiff = (to3 - from3) * fractionOfCurrentElement;
752 qreal transY = from3 + transYDiff;
755 m_transform.
rotate(rotationDiff);
764 from1 = m_args[startElem++];
765 to1 = m_args[endElem++];
767 qreal transXDiff = (to1 - from1) * fractionOfCurrentElement;
768 qreal transX = from1 + transXDiff;
778 from1 = m_args[startElem++];
779 to1 = m_args[endElem++];
781 qreal transYDiff = (to1 - from1) * fractionOfCurrentElement;
782 qreal transY = from1 + transYDiff;
804 m_repeatCount = repeatCount;
810 m_totalRunningTime(endMs - startMs),
820 const QList<QColor> &
colors)
833 m_repeatCount = repeatCount;
839 if (totalTimeElapsed < m_from || m_finished)
842 qreal animationFrame = 0;
843 if (m_totalRunningTime != 0)
844 animationFrame = (totalTimeElapsed - m_from) / m_totalRunningTime;
846 if (m_repeatCount >= 0 && m_repeatCount < animationFrame) {
848 animationFrame = m_repeatCount;
851 qreal percentOfAnimation = animationFrame;
852 if (percentOfAnimation > 1) {
853 percentOfAnimation -= ((int)percentOfAnimation);
856 qreal currentPosition = percentOfAnimation * (m_colors.
size() - 1);
858 int startElem =
qFloor(currentPosition);
859 int endElem =
qCeil(currentPosition);
863 qreal percentOfColorMorph = currentPosition;
864 if (percentOfColorMorph > 1) {
865 percentOfColorMorph -= ((int)percentOfColorMorph);
869 qreal aDiff = (
end.alpha() -
start.alpha()) * percentOfColorMorph;
870 qreal rDiff = (
end.red() -
start.red()) * percentOfColorMorph;
871 qreal gDiff = (
end.green() -
start.green()) * percentOfColorMorph;
872 qreal bDiff = (
end.blue() -
start.blue()) * percentOfColorMorph;
897 p->setBrush(m_oldBrush);
909 : m_opacity(opacity), m_oldOpacity(0)
916 m_oldOpacity =
p->opacity();
917 p->setOpacity(m_opacity * m_oldOpacity);
922 p->setOpacity(m_oldOpacity);
944 if (!m_link.
isEmpty() && m_doc) {
946 if (prop && !visited->contains(m_link)) {
947 visited->append(m_link);
952 m_gradient->
setStops(st->qgradient()->stops());
953 m_gradientStopsSet = st->gradientStopsSet();
void setColor(const QColor &color)
Sets the brush color to the given color.
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.
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 noexcept
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
void setFillRule(Qt::FillRule f)
void setFillOpacity(qreal opacity)
void revert(QPainter *p, QSvgExtraStates &states) override
void setBrush(QBrush brush)
void setFillStyle(QSvgPaintStyleProperty *style)
Type type() const override
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states) override
QSvgPaintStyleProperty * 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
QBrush brush(QPainter *, const QSvgNode *, QSvgExtraStates &) override
void setTransform(const QTransform &transform)
void resolveStops_helper(QStringList *visited)
void setStopLink(const QString &link, QSvgTinyDocument *doc)
QSvgGradientStyle(QGradient *grad)
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
virtual QBrush brush(QPainter *p, const QSvgNode *node, QSvgExtraStates &states)=0
void revert(QPainter *p, QSvgExtraStates &states) override
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states) override
QBrush brush(QPainter *, const QSvgNode *, QSvgExtraStates &) override
Type type() const override
QSvgPatternStyle(QSvgPattern *pattern)
QImage patternImage(QPainter *p, QSvgExtraStates &states, const QSvgNode *patternElement)
const QTransform & appliedTransform() const
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)