Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPropagateColorsFilterConfiguration.cpp
Go to the documentation of this file.
1/*
2 * KDE. Krita Project.
3 *
4 * SPDX-FileCopyrightText: 2024 Deif Lou <ginoba@gmail.com>
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
10
12 : KisFilterConfiguration(defaultId(), defaultVersion(), resourcesInterface)
13{
15}
16
22
25
30
32{
33 const QString distanceMetricStr = getString("distanceMetric", "");
34 if (distanceMetricStr == "chessboard") {
36 } else if (distanceMetricStr == "cityBlock") {
38 } else if (distanceMetricStr == "euclidean") {
40 }
41 return defaultDistanceMetric();
42}
43
45{
46 const QString expansionModeStr = getString("expansionMode", "");
47 if (expansionModeStr == "bounded") {
49 } else if (expansionModeStr == "unbounded") {
51 }
52 return defaultExpansionMode();
53}
54
59
61{
62 const QString alphaChannelModeStr = getString("alphaChannelMode", "expand");
63 if (alphaChannelModeStr == "preserve") {
65 } else if (alphaChannelModeStr == "expand") {
67 }
69}
70
72{
73 if (newDistanceMetric == DistanceMetric_Chessboard) {
74 setProperty("distanceMetric", "chessboard");
75 } else if (newDistanceMetric == DistanceMetric_CityBlock) {
76 setProperty("distanceMetric", "cityBlock");
77 } else {
78 setProperty("distanceMetric", "euclidean");
79 }
80}
81
83{
84 if (newExpansionMode == ExpansionMode_Bounded) {
85 setProperty("expansionMode", "bounded");
86 } else {
87 setProperty("expansionMode", "unbounded");
88 }
89}
90
92{
93 setProperty("expansionAmount", newExpansionAmount);
94}
95
97{
98 if (newAlphaChannelMode == AlphaChannelMode_Preserve) {
99 setProperty("alphaChannelMode", "preserve");
100 } else {
101 setProperty("alphaChannelMode", "expand");
102 }
103}
104
void setAlphaChannelMode(AlphaChannelMode newAlphaChannelMode)
KisPropagateColorsFilterConfiguration(KisResourcesInterfaceSP resourcesInterface)
static constexpr AlphaChannelMode defaultAlphaChannelMode()
void setDistanceMetric(DistanceMetric newDistanceMetric)
QString getString(const QString &name, const QString &def=QString()) const
virtual void setProperty(const QString &name, const QVariant &value)
double getDouble(const QString &name, double def=0.0) const