10#include <lager/lenses/tuple.hpp>
16auto brushSizeLens = lager::lenses::getset(
17 [](
const std::tuple<QSize, qreal> &x) -> qreal {
return std::get<0>(x).width() * std::get<1>(x); },
18 [](std::tuple<QSize, qreal>
x, qreal brushSize) -> std::tuple<QSize, qreal> {
19 return std::make_tuple(std::get<0>(x), brushSize / std::get<0>(x).width());
26 values << i18n(
"Alpha mask");
27 toolTips << i18nc(
"@info:tooltip",
"Luminosity of the brush tip image is used as alpha channel for the stroke");
29 values << i18n(
"Color image");
30 toolTips << i18nc(
"@info:tooltip",
"The brush tip image is painted as it is");
31 if (supportsHSLBrushTips) {
32 values << i18n(
"Lightness map");
33 toolTips << i18nc(
"@info:tooltip",
"Luminosity of the brush tip image is used as lightness correction for the painting color. Alpha channel of the brush tip image is used as alpha for the final stroke");
34 values << i18n(
"Gradient map");
35 toolTips << i18nc(
"@info:tooltip",
"The brush tip maps its value to the currently selected gradient. Alpha channel of the brush tip image is used as alpha for the final stroke");
40 int currentValue = std::clamp((
int)application, 0, (
int)values.size() - 1);
41 return ComboBoxState{values, currentValue, values.size() > 1, toolTips};
46 QString brushTypeString =
"";
48 QString animatedBrushTipSelectionMode;
51 brushTypeString = i18n(
"Invalid");
53 brushTypeString = i18n(
"Mask");
55 brushTypeString = i18n(
"Image");
57 brushTypeString = i18n(
"Animated mask");
60 brushTypeString = i18n(
"Animated image");
63 const QString brushDetailsText = QString(
"%1 (%2 × %3) %4")
67 .arg(animatedBrushTipSelectionMode);
69 return brushDetailsText;
72auto effectiveResourceData = lager::lenses::getset(
75 return predefinedDataArg;
97 return predefinedData;
109 lager::cursor<PredefinedBrushData> predefinedBrushData,
110 lager::cursor<qreal> commonBrushSizeData,
111 bool supportsHSLBrushTips)
112 : m_commonData(commonData),
113 m_predefinedBrushData(predefinedBrushData),
114 m_supportsHSLBrushTips(supportsHSLBrushTips),
115 m_commonBrushSizeData(commonBrushSizeData),
116 m_effectivePredefinedData(m_predefinedBrushData.zoom(effectiveResourceData)),
121 .zoom(kislager::lenses::do_static_cast<enumBrushApplication, int>)},
125 .zoom(kislager::lenses::do_static_cast<quint8, int>)},
128 kiszug::map_static_cast<qreal> | kiszug::map_multiply<qreal>(0.01))},
131 kiszug::map_static_cast<qreal> | kiszug::map_multiply<qreal>(0.01))},
133 .zoom(kislager::lenses::scale<qreal>(180.0 /
M_PI))},
144 m_supportsHSLBrushTips,
146 .xform(zug::map(&calcApplicationSwitchState))},
148 .xform(kiszug::map_greater<int>(1))},
150 LAGER_QT(brushDetails) {m_effectivePredefinedData.map(&calcBrushDetails)},
164 LAGER_QT(applicationSwitchState)->currentIndex);
178 return lager::view(brushSizeLens, std::make_tuple(predefinedData.
baseSize, predefinedData.
scale));
184 lager::set(brushSizeLens, std::make_tuple(predefinedData.
baseSize, predefinedData.
scale),
value);
float value(const T *src, size_t ch)
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
static KisResourcesInterfaceSP instance()
static void loadFromBrushResource(KisBrushModel::CommonData &commonData, KisBrushModel::PredefinedBrushData &predefinedBrushData, KisBrushSP brushResource)
static qreal effectiveBrushSize(PredefinedBrushData predefinedData)
lager::cursor< qreal > m_commonBrushSizeData
PredefinedBrushData bakedOptionData() const
KisPredefinedBrushModel(lager::cursor< CommonData > commonData, lager::cursor< PredefinedBrushData > predefinedBrushData, lager::cursor< qreal > commonBrushSizeData, bool supportsHSLBrushTips)
static enumBrushApplication effectiveBrushApplication(PredefinedBrushData predefinedData, bool supportsHSLBrushTips)
static void setEffectiveBrushSize(PredefinedBrushData &predefinedData, qreal value)
lager::cursor< PredefinedBrushData > m_effectivePredefinedData
A simple wrapper object for the main information about the resource.
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
QString parasiteSelection
KoResourceSignature resourceSignature
quint8 adjustmentMidPoint
qreal brightnessAdjustment
enumBrushApplication application
bool hasColorAndTransparency