|
Krita Source Code Documentation
|
#include <KoStopGradient.h>
Inheritance diagram for KoStopGradient:Public Member Functions | |
| void | bakeVariableColors (KoCanvasResourcesInterfaceSP canvasResourcesInterface) override |
| KoResourceSP | clone () const override |
| void | colorAt (KoColor &, qreal t) const override |
| reimplemented | |
| QString | defaultFileExtension () const override |
| reimplemented | |
| KoStopGradient (const KoStopGradient &rhs) | |
| KoStopGradient (const QString &filename=QString()) | |
| bool | loadFromDevice (QIODevice *dev, KisResourcesInterfaceSP resourcesInterface) override |
| KoStopGradient & | operator= (const KoStopGradient &rhs)=delete |
| bool | operator== (const KoStopGradient &rhs) const |
| QList< int > | requiredCanvasResources () const override |
| QPair< QString, QString > | resourceType () const override |
| QString | saveSvgGradient () const |
| bool | saveToDevice (QIODevice *dev) const override |
| void | setStops (QList< KoGradientStop > stops) |
| Sets the gradient stops. | |
| QList< KoGradientStop > | stops () const |
| bool | stopsAt (KoGradientStop &leftStop, KoGradientStop &rightStop, qreal t) const |
| Find stops surrounding position, returns false if position outside gradient. | |
| QGradient * | toQGradient () const override |
| reimplemented | |
| void | toXML (QDomDocument &doc, QDomElement &gradientElt) const |
| toXML Convert the gradient to an XML string. | |
| void | updateVariableColors (KoCanvasResourcesInterfaceSP canvasResourcesInterface) override |
| ~KoStopGradient () override | |
Public Member Functions inherited from KoAbstractGradient | |
| KoAbstractGradientSP | cloneAndBakeVariableColors (KoCanvasResourcesInterfaceSP canvasResourcesInterface) const |
| KoAbstractGradientSP | cloneAndUpdateVariableColors (KoCanvasResourcesInterfaceSP canvasResourcesInterface) const |
| const KoColorSpace * | colorSpace () const |
| QImage | generatePreview (int width, int height) const |
| QImage | generatePreview (int width, int height, KoCanvasResourcesInterfaceSP canvasResourcesInterface) const |
| KoAbstractGradient (const KoAbstractGradient &rhs) | |
| KoAbstractGradient (const QString &filename) | |
| void | setColorSpace (KoColorSpace *colorSpace) |
| void | setSpread (QGradient::Spread spreadMethod) |
| void | setType (QGradient::Type repeatType) |
| QGradient::Spread | spread () const |
| QGradient::Type | type () const |
| void | updatePreview () |
| ~KoAbstractGradient () override | |
Public Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Public Member Functions inherited from KoResource | |
| bool | active () const |
| void | addMetaData (QString key, QVariant value) |
| store the given key, value pair in the resource | |
| virtual void | clearSideLoadedResources () |
| virtual QList< KoResourceLoadResult > | embeddedResources (KisResourcesInterfaceSP globalResourcesInterface) const |
| QString | filename () const |
| QImage | image () const |
| bool | isDirty () const |
| virtual bool | isEphemeral () const |
| virtual bool | isSerializable () const |
| KoResource () | |
| KoResource (const KoResource &rhs) | |
| KoResource (const QString &filename) | |
| virtual QList< KoResourceLoadResult > | linkedResources (KisResourcesInterfaceSP globalResourcesInterface) const |
| bool | load (KisResourcesInterfaceSP resourcesInterface) |
| QString | md5Sum (bool generateIfEmpty=true) const |
| QMap< QString, QVariant > | metadata () const |
| get a map with all the metadata | |
| virtual QString | name () const |
| KoResource & | operator= (const KoResource &rhs)=delete |
| bool | permanent () const |
| QList< KoResourceLoadResult > | requiredResources (KisResourcesInterfaceSP globalResourcesInterface) const |
| int | resourceId () const |
| bool | save () |
| void | setActive (bool active) |
| void | setDirty (bool value) |
| Mark the preset as modified but not saved. | |
| void | setFilename (const QString &filename) |
| void | setImage (const QImage &image) |
| void | setMD5Sum (const QString &md5sum) |
| Set the md5sum of this resource. It must be in hex-encoded string format. | |
| void | setName (const QString &name) |
| void | setPermanent (bool permanent) |
| void | setResourceId (int id) |
| void | setStorageLocation (const QString &location) |
| void | setValid (bool valid) |
| void | setVersion (int version) |
| virtual QList< KoResourceLoadResult > | sideLoadedResources (KisResourcesInterfaceSP globalResourcesInterface) const |
| KoResourceSignature | signature () const |
| QString | storageLocation () const |
| QList< KoResourceLoadResult > | takeSideLoadedResources (KisResourcesInterfaceSP globalResourcesInterface) |
| virtual QImage | thumbnail () const |
| thumbnail the thumbnail image to use in resource selectors | |
| virtual QString | thumbnailPath () const |
| thumbnailPath returns the path to a separate thumbnail image, outside the actual resource file itself. If the path is relative, it is supposed start in the same location as the resource itself. If it's absolute, that is, it starts with "/", it is from the root of the storage. | |
| virtual void | updateThumbnail () |
| updateThumbnail updates the thumbnail for this resource. Reimplement if your thumbnail is something else than the image set with setImage. | |
| bool | valid () const |
| int | version () const |
| Get the version of the resource. | |
| virtual | ~KoResource () |
Static Public Member Functions | |
| static QSharedPointer< KoStopGradient > | fromQGradient (const QGradient *gradient) |
| Creates KoStopGradient from a QGradient. | |
| static KoStopGradient | fromXML (const QDomElement &elt) |
| fromXML convert a gradient from xml. | |
Protected Attributes | |
| QPointF | m_focalPoint |
| bool | m_hasVariableStops = false |
| QPointF | m_start |
| QPointF | m_stop |
| QList< KoGradientStop > | m_stops |
Private Member Functions | |
| void | loadSvgGradient (QIODevice *file) |
| void | parseSvgGradient (const QDomElement &element, QHash< QString, const KoColorProfile * > profiles) |
Additional Inherited Members | |
Public Attributes inherited from KoAbstractGradient | |
| const KoColorSpace * | colorSpace |
| QGradient::Spread | spread |
| QGradient::Type | type |
Public Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Public Attributes inherited from KoResource | |
| bool | active {true} |
| QString | filename |
| QImage | image |
| QString | md5sum |
| QMap< QString, QVariant > | metadata |
| bool | modified {false} |
| QString | name |
| bool | permanent {false} |
| int | resourceId {-1} |
| QString | storageLocation |
| bool | valid {false} |
| int | version {-1} |
Resource for colorstop based gradients like SVG gradients
Definition at line 89 of file KoStopGradient.h.
|
explicit |
Definition at line 39 of file KoStopGradient.cpp.
|
override |
Definition at line 44 of file KoStopGradient.cpp.
| KoStopGradient::KoStopGradient | ( | const KoStopGradient & | rhs | ) |
Definition at line 48 of file KoStopGradient.cpp.
|
overridevirtual |
Reimplemented from KoAbstractGradient.
Definition at line 269 of file KoStopGradient.cpp.
References KoCanvasResource::BackgroundColor, BACKGROUNDSTOP, COLORSTOP, KoCanvasResource::ForegroundColor, FOREGROUNDSTOP, and m_stops.
|
overridevirtual |
Implements KoResource.
Definition at line 69 of file KoStopGradient.cpp.
References KoStopGradient().
reimplemented
Reimplemented from KoAbstractGradient.
Definition at line 154 of file KoStopGradient.cpp.
References KoGradientStop::color, KoColor::colorSpace(), KoColor::data(), KoMixColorsOp::mixColors(), KoColorSpace::mixColorsOp, KoGradientStop::position, qint16_MAX, and stopsAt().
|
overridevirtual |
reimplemented
Reimplemented from KoResource.
Definition at line 547 of file KoStopGradient.cpp.
|
static |
Creates KoStopGradient from a QGradient.
Definition at line 183 of file KoStopGradient.cpp.
References COLORSTOP, KoColor::fromQColor(), KoStopGradient(), and M_PI.
|
static |
fromXML convert a gradient from xml.
Definition at line 567 of file KoStopGradient.cpp.
References KoColor::fromXML(), KoID::id(), Integer8BitsColorDepthID, KoColor::setOpacity(), setStops(), stops(), KisDomUtils::toDouble(), and KisDomUtils::toInt().
|
overridevirtual |
Implements KoResource.
Definition at line 74 of file KoStopGradient.cpp.
References loadSvgGradient(), m_stops, KoResource::setValid(), and KoAbstractGradient::updatePreview().
|
private |
Definition at line 299 of file KoStopGradient.cpp.
References KoColorSpaceEngine::addProfile(), KoGenericRegistry< T >::get(), KoColorSpaceEngineRegistry::instance(), KoColorSpaceRegistry::instance(), KIS_ASSERT, KoResource::name, parseSvgGradient(), and KoColorSpaceRegistry::profileByUniqueId().
|
delete |
| bool KoStopGradient::operator== | ( | const KoStopGradient & | rhs | ) | const |
Definition at line 57 of file KoStopGradient.cpp.
References KoAbstractGradient::colorSpace, m_focalPoint, m_start, m_stop, m_stops, KoAbstractGradient::spread, and KoAbstractGradient::type.
|
private |
Definition at line 363 of file KoStopGradient.cpp.
References COLORSTOP, KoColor::fromSVG11(), m_focalPoint, m_hasVariableStops, m_start, m_stop, m_stops, OPACITY_OPAQUE_U8, KoResource::setName(), KoColor::setOpacity(), KoAbstractGradient::setSpread(), KoAbstractGradient::setType(), KoResource::setValid(), and KoGradientStop::typeFromString().
|
overridevirtual |
A list of per-canvas active resources that are needed for this resource to function properly. E.g. some gradients may require Fg/Bg colors and some presets would like to know about the current gradient selection.
Reimplemented from KoResource.
Definition at line 255 of file KoStopGradient.cpp.
References KoCanvasResource::BackgroundColor, COLORSTOP, KoCanvasResource::ForegroundColor, m_stops, kismpl::mem_equal_to(), and KoGradientStop::type.
|
inlineoverridevirtual |
Implements KoResource.
Definition at line 104 of file KoStopGradient.h.
References ResourceType::Gradients, and ResourceSubType::StopGradients.
| QString KoStopGradient::saveSvgGradient | ( | ) | const |
Definition at line 585 of file KoStopGradient.cpp.
References KoColorProfile::fileName, KoXmlNS::krita, m_stops, KoResource::name, KoAbstractGradient::spread, and KoColorProfile::uniqueId().
|
overridevirtual |
Reimplemented from KoResource.
Definition at line 632 of file KoStopGradient.cpp.
References saveSvgGradient(), and KisPortingUtils::setUtf8OnStream().
| void KoStopGradient::setStops | ( | QList< KoGradientStop > | stops | ) |
Sets the gradient stops.
Definition at line 230 of file KoStopGradient.cpp.
References KoGradientStop::color, COLORSTOP, m_hasVariableStops, m_stops, KoGradientStop::position, KoResource::setValid(), stops(), KoGradientStop::type, and KoAbstractGradient::updatePreview().
| QList< KoGradientStop > KoStopGradient::stops | ( | ) | const |
Definition at line 250 of file KoStopGradient.cpp.
References m_stops.
| bool KoStopGradient::stopsAt | ( | KoGradientStop & | leftStop, |
| KoGradientStop & | rightStop, | ||
| qreal | t ) const |
Find stops surrounding position, returns false if position outside gradient.
Definition at line 122 of file KoStopGradient.cpp.
References KoGradientStop::color, COLORSTOP, KIS_SAFE_ASSERT_RECOVER, m_stops, kismpl::mem_less(), KoGradientStop::position, and KoGradientStop::type.
|
overridevirtual |
reimplemented
Reimplemented from KoAbstractGradient.
Definition at line 85 of file KoStopGradient.cpp.
References m_focalPoint, M_PI, m_start, m_stop, m_stops, KoAbstractGradient::spread, and KoAbstractGradient::type.
| void KoStopGradient::toXML | ( | QDomDocument & | doc, |
| QDomElement & | gradientElt ) const |
toXML Convert the gradient to an XML string.
Definition at line 552 of file KoStopGradient.cpp.
References KoGradientStop::color, KoColorSpace::colorDepthId(), KoColor::colorSpace(), KoID::id(), m_stops, KoColor::opacityF(), KoGradientStop::position, KisDomUtils::toString(), KoColor::toXML(), and KoGradientStop::type.
|
overridevirtual |
Reimplemented from KoAbstractGradient.
Definition at line 285 of file KoStopGradient.cpp.
References KoCanvasResource::BackgroundColor, BACKGROUNDSTOP, KoCanvasResource::ForegroundColor, FOREGROUNDSTOP, and m_stops.
|
protected |
Definition at line 152 of file KoStopGradient.h.
|
protected |
Definition at line 149 of file KoStopGradient.h.
|
protected |
Definition at line 150 of file KoStopGradient.h.
|
protected |
Definition at line 151 of file KoStopGradient.h.
|
protected |
Definition at line 148 of file KoStopGradient.h.