diff --git a/libs/pigment/colorspaces/KoAlphaF16ColorSpace.h b/libs/pigment/colorspaces/KoAlphaF16ColorSpace.h index 2033bf0a8a..022f608264 100644 --- a/libs/pigment/colorspaces/KoAlphaF16ColorSpace.h +++ b/libs/pigment/colorspaces/KoAlphaF16ColorSpace.h @@ -1,189 +1,189 @@ /* * Copyright (c) 2004 Boudewijn Rempt * Copyright (c) 2006 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KOF16ALPHACOLORSPACE_H #define KOF16ALPHACOLORSPACE_H #include #include "DebugPigment.h" #include "kritapigment_export.h" #include "KoColorSpaceAbstract.h" #include "KoColorSpaceTraits.h" #include "KoColorModelStandardIds.h" #include "KoSimpleColorSpaceFactory.h" #include typedef KoColorSpaceTrait AlphaF16Traits; class QBitArray; /** * The alpha mask is a special color strategy that treats all pixels as * alpha value with a color common to the mask. The default color is white. */ class KRITAPIGMENT_EXPORT KoAlphaF16ColorSpace : public KoColorSpaceAbstract { public: KoAlphaF16ColorSpace(); virtual ~KoAlphaF16ColorSpace(); static QString colorSpaceId() { return "ALPHAF16"; } virtual KoID colorModelId() const { return AlphaColorModelID; } virtual KoID colorDepthId() const { - return Integer8BitsColorDepthID; + return Float16BitsColorDepthID; } virtual KoColorSpace* clone() const; virtual bool willDegrade(ColorSpaceIndependence independence) const { Q_UNUSED(independence); return false; } virtual bool profileIsCompatible(const KoColorProfile* /*profile*/) const { return false; } virtual void fromQColor(const QColor& color, quint8 *dst, const KoColorProfile * profile = 0) const; virtual void toQColor(const quint8 *src, QColor *c, const KoColorProfile * profile = 0) const; virtual quint8 difference(const quint8 *src1, const quint8 *src2) const; virtual quint8 differenceA(const quint8 *src1, const quint8 *src2) const; virtual quint32 colorChannelCount() const { return 0; } virtual QString channelValueText(const quint8 *pixel, quint32 channelIndex) const; virtual QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) const; virtual void convolveColors(quint8** colors, qreal* kernelValues, quint8 *dst, qreal factor, qreal offset, qint32 nColors, const QBitArray & channelFlags) const; virtual quint32 colorSpaceType() const { return 0; } virtual bool hasHighDynamicRange() const { return false; } virtual const KoColorProfile* profile() const { return m_profile; } virtual QImage convertToQImage(const quint8 *data, qint32 width, qint32 height, const KoColorProfile * dstProfile, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const; virtual void toLabA16(const quint8* src, quint8* dst, quint32 nPixels) const { quint16* lab = reinterpret_cast(dst); while (nPixels--) { lab[3] = src[0]; src++; lab += 4; } } virtual void fromLabA16(const quint8* src, quint8* dst, quint32 nPixels) const { const quint16* lab = reinterpret_cast(src); while (nPixels--) { dst[0] = lab[3]; dst++; lab += 4; } } virtual void toRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const { quint16* rgb = reinterpret_cast(dst); while (nPixels--) { rgb[3] = src[0]; src++; rgb += 4; } } virtual void fromRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const { const quint16* rgb = reinterpret_cast(src); while (nPixels--) { dst[0] = rgb[3]; dst++; rgb += 4; } } virtual KoColorTransformation* createBrightnessContrastAdjustment(const quint16* transferValues) const { Q_UNUSED(transferValues); warnPigment << i18n("Undefined operation in the alpha color space"); return 0; } virtual KoColorTransformation* createPerChannelAdjustment(const quint16* const*) const { warnPigment << i18n("Undefined operation in the alpha color space"); return 0; } virtual KoColorTransformation *createDarkenAdjustment(qint32 , bool , qreal) const { warnPigment << i18n("Undefined operation in the alpha color space"); return 0; } virtual void invertColor(quint8*, qint32) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual void colorToXML(const quint8* , QDomDocument& , QDomElement&) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual void colorFromXML(quint8* , const QDomElement&) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual void toHSY(const QVector &, qreal *, qreal *, qreal *) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual QVector fromHSY(qreal *, qreal *, qreal *) const { warnPigment << i18n("Undefined operation in the alpha color space"); QVector channelValues (1); channelValues.fill(0.0); return channelValues; } virtual void toYUV(const QVector &, qreal *, qreal *, qreal *) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual QVector fromYUV(qreal *, qreal *, qreal *) const { warnPigment << i18n("Undefined operation in the alpha color space"); QVector channelValues (1); channelValues.fill(0.0); return channelValues; } protected: virtual bool preferCompositionInSourceColorSpace() const; private: KoColorProfile* m_profile; QList m_compositeOps; }; #endif diff --git a/libs/pigment/colorspaces/KoAlphaF32ColorSpace.h b/libs/pigment/colorspaces/KoAlphaF32ColorSpace.h index 45c19ee746..06b622f59f 100644 --- a/libs/pigment/colorspaces/KoAlphaF32ColorSpace.h +++ b/libs/pigment/colorspaces/KoAlphaF32ColorSpace.h @@ -1,189 +1,189 @@ /* * Copyright (c) 2016 Boudewijn Rempt * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KOALPHAF32COLORSPACE_H #define KOALPHAF32COLORSPACE_H #include #include "DebugPigment.h" #include "kritapigment_export.h" #include "KoColorSpaceAbstract.h" #include "KoColorSpaceTraits.h" #include "KoColorModelStandardIds.h" #include "KoSimpleColorSpaceFactory.h" typedef KoColorSpaceTrait AlphaF32Traits; class QBitArray; /** * The alpha mask is a special color strategy that treats all pixels as * alpha value with a color common to the mask. The default color is white. */ class KRITAPIGMENT_EXPORT KoAlphaF32ColorSpace : public KoColorSpaceAbstract { public: KoAlphaF32ColorSpace(); virtual ~KoAlphaF32ColorSpace(); static QString colorSpaceId() { return "ALPHAF32"; } virtual KoID colorModelId() const { return AlphaColorModelID; } virtual KoID colorDepthId() const { - return Integer8BitsColorDepthID; + return Float32BitsColorDepthID; } virtual KoColorSpace* clone() const; virtual bool willDegrade(ColorSpaceIndependence independence) const { Q_UNUSED(independence); return false; } virtual bool profileIsCompatible(const KoColorProfile* /*profile*/) const { return false; } virtual void fromQColor(const QColor& color, quint8 *dst, const KoColorProfile * profile = 0) const; virtual void toQColor(const quint8 *src, QColor *c, const KoColorProfile * profile = 0) const; virtual quint8 difference(const quint8 *src1, const quint8 *src2) const; virtual quint8 differenceA(const quint8 *src1, const quint8 *src2) const; virtual quint32 colorChannelCount() const { return 0; } virtual QString channelValueText(const quint8 *pixel, quint32 channelIndex) const; virtual QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) const; virtual void convolveColors(quint8** colors, qreal* kernelValues, quint8 *dst, qreal factor, qreal offset, qint32 nColors, const QBitArray & channelFlags) const; virtual quint32 colorSpaceType() const { return 0; } virtual bool hasHighDynamicRange() const { return false; } virtual const KoColorProfile* profile() const { return m_profile; } virtual QImage convertToQImage(const quint8 *data, qint32 width, qint32 height, const KoColorProfile * dstProfile, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const; virtual void toLabA16(const quint8* src, quint8* dst, quint32 nPixels) const { quint16* lab = reinterpret_cast(dst); while (nPixels--) { lab[3] = src[0]; src++; lab += 4; } } virtual void fromLabA16(const quint8* src, quint8* dst, quint32 nPixels) const { const quint16* lab = reinterpret_cast(src); while (nPixels--) { dst[0] = lab[3]; dst++; lab += 4; } } virtual void toRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const { quint16* rgb = reinterpret_cast(dst); while (nPixels--) { rgb[3] = src[0]; src++; rgb += 4; } } virtual void fromRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const { const quint16* rgb = reinterpret_cast(src); while (nPixels--) { dst[0] = rgb[3]; dst++; rgb += 4; } } virtual KoColorTransformation* createBrightnessContrastAdjustment(const quint16* transferValues) const { Q_UNUSED(transferValues); warnPigment << i18n("Undefined operation in the alpha color space"); return 0; } virtual KoColorTransformation* createPerChannelAdjustment(const quint16* const*) const { warnPigment << i18n("Undefined operation in the alpha color space"); return 0; } virtual KoColorTransformation *createDarkenAdjustment(qint32 , bool , qreal) const { warnPigment << i18n("Undefined operation in the alpha color space"); return 0; } virtual void invertColor(quint8*, qint32) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual void colorToXML(const quint8* , QDomDocument& , QDomElement&) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual void colorFromXML(quint8* , const QDomElement&) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual void toHSY(const QVector &, qreal *, qreal *, qreal *) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual QVector fromHSY(qreal *, qreal *, qreal *) const { warnPigment << i18n("Undefined operation in the alpha color space"); QVector channelValues (1); channelValues.fill(0.0); return channelValues; } virtual void toYUV(const QVector &, qreal *, qreal *, qreal *) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual QVector fromYUV(qreal *, qreal *, qreal *) const { warnPigment << i18n("Undefined operation in the alpha color space"); QVector channelValues (1); channelValues.fill(0.0); return channelValues; } protected: virtual bool preferCompositionInSourceColorSpace() const; private: KoColorProfile* m_profile; QList m_compositeOps; }; #endif diff --git a/libs/pigment/colorspaces/KoAlphaU16ColorSpace.h b/libs/pigment/colorspaces/KoAlphaU16ColorSpace.h index 67fbdd52db..501fd86181 100644 --- a/libs/pigment/colorspaces/KoAlphaU16ColorSpace.h +++ b/libs/pigment/colorspaces/KoAlphaU16ColorSpace.h @@ -1,187 +1,187 @@ /* * Copyright (c) 2016 Boudewijn Rempt * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KOALPHAU16COLORSPACE_H #define KOALPHAU16COLORSPACE_H #include #include "DebugPigment.h" #include "kritapigment_export.h" #include "KoColorSpaceAbstract.h" #include "KoColorSpaceTraits.h" #include "KoColorModelStandardIds.h" #include "KoSimpleColorSpaceFactory.h" typedef KoColorSpaceTrait AlphaU16Traits; class QBitArray; /** * The alpha mask is a special color strategy that treats all pixels as * alpha value with a color common to the mask. The default color is white. */ class KRITAPIGMENT_EXPORT KoAlphaU16ColorSpace : public KoColorSpaceAbstract { public: KoAlphaU16ColorSpace(); virtual ~KoAlphaU16ColorSpace(); static QString colorSpaceId() { return "ALPHAU16"; } virtual KoID colorModelId() const { return AlphaColorModelID; } virtual KoID colorDepthId() const { - return Integer8BitsColorDepthID; + return Integer16BitsColorDepthID; } virtual KoColorSpace* clone() const; virtual bool willDegrade(ColorSpaceIndependence independence) const { Q_UNUSED(independence); return false; } virtual bool profileIsCompatible(const KoColorProfile* /*profile*/) const { return false; } virtual void fromQColor(const QColor& color, quint8 *dst, const KoColorProfile * profile = 0) const; virtual void toQColor(const quint8 *src, QColor *c, const KoColorProfile * profile = 0) const; virtual quint8 difference(const quint8 *src1, const quint8 *src2) const; virtual quint8 differenceA(const quint8 *src1, const quint8 *src2) const; virtual quint32 colorChannelCount() const { return 0; } virtual QString channelValueText(const quint8 *pixel, quint32 channelIndex) const; virtual QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) const; virtual void convolveColors(quint8** colors, qreal* kernelValues, quint8 *dst, qreal factor, qreal offset, qint32 nColors, const QBitArray & channelFlags) const; virtual quint32 colorSpaceType() const { return 0; } virtual bool hasHighDynamicRange() const { return false; } virtual const KoColorProfile* profile() const { return m_profile; } virtual QImage convertToQImage(const quint8 *data, qint32 width, qint32 height, const KoColorProfile * dstProfile, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const; virtual void toLabA16(const quint8* src, quint8* dst, quint32 nPixels) const { quint16* lab = reinterpret_cast(dst); while (nPixels--) { lab[3] = src[0]; src++; lab += 4; } } virtual void fromLabA16(const quint8* src, quint8* dst, quint32 nPixels) const { const quint16* lab = reinterpret_cast(src); while (nPixels--) { dst[0] = lab[3]; dst++; lab += 4; } } virtual void toRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const { quint16* rgb = reinterpret_cast(dst); while (nPixels--) { rgb[3] = src[0]; src++; rgb += 4; } } virtual void fromRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const { const quint16* rgb = reinterpret_cast(src); while (nPixels--) { dst[0] = rgb[3]; dst++; rgb += 4; } } virtual KoColorTransformation* createBrightnessContrastAdjustment(const quint16* transferValues) const { Q_UNUSED(transferValues); warnPigment << i18n("Undefined operation in the alpha color space"); return 0; } virtual KoColorTransformation* createPerChannelAdjustment(const quint16* const*) const { warnPigment << i18n("Undefined operation in the alpha color space"); return 0; } virtual KoColorTransformation *createDarkenAdjustment(qint32 , bool , qreal) const { warnPigment << i18n("Undefined operation in the alpha color space"); return 0; } virtual void invertColor(quint8*, qint32) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual void colorToXML(const quint8* , QDomDocument& , QDomElement&) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual void colorFromXML(quint8* , const QDomElement&) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual void toHSY(const QVector &, qreal *, qreal *, qreal *) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual QVector fromHSY(qreal *, qreal *, qreal *) const { warnPigment << i18n("Undefined operation in the alpha color space"); QVector channelValues (1); channelValues.fill(0.0); return channelValues; } virtual void toYUV(const QVector &, qreal *, qreal *, qreal *) const { warnPigment << i18n("Undefined operation in the alpha color space"); } virtual QVector fromYUV(qreal *, qreal *, qreal *) const { warnPigment << i18n("Undefined operation in the alpha color space"); QVector channelValues (1); channelValues.fill(0.0); return channelValues; } protected: virtual bool preferCompositionInSourceColorSpace() const; private: KoColorProfile* m_profile; QList m_compositeOps; }; #endif