78 Q_ASSERT(!
"This should not be called!");
83 Q_ASSERT(!
"This should not be called!");
88 : m_colorRendering(color)
106 , m_oldFillOpacity(0)
107 , m_gradientResolved(1)
109 , m_fillOpacitySet(0)
168 : m_viewportFill(brush)
275 : m_strokeOpacity(1.0)
276 , m_oldStrokeOpacity(0.0)
277 , m_strokeDashOffset(0)
278 , m_oldStrokeDashOffset(0)
280 , m_gradientResolved(1)
282 , m_oldVectorEffect(0)
284 , m_strokeDashArraySet(0)
285 , m_strokeDashOffsetSet(0)
286 , m_strokeLineCapSet(0)
287 , m_strokeLineJoinSet(0)
288 , m_strokeMiterLimitSet(0)
289 , m_strokeOpacitySet(0)
290 , m_strokeWidthSet(0)
291 , m_vectorEffectSet(0)
328 bool setDashOffsetNeeded =
false;
332 setDashOffsetNeeded =
true;
341 setDashOffsetNeeded =
true;
345 for (
int i = 0; i < dashes.
size(); ++i)
346 dashes[i] /= oldWidth;
348 setDashOffsetNeeded =
true;
353 for (
int i = 0; i < dashes.
size(); ++i)
356 setDashOffsetNeeded =
true;
371 if (currentWidth == 0)
394 if (w != 0 && w != 1) {
395 for (
int i = 0; i < d.
size(); ++i)
406 : m_solidColor(color)
411 : m_gradient(grad), m_gradientStopsSet(false)
527 quality->apply(p, node, states);
531 fill->apply(p, node, states);
535 viewportFill->apply(p, node, states);
539 font->apply(p, node, states);
543 stroke->apply(p, node, states);
547 transform->apply(p, node, states);
551 animateColor->apply(p, node, states);
556 if (!animateTransforms.isEmpty()) {
563 if ((*itr)->animActive(totalTimeElapsed)
567 transform->revert(p, states);
570 }
while (itr != animateTransforms.
constBegin());
573 for (; itr != animateTransforms.
constEnd(); ++itr) {
574 if ((*itr)->animActive(totalTimeElapsed))
575 (*itr)->apply(p, node, states);
580 opacity->apply(p, node, states);
584 compop->apply(p, node, states);
591 quality->revert(p, states);
595 fill->revert(p, states);
599 viewportFill->revert(p, states);
603 font->revert(p, states);
607 stroke->revert(p, states);
612 if (!animateTransforms.isEmpty()) {
614 for (; itr != animateTransforms.
constEnd(); ++itr) {
615 if ((*itr)->transformApplied()) {
616 (*itr)->revert(p, states);
620 for (; itr != animateTransforms.
constEnd(); ++itr)
621 (*itr)->clearTransformApplied();
625 transform->revert(p, states);
629 animateColor->revert(p, states);
633 opacity->revert(p, states);
637 compop->revert(p, states);
643 m_from(startMs), m_to(endMs), m_by(byMs),
644 m_type(Empty), m_additive(Replace), m_count(0), m_finished(false), m_transformApplied(false)
679 qreal animationFrame = 0;
689 qreal percentOfAnimation = animationFrame;
690 if (percentOfAnimation > 1) {
691 percentOfAnimation -= ((int)percentOfAnimation);
694 qreal currentPosition = percentOfAnimation * (
m_count - 1);
695 int startElem =
qFloor(currentPosition);
696 int endElem =
qCeil(currentPosition);
705 from1 =
m_args[startElem++];
706 from2 =
m_args[startElem++];
710 qreal transXDiff = (to1-from1) * percentOfAnimation;
711 qreal transX = from1 + transXDiff;
712 qreal transYDiff = (to2-from2) * percentOfAnimation;
713 qreal transY = from2 + transYDiff;
723 from1 =
m_args[startElem++];
724 from2 =
m_args[startElem++];
728 qreal transXDiff = (to1-from1) * percentOfAnimation;
729 qreal transX = from1 + transXDiff;
730 qreal transYDiff = (to2-from2) * percentOfAnimation;
731 qreal transY = from2 + transYDiff;
741 qreal from1, from2, from3;
743 from1 =
m_args[startElem++];
744 from2 =
m_args[startElem++];
745 from3 =
m_args[startElem++];
750 qreal rotationDiff = (to1 - from1) * percentOfAnimation;
753 qreal transXDiff = (to2-from2) * percentOfAnimation;
754 qreal transX = from2 + transXDiff;
755 qreal transYDiff = (to3-from3) * percentOfAnimation;
756 qreal transY = from3 + transYDiff;
768 from1 =
m_args[startElem++];
771 qreal transXDiff = (to1-from1) * percentOfAnimation;
772 qreal transX = from1 + transXDiff;
782 from1 =
m_args[startElem++];
786 qreal transYDiff = (to1 - from1) * percentOfAnimation;
787 qreal transY = from1 + transYDiff;
843 qreal animationFrame = 0;
852 qreal percentOfAnimation = animationFrame;
853 if (percentOfAnimation > 1) {
854 percentOfAnimation -= ((int)percentOfAnimation);
859 int startElem =
qFloor(currentPosition);
860 int endElem =
qCeil(currentPosition);
864 qreal percentOfColorMorph = currentPosition;
865 if (percentOfColorMorph > 1) {
866 percentOfColorMorph -= ((int)percentOfColorMorph);
871 qreal rDiff = (end.
red() - start.
red()) * percentOfColorMorph;
873 qreal bDiff = (end.
blue() - start.
blue()) * percentOfColorMorph;
875 int alpha = int(start.
alpha() + aDiff);
876 int red = int(start.
red() + rDiff);
878 int blue = int(start.
blue() + bDiff);
880 QColor color(red, green, blue, alpha);
910 : m_opacity(opacity), m_oldOpacity(0)
939 if (!m_link.isEmpty() && m_doc) {
The QPainter class performs low-level painting on widgets and other paint devices.
QSvgViewportFillStyle(const QBrush &brush)
virtual ~QSvgStyleProperty()
The QColor class provides colors based on RGB, HSV or CMYK values.
void setCapitalization(Capitalization)
Sets the capitalization of the text in this font to caps.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
qreal opacity() const
Returns the opacity of the painter.
#define QT_END_NAMESPACE
This macro expands to.
virtual void revert(QPainter *p, QSvgExtraStates &states)
void setBrush(const QBrush &brush)
Sets the brush used to fill strokes generated with this pen to the given brush.
virtual void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states)
CompositionMode
Defines the modes supported for digital image compositing.
QSvgQualityStyle(int color)
The QMatrix class specifies 2D transformations of a coordinate system.
int count(const T &t) const
Returns the number of occurrences of value in the vector.
void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states)
void setCapStyle(Qt::PenCapStyle pcs)
Sets the pen's cap style to the given style.
Qt::PenStyle style() const
Returns the pen style.
virtual Type type() const
Style style() const
Returns the style of the font.
uint m_strokeDashArraySet
virtual Type type() const
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
Capitalization capitalization() const
Returns the current capitalization type of the font.
QGradient * qgradient() const
virtual void revert(QPainter *p, QSvgExtraStates &states)
void setCosmetic(bool cosmetic)
Sets this pen to cosmetic or non-cosmetic, depending on the value of cosmetic.
virtual Type type() const
virtual void revert(QPainter *p, QSvgExtraStates &states)
int count(const T &t) const
Returns the number of occurrences of value in the list.
ushort red
Returns the red color component of this color.
virtual void revert(QPainter *p, QSvgExtraStates &states)
The QString class provides a Unicode character string.
virtual void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states)
void setRepeatCount(qreal repeatCount)
virtual void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states)
Qt::Alignment m_textAnchor
The QPen class defines how a QPainter should draw lines and outlines of shapes.
void setFillRule(Qt::FillRule f)
QVector< qreal > dashPattern() const
Returns the dash pattern of this pen.
QSvgOpacityStyle(qreal opacity)
void setDashPattern(const QVector< qreal > &pattern)
Sets the dash pattern for this pen to the given pattern.
void revert(QPainter *p, QSvgExtraStates &states)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
QSvgFillStyleProperty * style() const
void setFamily(const QString &)
Sets the family name of the font.
qreal m_oldStrokeDashOffset
virtual QBrush brush(QPainter *p, QSvgExtraStates &states)=0
virtual void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states)
void setColor(const QColor &color)
Sets the color of this pen's brush to the given color.
QGradientStops stops() const
Returns the stop points for this gradient.
static int SVGToQtWeight(int weight)
Qt::Alignment m_oldTextAnchor
virtual Type type() const
virtual Type type() const
const QPen & pen() const
Returns the painter's current pen.
#define QT_BEGIN_NAMESPACE
This macro expands to.
qreal pointSizeF() const
Returns the point size of the font.
virtual void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states)
uint m_strokeDashOffsetSet
virtual void revert(QPainter *p, QSvgExtraStates &states)
void setFreeze(bool freeze)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void setFillStyle(QSvgFillStyleProperty *style)
Qt::PenJoinStyle joinStyle() const
Returns the pen's join style.
void setDashOffset(qreal doffset)
Sets the dash offset (the starting point on the dash pattern) for this pen to the offset specified...
void setBrush(QBrush brush)
const QFont & font() const
Returns the currently set font used for drawing text.
int currentElapsed() const
virtual void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states)
CompositionMode compositionMode() const
Returns the current composition mode.
QSvgFillStyleProperty * m_style
Q_CORE_EXPORT void qWarning(const char *,...)
void setArgs(bool fill, const QList< QColor > &colors)
virtual void revert(QPainter *p, QSvgExtraStates &states)
void setJoinStyle(Qt::PenJoinStyle pcs)
Sets the pen's join style to the given style.
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
QSvgFillStyleProperty * m_style
virtual void revert(QPainter *p, QSvgExtraStates &states)
QSvgGradientStyle(QGradient *grad)
QVector< QGradientStop > QGradientStops
QSvgCompOpStyle(QPainter::CompositionMode mode)
const QBrush & brush() const
Returns the painter's current brush.
void setColor(const QColor &color)
Sets the brush color to the given color.
The QBrush class defines the fill pattern of shapes drawn by QPainter.
void setMatrix(const QMatrix &matrix)
void setFillOpacity(qreal opacity)
ushort blue
Returns the blue color component of this color.
const QTransform & worldTransform() const
Returns the world transformation matrix.
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
virtual void revert(QPainter *p, QSvgExtraStates &states)
ushort alpha
Returns the alpha color component of this color.
The QFont class specifies a font used for drawing text.
The QGradient class is used in combination with QBrush to specify gradient fills. ...
virtual void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states)
QPair< qreal, QColor > QGradientStop
void setWidthF(qreal width)
Sets the pen width to the given width in pixels with floating point precision.
virtual Type type() const =0
QString family() const
Returns the requested font family name, i.e.
qreal miterLimit() const
Returns the miter limit of the pen.
void setMatrix(const QMatrix &mat)
Sets matrix as an explicit transformation matrix on the current brush.
#define st(var, type, card)
virtual Type type() const
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
virtual Type type() const
void setStops(const QGradientStops &stops)
Replaces the current set of stop points with the given stopPoints.
virtual Type type() const
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
virtual void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states)
void setWeight(int)
Sets the weight the font to weight, which should be a value from the QFont::Weight enumeration...
qreal widthF() const
Returns the pen width with floating point precision.
virtual void revert(QPainter *p, QSvgExtraStates &states)
void setWorldTransform(const QTransform &matrix, bool combine=false)
Sets the world transformation matrix.
QBrush brush(QPainter *, QSvgExtraStates &)
void setPointSizeF(qreal)
Sets the point size to pointSize.
virtual void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states)
QSvgAnimateColor(int startMs, int endMs, int by=0)
void setStopLink(const QString &link, QSvgTinyDocument *doc)
bool gradientStopsSet() const
void setDashArray(const QVector< qreal > &dashes)
void setFont(const QFont &f)
Sets the painter's font to the given font.
bool isIdentity() const
Returns true if the matrix is the identity matrix, otherwise returns false.
QSvgSolidColorStyle(const QColor &color)
virtual Type type() const
uint m_strokeMiterLimitSet
void setOpacity(qreal opacity)
Sets the opacity of the painter to opacity.
QSvgTinyDocument * document() const
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
static const KeyPair *const end
Qt::FillRule m_oldFillRule
#define qPrintable(string)
QPainter::CompositionMode m_oldMode
ushort green
Returns the green color component of this color.
int size() const
Returns the number of items in the vector.
virtual Type type() const
void setStyle(Style style)
Sets the style of the font to style.
QPainter::CompositionMode m_mode
void setStyle(Qt::PenStyle)
Sets the pen style to the given style.
The QList class is a template class that provides lists.
void setMiterLimit(qreal limit)
Sets the miter limit of this pen to the given limit.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...