6#ifndef KOSTOPGRADIENT_H
7#define KOSTOPGRADIENT_H
11#include <QtAlgorithms>
16#include <kritapigment_export.h>
17#include <boost/operators.hpp>
41 return this->type == other.
type && this->color == other.
color && this->position == other.
position;
52 return "foreground-stop";
54 return "background-stop";
61 if (typestring ==
"foreground-stop") {
63 }
else if (typestring ==
"background-stop") {
75 return (a.
color.
toQColor().valueF() < b.color.toQColor().valueF());
82 return (a.
color.
toQColor().hueF() < b.color.toQColor().hueF());
136 void toXML(QDomDocument& doc, QDomElement& gradientElt)
const;
144 QString saveSvgGradient()
const;
149 bool m_hasVariableStops =
false;
156 void loadSvgGradient(QIODevice *file);
157 void parseSvgGradient(
const QDomElement& element, QHash<QString, const KoColorProfile*> profiles);
bool operator==(const KisRegion &lhs, const KisRegion &rhs)
QSharedPointer< KoStopGradient > KoStopGradientSP
void toQColor(QColor *c) const
a convenience method for the above.
QList< KoGradientStop > m_stops
KoStopGradient & operator=(const KoStopGradient &rhs)=delete
QPair< QString, QString > resourceType() const override
const QString StopGradients
virtual void colorAt(KoColor &, qreal t) const
gets the color at position 0 <= t <= 1
virtual void bakeVariableColors(KoCanvasResourcesInterfaceSP canvasResourcesInterface)
virtual QGradient * toQGradient() const
virtual void updateVariableColors(KoCanvasResourcesInterfaceSP canvasResourcesInterface)
bool operator()(const KoGradientStop &a, const KoGradientStop &b)
bool operator()(const KoGradientStop &a, const KoGradientStop &b)
QString typeString() const
static KoGradientStopType typeFromString(QString typestring)
KoGradientStop(qreal _position=0.0, KoColor _color=KoColor(), KoGradientStopType _type=COLORSTOP)
bool operator==(const KoGradientStop &other) const
virtual KoResourceSP clone() const =0
virtual QList< int > requiredCanvasResources() const
virtual QString defaultFileExtension() const
virtual bool saveToDevice(QIODevice *dev) const
virtual bool loadFromDevice(QIODevice *dev, KisResourcesInterfaceSP resourcesInterface)=0