|
Krita Source Code Documentation
|
Namespace containing functions to convert to/from different types of gradients. More...
Functions | |
| KoAbstractGradientSP | toAbstractGradient (const QGradient *gradient) |
| Convert the stops of a QGradient to a krita abstract gradient. | |
| KoAbstractGradientSP | toAbstractGradient (const QGradientStops &gradient) |
| Convert a QGradientStop list to a krita abstract gradient. | |
| KoAbstractGradientSP | toAbstractGradient (KoSegmentGradientSP gradient) |
| Create a clone of a KoSegmentGradientSP and return it casted to a krita abstract gradient. | |
| KoAbstractGradientSP | toAbstractGradient (KoStopGradientSP gradient) |
| Create a clone of a KoStopGradientSP and return it casted to a krita abstract gradient. | |
| KoGradientStop | toKoGradientStop (const KoColor &color, KoGradientSegmentEndpointType type, qreal offset, KoCanvasResourcesInterfaceSP canvasResourcesInterface) |
| QGradient * | toQGradient (KoAbstractGradientSP gradient, KoCanvasResourcesInterfaceSP canvasResourcesInterface=nullptr) |
| Convert a KoAbstractGradientSP to a QGradient. | |
| QGradient * | toQGradient (KoSegmentGradientSP gradient, KoCanvasResourcesInterfaceSP canvasResourcesInterface=nullptr) |
| Convert a KoSegmentGradientSP to a QGradient. | |
| QGradient * | toQGradient (KoStopGradientSP gradient, KoCanvasResourcesInterfaceSP canvasResourcesInterface=nullptr) |
| Convert a KoStopGradientSP to a QGradient. | |
| QGradientStop | toQGradientStop (const KoColor &color, KoGradientSegmentEndpointType type, qreal offset, KoCanvasResourcesInterfaceSP canvasResourcesInterface) |
| QGradientStop | toQGradientStop (const KoColor &color, KoGradientStopType type, qreal position, KoCanvasResourcesInterfaceSP canvasResourcesInterface) |
| QGradientStops | toQGradientStops (KoAbstractGradientSP gradient, KoCanvasResourcesInterfaceSP canvasResourcesInterface=nullptr) |
| Convert a KoAbstractGradientSP to a QGradientStop list. | |
| QGradientStops | toQGradientStops (KoSegmentGradientSP gradient, KoCanvasResourcesInterfaceSP canvasResourcesInterface=nullptr) |
| Convert a KoSegmentGradientSP to a QGradientStop list. | |
| QGradientStops | toQGradientStops (KoStopGradientSP gradient, KoCanvasResourcesInterfaceSP canvasResourcesInterface=nullptr) |
| Convert a KoStopGradientSP to a QGradientStop list. | |
| KoSegmentGradientSP | toSegmentGradient (const QGradient *gradient) |
| Convert a QGradient to a krita segment gradient. | |
| KoSegmentGradientSP | toSegmentGradient (const QGradientStops &gradient) |
| Convert a QGradientStop list to a krita segment gradient. | |
| KoSegmentGradientSP | toSegmentGradient (KoAbstractGradientSP gradient) |
| Convert a krita abstract gradient to a krita segment gradient. | |
| KoSegmentGradientSP | toSegmentGradient (KoStopGradientSP gradient) |
| Convert a krita stop gradient to a krita segment gradient. | |
| KoStopGradientSP | toStopGradient (const QGradient *gradient) |
| Convert the stops of a QGradient to a KoStopGradientSP. | |
| KoStopGradientSP | toStopGradient (const QGradientStops &gradient) |
| Convert a QGradientStop list to a KoStopGradientSP. | |
| KoStopGradientSP | toStopGradient (KoAbstractGradientSP gradient, KoCanvasResourcesInterfaceSP canvasResourcesInterface=nullptr) |
| Convert a KoAbstractGradientSP to a KoStopGradientSP. | |
| KoStopGradientSP | toStopGradient (KoSegmentGradientSP gradient, KoCanvasResourcesInterfaceSP canvasResourcesInterface=nullptr) |
| Convert a KoSegmentGradientSP to a KoStopGradientSP. | |
Namespace containing functions to convert to/from different types of gradients.
| KRITAPIGMENT_EXPORT KoAbstractGradientSP KisGradientConversion::toAbstractGradient | ( | const QGradient * | gradient | ) |
Convert the stops of a QGradient to a krita abstract gradient.
This function makes use of toStopGradient(const QGradientStops &) to create a KoStopGradientSP that is casted to a KoAbstractGradientSP
| gradient | A QGradient with the stops of the gradient |
Definition at line 203 of file KisGradientConversion.cpp.
References toStopGradient().
| KRITAPIGMENT_EXPORT KoAbstractGradientSP KisGradientConversion::toAbstractGradient | ( | const QGradientStops & | gradient | ) |
Convert a QGradientStop list to a krita abstract gradient.
This function makes use of toStopGradient(const QGradientStops &) to create a KoStopGradientSP that is casted to a KoAbstractGradientSP
| gradient | A QGradientStop list with the stops of the gradient |
Definition at line 198 of file KisGradientConversion.cpp.
References toStopGradient().
| KRITAPIGMENT_EXPORT KoAbstractGradientSP KisGradientConversion::toAbstractGradient | ( | KoSegmentGradientSP | gradient | ) |
Create a clone of a KoSegmentGradientSP and return it casted to a krita abstract gradient.
| gradient | A KoSegmentGradientSP gradient to convert from |
Definition at line 219 of file KisGradientConversion.cpp.
| KRITAPIGMENT_EXPORT KoAbstractGradientSP KisGradientConversion::toAbstractGradient | ( | KoStopGradientSP | gradient | ) |
Create a clone of a KoStopGradientSP and return it casted to a krita abstract gradient.
| gradient | A KoStopGradientSP gradient to convert from |
Definition at line 211 of file KisGradientConversion.cpp.
| KoGradientStop KisGradientConversion::toKoGradientStop | ( | const KoColor & | color, |
| KoGradientSegmentEndpointType | type, | ||
| qreal | offset, | ||
| KoCanvasResourcesInterfaceSP | canvasResourcesInterface ) |
Definition at line 272 of file KisGradientConversion.cpp.
References BACKGROUND_ENDPOINT, BACKGROUND_TRANSPARENT_ENDPOINT, KoCanvasResource::BackgroundColor, BACKGROUNDSTOP, KoGradientStop::color, COLORSTOP, FOREGROUND_ENDPOINT, FOREGROUND_TRANSPARENT_ENDPOINT, KoCanvasResource::ForegroundColor, FOREGROUNDSTOP, KoGradientStop::position, KoColor::setOpacity(), and KoGradientStop::type.
| KRITAPIGMENT_EXPORT QGradient * KisGradientConversion::toQGradient | ( | KoAbstractGradientSP | gradient, |
| KoCanvasResourcesInterfaceSP | canvasResourcesInterface = nullptr ) |
Convert a KoAbstractGradientSP to a QGradient.
This function makes use of toQGradient(KoStopGradientSP, KoCanvasResourcesInterfaceSP) and toQGradient(KoSegmentGradientSP, KoCanvasResourcesInterfaceSP)
| gradient | A KoAbstractGradientSP to convert from |
| canvasResourcesInterface | KoCanvasResourcesInterfaceSP used if some of the gradient stops should take the foreground/background color |
Definition at line 165 of file KisGradientConversion.cpp.
References toQGradient().
| KRITAPIGMENT_EXPORT QGradient * KisGradientConversion::toQGradient | ( | KoSegmentGradientSP | gradient, |
| KoCanvasResourcesInterfaceSP | canvasResourcesInterface = nullptr ) |
Convert a KoSegmentGradientSP to a QGradient.
Creates a QLinearGradient and sets its stops using toQGradientStops(KoSegmentGradientSP, KoCanvasResourcesInterfaceSP)
| gradient | A KoSegmentGradientSP to convert from |
| canvasResourcesInterface | KoCanvasResourcesInterfaceSP used if some of the gradient stops should take the foreground/background color |
Definition at line 188 of file KisGradientConversion.cpp.
References toQGradientStops().
| KRITAPIGMENT_EXPORT QGradient * KisGradientConversion::toQGradient | ( | KoStopGradientSP | gradient, |
| KoCanvasResourcesInterfaceSP | canvasResourcesInterface = nullptr ) |
Convert a KoStopGradientSP to a QGradient.
This function doesn't use the stop gradient's type and start/stop positions to create different types of QGradient. This just creates a QLinearGradient and sets its stops using toQGradientStops(KoStopGradientSP, KoCanvasResourcesInterfaceSP). To get the correct type of QGradient use KoStopGradient::toQGradient()
| gradient | A KoStopGradientSP to convert from |
| canvasResourcesInterface | KoCanvasResourcesInterfaceSP used if some of the gradient stops should take the foreground/background color |
Definition at line 178 of file KisGradientConversion.cpp.
References toQGradientStops().
| QGradientStop KisGradientConversion::toQGradientStop | ( | const KoColor & | color, |
| KoGradientSegmentEndpointType | type, | ||
| qreal | offset, | ||
| KoCanvasResourcesInterfaceSP | canvasResourcesInterface ) |
Definition at line 82 of file KisGradientConversion.cpp.
References BACKGROUND_ENDPOINT, BACKGROUND_TRANSPARENT_ENDPOINT, KoCanvasResource::BackgroundColor, FOREGROUND_ENDPOINT, FOREGROUND_TRANSPARENT_ENDPOINT, KoCanvasResource::ForegroundColor, and KoColor::toQColor().
| QGradientStop KisGradientConversion::toQGradientStop | ( | const KoColor & | color, |
| KoGradientStopType | type, | ||
| qreal | position, | ||
| KoCanvasResourcesInterfaceSP | canvasResourcesInterface ) |
Definition at line 32 of file KisGradientConversion.cpp.
References KoCanvasResource::BackgroundColor, BACKGROUNDSTOP, KoCanvasResource::ForegroundColor, FOREGROUNDSTOP, and KoColor::toQColor().
| KRITAPIGMENT_EXPORT QGradientStops KisGradientConversion::toQGradientStops | ( | KoAbstractGradientSP | gradient, |
| KoCanvasResourcesInterfaceSP | canvasResourcesInterface = nullptr ) |
Convert a KoAbstractGradientSP to a QGradientStop list.
This function makes use of toQGradientStops(KoStopGradientSP, KoCanvasResourcesInterfaceSP) and toQGradientStops(KoSegmentGradientSP, KoCanvasResourcesInterfaceSP)
| gradient | A KoAbstractGradientSP to convert from |
| canvasResourcesInterface | KoCanvasResourcesInterfaceSP used if some of the gradient stops should take the foreground/background color |
Definition at line 18 of file KisGradientConversion.cpp.
References toQGradientStops().
| KRITAPIGMENT_EXPORT QGradientStops KisGradientConversion::toQGradientStops | ( | KoSegmentGradientSP | gradient, |
| KoCanvasResourcesInterfaceSP | canvasResourcesInterface = nullptr ) |
Convert a KoSegmentGradientSP to a QGradientStop list.
For each segment in the segment gradient two QGradientStop are created, one for the start point and another one for the end point.
To convert end points that have FOREGROUND_ENDPOINT, BACKGROUND_ENDPOINT, FOREGROUND_TRANSPARENT_ENDPOINT or BACKGROUND_TRANSPARENT_ENDPOINT type, the canvasResourcesInterface is used. If the canvasResourcesInterface is null, the color field of the end point is used.
The opacity of the QGradientStop color is set to 0 if the end point type is FOREGROUND_TRANSPARENT_ENDPOINT or BACKGROUND_TRANSPARENT_ENDPOINT.
If two QGradientStop turn out to be in the same position and have the same color, they are collapsed and only one stop is added to the list (This prevents having duplicated stops due to the end point of a segment being equal to the start point of the next segment).
The middle point, interpolation and color interpolation of the segment are ignored, so some information may be lost
| gradient | A KoSegmentGradientSP to convert from |
| canvasResourcesInterface | KoCanvasResourcesInterfaceSP used if some of the gradient stops should take the foreground/background color |
Definition at line 116 of file KisGradientConversion.cpp.
References qFuzzyCompare(), and toQGradientStop().
| KRITAPIGMENT_EXPORT QGradientStops KisGradientConversion::toQGradientStops | ( | KoStopGradientSP | gradient, |
| KoCanvasResourcesInterfaceSP | canvasResourcesInterface = nullptr ) |
Convert a KoStopGradientSP to a QGradientStop list.
For each stop in the stop gradient a QGradientStop is created.
To convert stops that have FOREGROUNDSTOP or BACKGROUNDSTOP type, the canvasResourcesInterface is used. If the canvasResourcesInterface is null, the color field of the stop is used
| gradient | A KoStopGradientSP to convert from |
| canvasResourcesInterface | KoCanvasResourcesInterfaceSP used if some of the gradient stops should take the foreground/background color |
Definition at line 54 of file KisGradientConversion.cpp.
References qFuzzyCompare(), and toQGradientStop().
| KRITAPIGMENT_EXPORT KoSegmentGradientSP KisGradientConversion::toSegmentGradient | ( | const QGradient * | gradient | ) |
Convert a QGradient to a krita segment gradient.
Creates a segment gradient from the stops of the QGradient using toSegmentGradient(const QGradientStops &)
| gradient | A QGradient with the stops of the gradient |
Definition at line 381 of file KisGradientConversion.cpp.
References toSegmentGradient().
| KRITAPIGMENT_EXPORT KoSegmentGradientSP KisGradientConversion::toSegmentGradient | ( | const QGradientStops & | gradient | ) |
Convert a QGradientStop list to a krita segment gradient.
If two stops have the same position a new segment between them is not created
| gradient | A QGradientStop list with the stops of the gradient |
Definition at line 360 of file KisGradientConversion.cpp.
References COLOR_INTERP_RGB, INTERP_LINEAR, and qFuzzyCompare().
| KRITAPIGMENT_EXPORT KoSegmentGradientSP KisGradientConversion::toSegmentGradient | ( | KoAbstractGradientSP | gradient | ) |
Convert a krita abstract gradient to a krita segment gradient.
If the underlying gradient is a stop gradient, toSegmentGradient(KoStopGradientSP) is used; otherwise, if it is a segment gradient, a clone is returned
| gradient | A KoAbstractGradientSP to convert from |
Definition at line 392 of file KisGradientConversion.cpp.
References toSegmentGradient().
| KRITAPIGMENT_EXPORT KoSegmentGradientSP KisGradientConversion::toSegmentGradient | ( | KoStopGradientSP | gradient | ) |
Convert a krita stop gradient to a krita segment gradient.
If two stops have the same position a new segment is not created
| gradient | A KoStopGradientSP to convert from |
Definition at line 405 of file KisGradientConversion.cpp.
References BACKGROUND_ENDPOINT, BACKGROUNDSTOP, COLOR_ENDPOINT, COLOR_INTERP_RGB, FOREGROUND_ENDPOINT, FOREGROUNDSTOP, INTERP_LINEAR, and qFuzzyCompare().
| KRITAPIGMENT_EXPORT KoStopGradientSP KisGradientConversion::toStopGradient | ( | const QGradient * | gradient | ) |
Convert the stops of a QGradient to a KoStopGradientSP.
| gradient | A QGradient with the stops of the gradient |
Definition at line 247 of file KisGradientConversion.cpp.
References toStopGradient().
| KRITAPIGMENT_EXPORT KoStopGradientSP KisGradientConversion::toStopGradient | ( | const QGradientStops & | gradient | ) |
Convert a QGradientStop list to a KoStopGradientSP.
| gradient | A QGradientStop list with the stops of the gradient |
Definition at line 227 of file KisGradientConversion.cpp.
References KoGradientStop::color, COLORSTOP, KoGradientStop::position, and KoGradientStop::type.
| KRITAPIGMENT_EXPORT KoStopGradientSP KisGradientConversion::toStopGradient | ( | KoAbstractGradientSP | gradient, |
| KoCanvasResourcesInterfaceSP | canvasResourcesInterface = nullptr ) |
Convert a KoAbstractGradientSP to a KoStopGradientSP.
If the underlying gradient is a segment gradient, toStopGradient(KoSegmentGradientSP, KoCanvasResourcesInterfaceSP) is used; otherwise, if it is a stop gradient, a clone is returned
| gradient | A KoAbstractGradientSP to convert from |
Definition at line 258 of file KisGradientConversion.cpp.
References toStopGradient().
| KRITAPIGMENT_EXPORT KoStopGradientSP KisGradientConversion::toStopGradient | ( | KoSegmentGradientSP | gradient, |
| KoCanvasResourcesInterfaceSP | canvasResourcesInterface = nullptr ) |
Convert a KoSegmentGradientSP to a KoStopGradientSP.
For each segment in the segment gradient two stops are created, one for the start point and another one for the end point.
To convert end points that have FOREGROUND_TRANSPARENT_ENDPOINT or BACKGROUND_TRANSPARENT_ENDPOINT type, the stop type is set to the COLORSTOP and the canvasResourcesInterface is used to set the stop color if it is not null. If the canvasResourcesInterface is null, the color field of the end point is used.
The opacity of the stop color is set to 0 if the end point type is FOREGROUND_TRANSPARENT_ENDPOINT or BACKGROUND_TRANSPARENT_ENDPOINT.
If two stops turn out to be in the same position and have the same type and color, they are collapsed and only one stop is added to the list (This prevents having duplicated stops due to the end point of a segment being equal to the start point of the next segment).
The middle point, interpolation and color interpolation of the segment are ignored, so some information may be lost
| gradient | A KoSegmentGradientSP gradient to convert from |
| canvasResourcesInterface | KoCanvasResourcesInterfaceSP used if some of the gradient end points have FOREGROUND_TRANSPARENT_ENDPOINT or BACKGROUND_TRANSPARENT_ENDPOINT type |
Definition at line 309 of file KisGradientConversion.cpp.
References KoGradientStop::color, KoColor::convertTo(), KoGradientStop::position, qFuzzyCompare(), toKoGradientStop(), and KoGradientStop::type.