17#include <QPainterPath>
37 Q_ASSERT(
d->gradient);
46 Q_ASSERT(
d->gradient);
69 return otherGradient &&
70 d->matrix == otherGradient->
d->matrix &&
71 *
d->gradient == *otherGradient->
d->gradient;
89 Q_ASSERT(
d->gradient);
99 if (!
d->gradient)
return;
101 if (
d->gradient->coordinateMode() == QGradient::ObjectBoundingMode) {
117 const QRectF boundingRect = fillPath.boundingRect();
118 QTransform gradientToUser(boundingRect.width(), 0, 0, boundingRect.height(),
119 boundingRect.x(), boundingRect.y());
122 QGradient g = *
d->gradient;
123 g.setCoordinateMode(QGradient::LogicalMode);
126 b.setTransform(
d->matrix * gradientToUser);
129 QBrush b(*
d->gradient);
130 b.setTransform(
d->matrix);
134 painter.drawPath(fillPath);
A gradient shape background.
const QGradient * gradient() const
Returns the gradient.
bool compareTo(const KoShapeBackground *other) const override
~KoGradientBackground() override
Destroys the background.
KoGradientBackground(QGradient *gradient, const QTransform &matrix=QTransform())
QTransform transform() const
Returns the transform matrix.
void setTransform(const QTransform &matrix)
Sets the transform matrix.
void setGradient(const QGradient &gradient)
KoGradientBackground & operator=(const KoGradientBackground &)
void paint(QPainter &painter, const QPainterPath &fillPath) const override
reimplemented from KoShapeBackground
QSharedDataPointer< Private > d
KRITAFLAKE_EXPORT QGradient * cloneGradient(const QGradient *gradient)
clones the given gradient