|
Krita Source Code Documentation
|
#include <KoSegmentGradient.h>
Inheritance diagram for KoSegmentGradient:Public Member Functions | |
| void | bakeVariableColors (KoCanvasResourcesInterfaceSP canvasResourcesInterface) override |
| KoResourceSP | clone () const override |
| KoGradientSegment * | collapseSegment (KoGradientSegment *segment) |
| void | colorAt (KoColor &dst, qreal t) const override |
| reimplemented | |
| void | createSegment (int interpolation, int colorInterpolation, double startOffset, double endOffset, double middleOffset, const KoColor &leftColor, const KoColor &rightColor, KoGradientSegmentEndpointType leftType=COLOR_ENDPOINT, KoGradientSegmentEndpointType rightType=COLOR_ENDPOINT) |
| void | createSegment (int interpolation, int colorInterpolation, double startOffset, double endOffset, double middleOffset, const QColor &leftColor, const QColor &rightColor, KoGradientSegmentEndpointType leftType=COLOR_ENDPOINT, KoGradientSegmentEndpointType rightType=COLOR_ENDPOINT) |
| QString | defaultFileExtension () const override |
| reimplemented | |
| void | duplicateSegment (KoGradientSegment *segment) |
| const QList< double > | getHandlePositions () const |
| const QList< double > | getMiddleHandlePositions () const |
| KoSegmentGradient (const KoSegmentGradient &rhs) | |
| KoSegmentGradient (const QString &file=QString()) | |
| bool | loadFromDevice (QIODevice *dev, KisResourcesInterfaceSP resourcesInterface) override |
| void | mirrorSegment (KoGradientSegment *segment) |
| void | moveSegmentEndOffset (KoGradientSegment *segment, double t) |
| void | moveSegmentMiddleOffset (KoGradientSegment *segment, double t) |
| void | moveSegmentStartOffset (KoGradientSegment *segment, double t) |
| KoSegmentGradient & | operator= (const KoSegmentGradient &rhs)=delete |
| KoGradientSegment * | removeSegment (KoGradientSegment *segment) |
| bool | removeSegmentPossible () const |
| QList< int > | requiredCanvasResources () const override |
| QPair< QString, QString > | resourceType () const override |
| bool | saveToDevice (QIODevice *dev) const override |
| KoGradientSegment * | segmentAt (qreal t) const |
| const QList< KoGradientSegment * > & | segments () const |
| void | setSegments (const QList< KoGradientSegment * > &segments) |
| void | splitSegment (KoGradientSegment *segment) |
| QGradient * | toQGradient () const override |
| reimplemented | |
| void | toXML (QDomDocument &doc, QDomElement &gradientElt) const |
| toXML convert the gradient to xml. | |
| void | updateVariableColors (KoCanvasResourcesInterfaceSP canvasResourcesInterface) override |
| ~KoSegmentGradient () 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 KoSegmentGradient | fromXML (const QDomElement &elt) |
| fromXML get a segment gradient from xml. | |
Protected Member Functions | |
| void | pushSegment (KoGradientSegment *segment) |
Protected Attributes | |
| QList< KoGradientSegment * > | m_segments |
Private Member Functions | |
| bool | init () |
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} |
KoSegmentGradient stores a segment based gradients like Gimp gradients
Definition at line 288 of file KoSegmentGradient.h.
|
explicit |
Definition at line 49 of file KoSegmentGradient.cpp.
|
override |
Definition at line 54 of file KoSegmentGradient.cpp.
References m_segments.
| KoSegmentGradient::KoSegmentGradient | ( | const KoSegmentGradient & | rhs | ) |
Definition at line 62 of file KoSegmentGradient.cpp.
References m_segments, and pushSegment().
|
overridevirtual |
Reimplemented from KoAbstractGradient.
Definition at line 1138 of file KoSegmentGradient.cpp.
References KoCanvasResource::BackgroundColor, COLOR_ENDPOINT, and KoCanvasResource::ForegroundColor.
|
overridevirtual |
Implements KoResource.
Definition at line 70 of file KoSegmentGradient.cpp.
References KoSegmentGradient().
| KoGradientSegment * KoSegmentGradient::collapseSegment | ( | KoGradientSegment * | segment | ) |
removes the specific segment from the gradient color picker and modifies the previous and next segments so that they end and start where the middle of the passed segment was respectively.
| segment | the segment to remove |
Definition at line 1033 of file KoSegmentGradient.cpp.
References KoGradientSegment::endOffset(), KoGradientSegment::length(), KoGradientSegment::middleOffset(), KoGradientSegment::setEndOffset(), KoGradientSegment::setMiddleOffset(), KoGradientSegment::setStartOffset(), and KoGradientSegment::startOffset().
reimplemented
Reimplemented from KoAbstractGradient.
Definition at line 232 of file KoSegmentGradient.cpp.
References KoGradientSegment::colorAt(), and segmentAt().
| void KoSegmentGradient::createSegment | ( | int | interpolation, |
| int | colorInterpolation, | ||
| double | startOffset, | ||
| double | endOffset, | ||
| double | middleOffset, | ||
| const KoColor & | leftColor, | ||
| const KoColor & | rightColor, | ||
| KoGradientSegmentEndpointType | leftType = COLOR_ENDPOINT, | ||
| KoGradientSegmentEndpointType | rightType = COLOR_ENDPOINT ) |
Definition at line 877 of file KoSegmentGradient.cpp.
References KoGradientSegment::colorInterpolation(), KoGradientSegment::endOffset(), KoGradientSegment::interpolation(), KoGradientSegment::KoGradientSegment(), KoGradientSegment::middleOffset(), and KoGradientSegment::startOffset().
| void KoSegmentGradient::createSegment | ( | int | interpolation, |
| int | colorInterpolation, | ||
| double | startOffset, | ||
| double | endOffset, | ||
| double | middleOffset, | ||
| const QColor & | leftColor, | ||
| const QColor & | rightColor, | ||
| KoGradientSegmentEndpointType | leftType = COLOR_ENDPOINT, | ||
| KoGradientSegmentEndpointType | rightType = COLOR_ENDPOINT ) |
a gradient color picker can consist of one or more segments. A segment has two end points - each color in the gradient color picker represents a segment end point.
| interpolation | |
| colorInterpolation | |
| startOffset | |
| endOffset | |
| middleOffset | |
| left | |
| right | |
| leftType | |
| rightType |
Definition at line 862 of file KoSegmentGradient.cpp.
References KoGradientSegment::colorInterpolation(), KoGradientSegment::endOffset(), KoGradientSegment::interpolation(), KoGradientSegment::middleOffset(), and KoGradientSegment::startOffset().
|
overridevirtual |
reimplemented
Reimplemented from KoResource.
Definition at line 254 of file KoSegmentGradient.cpp.
| void KoSegmentGradient::duplicateSegment | ( | KoGradientSegment * | segment | ) |
duplicate the specified segment
| segment | the segment to duplicate |
Definition at line 979 of file KoSegmentGradient.cpp.
References KoGradientSegment::colorInterpolation(), KoGradientSegment::endColor(), KoGradientSegment::endType(), KoGradientSegment::interpolation(), KoGradientSegment::KoGradientSegment(), KoGradientSegment::length(), KoGradientSegment::middleOffset(), KoGradientSegment::setMiddleOffset(), KoGradientSegment::setStartOffset(), KoGradientSegment::startColor(), KoGradientSegment::startOffset(), and KoGradientSegment::startType().
|
static |
fromXML get a segment gradient from xml.
Definition at line 287 of file KoSegmentGradient.cpp.
References createSegment(), KoColor::fromXML(), KoID::id(), Integer8BitsColorDepthID, segments(), KoResource::setValid(), KisDomUtils::toDouble(), KisDomUtils::toInt(), and KoColor::toQColor().
| const QList< double > KoSegmentGradient::getHandlePositions | ( | ) | const |
gets a list of end points of the segments in the gradient color picker. If two colors, one segment then two end points, and if three colors, then two segments with four endpoints.
Definition at line 884 of file KoSegmentGradient.cpp.
References KoGradientSegment::endOffset(), and KoGradientSegment::startOffset().
| const QList< double > KoSegmentGradient::getMiddleHandlePositions | ( | ) | const |
gets a list of middle points of the segments in the gradient color picker.
Definition at line 895 of file KoSegmentGradient.cpp.
References KoGradientSegment::middleOffset().
|
private |
|
overridevirtual |
Implements KoResource.
Definition at line 75 of file KoSegmentGradient.cpp.
References COLOR_ENDPOINT, dbgPigment, KoColorSpaceRegistry::instance(), m_segments, KoResource::name, quint16_MAX, KoColorSpaceRegistry::rgb16(), KoResource::setName(), KisPortingUtils::setUtf8OnStream(), KoResource::setValid(), and KoAbstractGradient::updatePreview().
| void KoSegmentGradient::mirrorSegment | ( | KoGradientSegment * | segment | ) |
create a segment horizontally reversed to the specified one.
| segment | the segment to reverse |
Definition at line 998 of file KoSegmentGradient.cpp.
References KoGradientSegment::mirrorSegment().
| void KoSegmentGradient::moveSegmentEndOffset | ( | KoGradientSegment * | segment, |
| double | t ) |
Moves the endoffset of the specified segment to the specified value and corrects the startoffset of the following segment. If the segment is the last segment the endoffset will be set to 1.0 . The offset will maximally be moved till the middle of the current or the following segment. This is useful if someone moves the segment handler in the gradient color picker, and needs the segment to move with it. Sets the end position of the segment to the correct new position.
| segment | the segment for which to move the relative end position within the gradient color picker. |
| t | the new end position for the segment |
Definition at line 926 of file KoSegmentGradient.cpp.
References KoGradientSegment::endOffset(), KoGradientSegment::middleOffset(), KoGradientSegment::setEndOffset(), and KoGradientSegment::setStartOffset().
| void KoSegmentGradient::moveSegmentMiddleOffset | ( | KoGradientSegment * | segment, |
| double | t ) |
moves the Middle of the specified segment to the specified value. The offset will maximally be moved till the endoffset or startoffset of the segment. This sets the middle of the segment to the same position as the handler of the gradient color picker.
| segment | the segment for which to move the relative middle position within the gradient color picker. |
| t | the new middle position for the segment |
Definition at line 947 of file KoSegmentGradient.cpp.
References KoGradientSegment::endOffset(), KoGradientSegment::setMiddleOffset(), and KoGradientSegment::startOffset().
| void KoSegmentGradient::moveSegmentStartOffset | ( | KoGradientSegment * | segment, |
| double | t ) |
Moves the StartOffset of the specified segment to the specified value and corrects the endoffset of the previous segment. If the segment is the first Segment the startoffset will be set to 0.0 . The offset will maximally be moved till the middle of the current or the previous segment. This is useful if someone clicks to move the handler for a segment, to set the half the segment to the right and half the segment to the left of the handler.
| segment | the segment for which to move the relative offset within the gradient color picker. |
| t | the new startoff position for the segment |
Definition at line 905 of file KoSegmentGradient.cpp.
References KoGradientSegment::middleOffset(), KoGradientSegment::setEndOffset(), KoGradientSegment::setStartOffset(), and KoGradientSegment::startOffset().
|
delete |
|
inlineprotected |
Definition at line 475 of file KoSegmentGradient.h.
| KoGradientSegment * KoSegmentGradient::removeSegment | ( | KoGradientSegment * | segment | ) |
removes the specific segment from the gradient color picker.
| segment | the segment to remove |
Definition at line 1005 of file KoSegmentGradient.cpp.
References KoGradientSegment::endOffset(), KoGradientSegment::length(), KoGradientSegment::middleOffset(), KoGradientSegment::setEndOffset(), KoGradientSegment::setMiddleOffset(), KoGradientSegment::setStartOffset(), and KoGradientSegment::startOffset().
| bool KoSegmentGradient::removeSegmentPossible | ( | ) | const |
checks if it's possible to remove a segment (at least two segments in the gradient)
Definition at line 1074 of file KoSegmentGradient.cpp.
|
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 1120 of file KoSegmentGradient.cpp.
References KoCanvasResource::BackgroundColor, KoCanvasResource::ForegroundColor, and KoGradientSegment::hasVariableColors().
|
inlineoverridevirtual |
Implements KoResource.
Definition at line 301 of file KoSegmentGradient.h.
References ResourceType::Gradients, and ResourceSubType::SegmentedGradients.
|
overridevirtual |
Reimplemented from KoResource.
Definition at line 189 of file KoSegmentGradient.cpp.
References KoGradientSegment::colorInterpolation(), KoGradientSegment::endColor(), KoGradientSegment::endOffset(), KoGradientSegment::endType(), KoGradientSegment::interpolation(), m_segments, KoGradientSegment::middleOffset(), KoResource::name, KisPortingUtils::setUtf8OnStream(), KoGradientSegment::startColor(), KoGradientSegment::startOffset(), KoGradientSegment::startType(), and KoColor::toQColor().
| KoGradientSegment * KoSegmentGradient::segmentAt | ( | qreal | t | ) | const |
Returns the segment at a given position
| t | position inside the gradient, with 0 <= t <= 1 |
Definition at line 217 of file KoSegmentGradient.cpp.
References m_segments.
| const QList< KoGradientSegment * > & KoSegmentGradient::segments | ( | ) | const |
Definition at line 1081 of file KoSegmentGradient.cpp.
| void KoSegmentGradient::setSegments | ( | const QList< KoGradientSegment * > & | segments | ) |
Definition at line 1086 of file KoSegmentGradient.cpp.
References KoGradientSegment::KoGradientSegment().
| void KoSegmentGradient::splitSegment | ( | KoGradientSegment * | segment | ) |
splits the specified segment into two equal parts
| segment | the segment to split |
Definition at line 959 of file KoSegmentGradient.cpp.
References COLOR_ENDPOINT, KoGradientSegment::colorAt(), KoGradientSegment::colorInterpolation(), KoColor::colorSpace(), KoGradientSegment::endColor(), KoGradientSegment::endOffset(), KoGradientSegment::interpolation(), KoGradientSegment::KoGradientSegment(), KoGradientSegment::middleOffset(), KoGradientSegment::setMiddleOffset(), KoGradientSegment::setStartColor(), KoGradientSegment::setStartOffset(), KoGradientSegment::startColor(), KoGradientSegment::startOffset(), and KoGradientSegment::startType().
|
overridevirtual |
reimplemented
Reimplemented from KoAbstractGradient.
Definition at line 240 of file KoSegmentGradient.cpp.
References KoGradientSegment::endColor(), KoGradientSegment::endOffset(), m_segments, KoGradientSegment::startColor(), KoGradientSegment::startOffset(), and KoColor::toQColor().
| void KoSegmentGradient::toXML | ( | QDomDocument & | doc, |
| QDomElement & | gradientElt ) const |
toXML convert the gradient to xml.
Definition at line 259 of file KoSegmentGradient.cpp.
References KoColorSpace::colorDepthId(), KoGradientSegment::colorInterpolation(), KoColor::colorSpace(), KoGradientSegment::endColor(), KoGradientSegment::endOffset(), KoGradientSegment::endType(), KoID::id(), KoGradientSegment::interpolation(), KoGradientSegment::middleOffset(), KoColor::opacityF(), segments(), KoGradientSegment::startColor(), KoGradientSegment::startOffset(), KoGradientSegment::startType(), KisDomUtils::toString(), and KoColor::toXML().
|
overridevirtual |
Reimplemented from KoAbstractGradient.
Definition at line 1152 of file KoSegmentGradient.cpp.
References KoCanvasResource::BackgroundColor, and KoCanvasResource::ForegroundColor.
|
protected |
Definition at line 479 of file KoSegmentGradient.h.