12#include <klocalizedstring.h>
21#define SCALE_TO_FLOAT( v ) KoColorSpaceMaths< _channel_type_, float>::scaleToA( v )
22#define SCALE_FROM_FLOAT( v ) KoColorSpaceMaths< float, _channel_type_>::scaleToA( v )
24template<
typename _channel_type_,
typename traits>
37 void transform(
const quint8 *srcU8, quint8 *dstU8, qint32 nPixels)
const override
52 gray = (qMax(qMax(r, g), b) + qMin(qMin(r, g), b)) / 2;
57 gray = r * 0.2126 + g * 0.7152 + b * 0.0722;
64 gray = r * 0.299 + g * 0.587 + b * 0.114;
70 gray = (r + g + b) / 3;
75 gray = qMin(qMin(r, g), b);
80 gray = qMax(qMax(r, g), b);
90 dst->alpha = src->alpha;
107 if (name ==
"type") {
124 m_type = parameter.toDouble();
157 dbgKrita <<
"Unsupported color space " << colorSpace->
id() <<
" in KisDesaturateAdjustmentFactory::createTransformation";
174 dbgKrita <<
"Unsupported color space " << colorSpace->
id() <<
" in KisDesaturateAdjustmentFactory::createTransformation";
const KoID Float32BitsColorDepthID("F32", ki18n("32-bit float/channel"))
const KoID Float16BitsColorDepthID("F16", ki18n("16-bit float/channel"))
const KoID Integer8BitsColorDepthID("U8", ki18n("8-bit integer/channel"))
const KoID Integer16BitsColorDepthID("U16", ki18n("16-bit integer/channel"))
const KoID RGBAColorModelID("RGBA", ki18n("RGB/Alpha"))
KisDesaturateAdjustmentFactory()
QList< QPair< KoID, KoID > > supportedModels() const override
KoColorTransformation * createTransformation(const KoColorSpace *colorSpace, QHash< QString, QVariant > parameters) const override
void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const override
int parameterId(const QString &name) const override
QList< QString > parameters() const override
void setParameter(int id, const QVariant ¶meter) override
KisDesaturateAdjustment()
virtual KoID colorModelId() const =0
virtual KoID colorDepthId() const =0
#define SCALE_FROM_FLOAT(v)
#define SCALE_TO_FLOAT(v)