From kde-commits Sun Jun 30 21:32:10 2013 From: Sahil Nagpal Date: Sun, 30 Jun 2013 21:32:10 +0000 To: kde-commits Subject: [calligra/krita-gsoc-filters-sahil] krita/plugins/colorspaces/extensions: Removing The .cc Extension Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=137262799531838 Git commit 4730adc8c95ba2aaaf51e4ae834f61d347851dc6 by Sahil Nagpal. Committed on 30/06/2013 at 21:31. Pushed by sahilnagpal into branch 'krita-gsoc-filters-sahil'. Removing The .cc Extension Files D +0 -128 krita/plugins/colorspaces/extensions/kis_burnhighlights_adju= stment.cc D +0 -128 krita/plugins/colorspaces/extensions/kis_burnmidtones_adjust= ment.cc D +0 -127 krita/plugins/colorspaces/extensions/kis_burnshadows_adjustm= ent.cc D +0 -129 krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjus= tment.cc D +0 -127 krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjust= ment.cc D +0 -271 krita/plugins/colorspaces/extensions/kis_hsv_adjustment.cc http://commits.kde.org/calligra/4730adc8c95ba2aaaf51e4ae834f61d347851dc6 diff --git a/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjust= ment.cc b/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustmen= t.cc deleted file mode 100644 index 0521466..0000000 --- a/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.cc +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2013 Sahil Nagpal - * - * 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; version 2 - * of the License. - * - * 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 library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. -*/ - -#include "kis_burnhighlights_adjustment.h" -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -template -class KisBurnHighlightsAdjustment : public KoColorTransformation -{ - typedef KoBgrTraits<_channel_type_> RGBTrait; - typedef typename RGBTrait::Pixel RGBPixel; - -public: - KisBurnHighlightsAdjustment(){}; - - void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const - { - const RGBPixel* src =3D reinterpret_cast(srcU8); - RGBPixel* dst =3D reinterpret_cast(dstU8); - float r, g, b; - while(nPixels > 0) - { = - r =3D exposure * KoColorSpaceMaths<_channel_type_, float>::sca= leToA(src->red); - g =3D exposure * KoColorSpaceMaths<_channel_type_, float>::sca= leToA(src->green); - b =3D exposure * KoColorSpaceMaths<_channel_type_, float>::sca= leToA(src->blue); - = - dst->red =3D KoColorSpaceMaths< float, _channel_type_>::scaleT= oA(r); - dst->green =3D KoColorSpaceMaths< float, _channel_type_ >::sca= leToA(g); - dst->blue =3D KoColorSpaceMaths< float, _channel_type_>::scale= ToA(b); - dst->alpha =3D src->alpha; - = - --nPixels; - ++src; - ++dst; = - } - } - - virtual QList parameters() const - { - QList list; - list << "exposure"; - return list; - } - - virtual int parameterId(const QString& name) const - { - if (name =3D=3D "exposure") - return 0; - return -1; - } - - virtual void setParameter(int id, const QVariant& parameter) - { - switch(id) - { - case 0: - exposure =3D parameter.toDouble(); - break; - default: - ; - } - } -private: - - float exposure; - }; - - KisBurnHighlightsAdjustmentFactory::KisBurnHighlightsAdjustmentFactory() - : KoColorTransformationFactory("BurnHighlights", i18n("BurnHighlights = Adjustment")) -{ -} - -QList< QPair< KoID, KoID > > KisBurnHighlightsAdjustmentFactory::supported= Models() const -{ - QList< QPair< KoID, KoID > > l; - l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer8BitsColorDepth= ID)); - l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer16BitsColorDept= hID)); - l.append(QPair< KoID, KoID >(RGBAColorModelID , Float32BitsColorDepthI= D)); - return l; -} - -KoColorTransformation* KisBurnHighlightsAdjustmentFactory::createTransform= ation(const KoColorSpace* colorSpace, QHash parameters) = const -{ - KoColorTransformation * adj; - if (colorSpace->colorModelId() !=3D RGBAColorModelID) { - kError() << "Unsupported color space " << colorSpace->id() << " in= KisBurnHighlightsAdjustment::createTransformation"; - return 0; - } - if (colorSpace->colorDepthId() =3D=3D Integer8BitsColorDepthID) { - adj =3D new KisBurnHighlightsAdjustment< quint8 >(); - } else if (colorSpace->colorDepthId() =3D=3D Integer16BitsColorDepthID= ) { - adj =3D new KisBurnHighlightsAdjustment< quint16 >(); - } else if (colorSpace->colorDepthId() =3D=3D Float32BitsColorDepthID) { - adj =3D new KisBurnHighlightsAdjustment< float >(); - } else { - kError() << "Unsupported color space " << colorSpace->id() << " in= KisBurnHighlightsAdjustment::createTransformation"; - return 0; - } - adj->setParameters(parameters); - return adj; - -} diff --git a/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustme= nt.cc b/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.cc deleted file mode 100644 index 8861756..0000000 --- a/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.cc +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2013 Sahil Nagpal - * - * 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; version 2 - * of the License. - * - * 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 library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. -*/ - -#include "kis_burnmidtones_adjustment.h" -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -template -class KisBurnMidtonesAdjustment : public KoColorTransformation -{ - typedef KoBgrTraits<_channel_type_> RGBTrait; - typedef typename RGBTrait::Pixel RGBPixel; - -public: - KisBurnMidtonesAdjustment(){}; - - void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const - { - const RGBPixel* src =3D reinterpret_cast(srcU8); - RGBPixel* dst =3D reinterpret_cast(dstU8); - float r, g, b; = - while(nPixels > 0) - { = - r =3D pow(KoColorSpaceMaths<_channel_type_, float>::scaleToA(s= rc->red), exposure); - g =3D pow(KoColorSpaceMaths<_channel_type_, float>::scaleToA(s= rc->green), exposure); - b =3D pow(KoColorSpaceMaths<_channel_type_, float>::scaleToA(s= rc->blue), exposure); - = - dst->red =3D KoColorSpaceMaths< float, _channel_type_ >::scale= ToA(r); - dst->green =3D KoColorSpaceMaths< float, _channel_type_ >::sca= leToA(g); - dst->blue =3D KoColorSpaceMaths< float, _channel_type_ >::scal= eToA(b); - dst->alpha =3D src->alpha; - = - --nPixels; - ++src; - ++dst; - } - } - - virtual QList parameters() const - { - QList list; - list << "exposure"; - return list; - } - - virtual int parameterId(const QString& name) const - { - if (name =3D=3D "exposure") - return 0; - return -1; - } - - virtual void setParameter(int id, const QVariant& parameter) - { - switch(id) - { - case 0: - exposure =3D parameter.toDouble(); - break; - default: - ; - } - } -private: - - float exposure; - }; - - KisBurnMidtonesAdjustmentFactory::KisBurnMidtonesAdjustmentFactory() - : KoColorTransformationFactory("BurnMidtones", i18n("BurnMidtones Adju= stment")) -{ -} - -QList< QPair< KoID, KoID > > KisBurnMidtonesAdjustmentFactory::supportedMo= dels() const -{ - QList< QPair< KoID, KoID > > l; - l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer8BitsColorDepth= ID)); - l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer16BitsColorDept= hID)); - l.append(QPair< KoID, KoID >(RGBAColorModelID , Float32BitsColorDepthI= D)); - return l; -} - -KoColorTransformation* KisBurnMidtonesAdjustmentFactory::createTransformat= ion(const KoColorSpace* colorSpace, QHash parameters) co= nst -{ - KoColorTransformation * adj; - if (colorSpace->colorModelId() !=3D RGBAColorModelID) { - kError() << "Unsupported color space " << colorSpace->id() << " in= KisBurnMidtonesAdjustment::createTransformation"; - return 0; - } - if (colorSpace->colorDepthId() =3D=3D Float32BitsColorDepthID) { - adj =3D new KisBurnMidtonesAdjustment< float >(); - } else if (colorSpace->colorDepthId() =3D=3D Integer16BitsColorDepthID= ) { - adj =3D new KisBurnMidtonesAdjustment< quint16 >(); - } else if (colorSpace->colorDepthId() =3D=3D Integer8BitsColorDepthID)= { - adj =3D new KisBurnMidtonesAdjustment< quint8 >(); - } else { - kError() << "Unsupported color space " << colorSpace->id() << " in= KisBurnMidtonesAdjustment::createTransformation"; - return 0; - } - adj->setParameters(parameters); - return adj; - -} diff --git a/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustmen= t.cc b/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.cc deleted file mode 100644 index 5131ccf..0000000 --- a/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.cc +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2013 Sahil Nagpal - * - * 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; version 2 - * of the License. - * - * 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 library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. -*/ - -#include "kis_burnshadows_adjustment.h" -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -template -class KisBurnShadowsAdjustment : public KoColorTransformation - { - typedef KoBgrTraits<_channel_type_> RGBTrait; - typedef typename RGBTrait::Pixel RGBPixel; - -public: - KisBurnShadowsAdjustment(){}; - - void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const - { - const RGBPixel* src =3D reinterpret_cast(srcU8); - RGBPixel* dst =3D reinterpret_cast(dstU8); - float r, g, b; - while (nPixels > 0) { - r =3D (KoColorSpaceMaths<_channel_type_, float>::scaleToA(src-= >red) - exposure) / (1.0 - exposure); - g =3D (KoColorSpaceMaths<_channel_type_, float>::scaleToA(src-= >green) - exposure) / (1.0 - exposure); - b =3D (KoColorSpaceMaths<_channel_type_, float>::scaleToA(src-= >blue) - exposure) / (1.0 - exposure); - = - dst->red =3D KoColorSpaceMaths< float, _channel_type_ >::scale= ToA(r); - dst->green =3D KoColorSpaceMaths< float, _channel_type_ >::sca= leToA(g); - dst->blue =3D KoColorSpaceMaths< float, _channel_type_ >::scal= eToA(b); - dst->alpha =3D src->alpha; - = - --nPixels; - ++src; - ++dst; - } - } - - virtual QList parameters() const - { - QList list; - list << "exposure"; - return list; - } - - virtual int parameterId(const QString& name) const - { - if (name =3D=3D "exposure") - return 0; - return -1; - } - - virtual void setParameter(int id, const QVariant& parameter) - { - switch(id) - { - case 0: - exposure =3D parameter.toDouble(); - break; - default: - ; - } - } -private: - - float exposure; - }; - - KisBurnShadowsAdjustmentFactory::KisBurnShadowsAdjustmentFactory() - : KoColorTransformationFactory("BurnShadows", i18n("BurnShadows Adjust= ment")) -{ -} - -QList< QPair< KoID, KoID > > KisBurnShadowsAdjustmentFactory::supportedMod= els() const -{ - QList< QPair< KoID, KoID > > l; - l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer8BitsColorDepth= ID)); - l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer16BitsColorDept= hID)); - l.append(QPair< KoID, KoID >(RGBAColorModelID , Float32BitsColorDepthI= D)); - return l; -} - -KoColorTransformation* KisBurnShadowsAdjustmentFactory::createTransformati= on(const KoColorSpace* colorSpace, QHash parameters) con= st -{ - KoColorTransformation * adj; - if (colorSpace->colorModelId() !=3D RGBAColorModelID) { - kError() << "Unsupported color space " << colorSpace->id() << " in= KisBurnShadowsAdjustment::createTransformation"; - return 0; - } - if (colorSpace->colorDepthId() =3D=3D Integer8BitsColorDepthID) { - adj =3D new KisBurnShadowsAdjustment< quint8 >(); - } else if (colorSpace->colorDepthId() =3D=3D Integer16BitsColorDepthID= ) { - adj =3D new KisBurnShadowsAdjustment< quint16 >(); - } else if (colorSpace->colorDepthId() =3D=3D Float32BitsColorDepthID) { - adj =3D new KisBurnShadowsAdjustment< float >(); - } else { - kError() << "Unsupported color space " << colorSpace->id() << " in= KisBurnShadowsAdjustment::createTransformation"; - return 0; - } - adj->setParameters(parameters); - return adj; - -} diff --git a/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustm= ent.cc b/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.= cc deleted file mode 100644 index 260c108..0000000 --- a/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.cc +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2013 Sahil Nagpal - * - * 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; version 2 - * of the License. - * - * 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 library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. -*/ - -#include "kis_dodgemidtones_adjustment.h" -#include - -#include -#include - - #include - #include - #include - #include - #include - #include - = -template -class KisDodgeMidtonesAdjustment : public KoColorTransformation - { - typedef KoBgrTraits<_channel_type_> RGBTrait; - typedef typename RGBTrait::Pixel RGBPixel; - -public: - KisDodgeMidtonesAdjustment(){}; - -public: - = - void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) con= st - { - const RGBPixel* src =3D reinterpret_cast(srcU8); - RGBPixel* dst =3D reinterpret_cast(dstU8); - float r, g, b; = - while(nPixels > 0) - { = - r =3D pow(KoColorSpaceMaths<_channel_type_, float>::scaleToA(s= rc->red), exposure); - g =3D pow(KoColorSpaceMaths<_channel_type_, float>::scaleToA(s= rc->green), exposure); - b =3D pow(KoColorSpaceMaths<_channel_type_, float>::scaleToA(s= rc->blue), exposure); - = - dst->red =3D KoColorSpaceMaths< float, _channel_type_ >::scale= ToA(r); - dst->green =3D KoColorSpaceMaths< float, _channel_type_ >::sca= leToA(g); - dst->blue =3D KoColorSpaceMaths< float, _channel_type_ >::scal= eToA(b); - dst->alpha =3D src->alpha; - = - --nPixels; - ++src; - ++dst; - } - } - - virtual QList parameters() const - { - QList list; - list << "exposure"; - return list; - } - - virtual int parameterId(const QString& name) const - { - if (name =3D=3D "exposure") - return 0; - return -1; - } - - virtual void setParameter(int id, const QVariant& parameter) - { - switch(id) - { - case 0: - exposure =3D parameter.toDouble(); - break; - default: - ; - } - } -private: - - float exposure; -}; - - KisDodgeMidtonesAdjustmentFactory::KisDodgeMidtonesAdjustmentFactory() - : KoColorTransformationFactory("DodgeMidtones", i18n("DodgeMidtones Ad= justment")) -{ -} - -QList< QPair< KoID, KoID > > KisDodgeMidtonesAdjustmentFactory::supportedM= odels() const -{ - QList< QPair< KoID, KoID > > l; - l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer8BitsColorDepth= ID)); - l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer16BitsColorDept= hID)); - l.append(QPair< KoID, KoID >(RGBAColorModelID , Float32BitsColorDepthI= D)); = - return l; -} - -KoColorTransformation* KisDodgeMidtonesAdjustmentFactory::createTransforma= tion(const KoColorSpace* colorSpace, QHash parameters) c= onst -{ - KoColorTransformation * adj; - if (colorSpace->colorModelId() !=3D RGBAColorModelID) { - kError() << "Unsupported color space " << colorSpace->id() << " in= KisDodgeMidtonesAdjustmentFactory::createTransformation"; - return 0; - } - if (colorSpace->colorDepthId() =3D=3D Float32BitsColorDepthID) { - adj =3D new KisDodgeMidtonesAdjustment< float >(); - } else if(colorSpace->colorDepthId() =3D=3D Integer16BitsColorDepthID)= { - adj =3D new KisDodgeMidtonesAdjustment< quint16 >(); - } else if(colorSpace->colorDepthId() =3D=3D Integer8BitsColorDepthID) { - adj =3D new KisDodgeMidtonesAdjustment< quint8 >(); - } else { - kError() << "Unsupported color space " << colorSpace->id() << " in= KisDodgeMidtonesAdjustmentFactory::createTransformation"; - return 0; - } - adj->setParameters(parameters); - return adj; -} diff --git a/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustme= nt.cc b/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.cc deleted file mode 100644 index dd2fa1b..0000000 --- a/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.cc +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2013 Sahil Nagpal - * - * 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; version 2 - * of the License. - * - * 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 library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. -*/ - -#include "kis_dodgeshadows_adjustment.h" -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -template -class KisDodgeShadowsAdjustment : public KoColorTransformation -{ - typedef KoBgrTraits<_channel_type_> RGBTrait; - typedef typename RGBTrait::Pixel RGBPixel; - -public: - KisDodgeShadowsAdjustment(){}; - - void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const - { - const RGBPixel* src =3D reinterpret_cast(srcU8); - RGBPixel* dst =3D reinterpret_cast(dstU8); - float r, g, b; - while (nPixels > 0) { - r =3D (exposure + KoColorSpaceMaths<_channel_type_, float>::sc= aleToA(src->red)) - exposure * KoColorSpaceMaths<_channel_type_, float>::s= caleToA(src->red); - g =3D (exposure + KoColorSpaceMaths<_channel_type_, float>::sc= aleToA(src->green)) - exposure * KoColorSpaceMaths<_channel_type_, float>::= scaleToA(src->green); - b =3D (exposure + KoColorSpaceMaths<_channel_type_, float>::sc= aleToA(src->blue)) - exposure * KoColorSpaceMaths<_channel_type_, float>::s= caleToA(src->blue); - = - dst->red =3D KoColorSpaceMaths< float, _channel_type_ >::scale= ToA(r); - dst->green =3D KoColorSpaceMaths< float, _channel_type_ >::sca= leToA(g); - dst->blue =3D KoColorSpaceMaths< float, _channel_type_ >::scal= eToA(b); - dst->alpha =3D src->alpha; - = - --nPixels; - ++src; - ++dst; - } - } - - virtual QList parameters() const - { - QList list; - list << "exposure"; - return list; - } - - virtual int parameterId(const QString& name) const - { - if (name =3D=3D "exposure") - return 0; - return -1; - } - - virtual void setParameter(int id, const QVariant& parameter) - { - switch(id) - { - case 0: - exposure =3D parameter.toDouble(); - break; - default: - ; - } - } -private: - - float exposure; - }; - - KisDodgeShadowsAdjustmentFactory::KisDodgeShadowsAdjustmentFactory() - : KoColorTransformationFactory("DodgeShadows", i18n("DodgeShadows Adju= stment")) -{ -} - -QList< QPair< KoID, KoID > > KisDodgeShadowsAdjustmentFactory::supportedMo= dels() const -{ - QList< QPair< KoID, KoID > > l; - l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer8BitsColorDepth= ID)); - l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer16BitsColorDept= hID)); - l.append(QPair< KoID, KoID >(RGBAColorModelID , Float32BitsColorDepthI= D)); - return l; -} - -KoColorTransformation* KisDodgeShadowsAdjustmentFactory::createTransformat= ion(const KoColorSpace* colorSpace, QHash parameters) co= nst -{ - KoColorTransformation * adj; - if (colorSpace->colorModelId() !=3D RGBAColorModelID) { - kError() << "Unsupported color space " << colorSpace->id() << " in= KisDodgeShadowsAdjustmentFactory::createTransformation"; - return 0; - } - if (colorSpace->colorDepthId() =3D=3D Float32BitsColorDepthID) { - adj =3D new KisDodgeShadowsAdjustment < float >(); - } else if (colorSpace->colorDepthId() =3D=3D Integer16BitsColorDepthID= ) { - adj =3D new KisDodgeShadowsAdjustment< quint16 >(); - } else if (colorSpace->colorDepthId() =3D=3D Integer8BitsColorDepthID)= { - adj =3D new KisDodgeShadowsAdjustment< quint8 >(); - } else { - kError() << "Unsupported color space " << colorSpace->id() << " in= KisDodgeShadowsAdjustmentFactory::createTransformation"; - return 0; - } - adj->setParameters(parameters); - return adj; - -} diff --git a/krita/plugins/colorspaces/extensions/kis_hsv_adjustment.cc b/k= rita/plugins/colorspaces/extensions/kis_hsv_adjustment.cc deleted file mode 100644 index d79de72..0000000 --- a/krita/plugins/colorspaces/extensions/kis_hsv_adjustment.cc +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (c) 2007 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; version 2 - * of the License. - * - * 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 library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. -*/ - -#include "kis_hsv_adjustment.h" -#include -#ifdef HAVE_OPENEXR -#include -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include - -#define SCALE_TO_FLOAT( v ) KoColorSpaceMaths< _channel_type_, float>::sca= leToA( v ) -#define SCALE_FROM_FLOAT( v ) KoColorSpaceMaths< float, _channel_type_>::= scaleToA( v ) - -template -void clamp(float* r, float* g, float* b); - -#define FLOAT_CLAMP( v ) * v =3D (*v < 0.0) ? 0.0 : ( (*v>1.0) ? 1.0 : *v ) - -template<> -void clamp(float* r, float* g, float* b) -{ - FLOAT_CLAMP(r); - FLOAT_CLAMP(g); - FLOAT_CLAMP(b); -} - -template<> -void clamp(float* r, float* g, float* b) -{ - FLOAT_CLAMP(r); - FLOAT_CLAMP(g); - FLOAT_CLAMP(b); -} - -#ifdef HAVE_OPENEXR -template<> -void clamp(float* r, float* g, float* b) -{ - Q_UNUSED(r); - Q_UNUSED(g); - Q_UNUSED(b); -} -#endif - -template<> -void clamp(float* r, float* g, float* b) -{ - Q_UNUSED(r); - Q_UNUSED(g); - Q_UNUSED(b); -} - - -template -class KisHSVAdjustment : public KoColorTransformation -{ - typedef KoBgrTraits<_channel_type_> RGBTrait; - typedef typename RGBTrait::Pixel RGBPixel; - -public: - KisHSVAdjustment() - { - } - -public: - - void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) con= st - { - - const RGBPixel* src =3D reinterpret_cast(srcU8); - RGBPixel* dst =3D reinterpret_cast(dstU8); - float h, s, v, r, g, b; - while (nPixels > 0) { - - if (m_colorize) { - h =3D m_adj_h * 360; - if (h >=3D 360.0) h =3D 0; - - s =3D m_adj_s; - - r =3D SCALE_TO_FLOAT(src->red); - g =3D SCALE_TO_FLOAT(src->green); - b =3D SCALE_TO_FLOAT(src->blue); - - float luminance =3D r * 0.2126 + g * 0.7152 + b * 0.0722; - - if (m_adj_v > 0) { - luminance *=3D (1.0 - m_adj_v); - luminance +=3D 1.0 - (1.0 - m_adj_v); - } - else if (m_adj_v < 0 ){ - luminance *=3D (m_adj_v + 1.0); - } - v =3D luminance; - HSLToRGB(h, s, v, &r, &g, &b); - - } - else { - - if (m_type =3D=3D 0) { - RGBToHSV(SCALE_TO_FLOAT(src->red), SCALE_TO_FLOAT(src-= >green), SCALE_TO_FLOAT(src->blue), &h, &s, &v); - h +=3D m_adj_h * 180; - if (h > 360) h -=3D 360; - if (h < 0) h +=3D 360; - s +=3D m_adj_s; - v +=3D m_adj_v; - HSVToRGB(h, s, v, &r, &g, &b); - } - else { - - RGBToHSL(SCALE_TO_FLOAT(src->red), SCALE_TO_FLOAT(src-= >green), SCALE_TO_FLOAT(src->blue), &h, &s, &v); - - h +=3D m_adj_h * 180; - if (h > 360) h -=3D 360; - if (h < 0) h +=3D 360; - - s *=3D (m_adj_s + 1.0); - if (s < 0.0) s =3D 0.0; - if (s > 1.0) s =3D 1.0; - - if (m_adj_v < 0) - v *=3D (m_adj_v + 1.0); - else - v +=3D (m_adj_v * (1.0 - v)); - - - HSLToRGB(h, s, v, &r, &g, &b); - } - - } - - clamp< _channel_type_ >(&r, &g, &b); - dst->red =3D SCALE_FROM_FLOAT(r); - dst->green =3D SCALE_FROM_FLOAT(g); - dst->blue =3D SCALE_FROM_FLOAT(b); - dst->alpha =3D src->alpha; - - --nPixels; - ++src; - ++dst; - } - } - - virtual QList parameters() const - { - QList list; - list << "h" << "s" << "v" << "type" << "colorize"; - return list; - } - - virtual int parameterId(const QString& name) const - { - if (name =3D=3D "h") { - return 0; - } else if (name =3D=3D "s") { - return 1; - } else if (name =3D=3D "v") { - return 2; - } else if (name =3D=3D "type") { - return 3; - } else if (name =3D=3D "colorize") { - return 4; - } - return -1; - } - = - /** - * name - "h", "s" or "v" - * (h)ue in range <-1.0, 1.0> ( for user, show as -180, 180 or 0, 360 f= or colorize) - * (s)aturation in range <-1.0, 1.0> ( for user, show -100, 100, or 0, = 100 for colorize) - * (v)alue in range <-1.0, 1.0> (for user, show -100, 100) - */ - virtual void setParameter(int id, const QVariant& parameter) - { - switch(id) - { - case 0: - m_adj_h =3D parameter.toDouble(); - break; - case 1: - m_adj_s =3D parameter.toDouble(); - break; - case 2: - m_adj_v =3D parameter.toDouble(); - break; - case 3: - m_type =3D parameter.toDouble(); - break; - case 4: - m_colorize =3D parameter.toBool(); - break; - default: - ; - } - } - -private: - - double m_adj_h, m_adj_s, m_adj_v; - int m_type; - bool m_colorize; -}; - - -KisHSVAdjustmentFactory::KisHSVAdjustmentFactory() - : KoColorTransformationFactory("hsv_adjustment", i18n("HSV/HSL Adjustm= ent")) -{ -} - -QList< QPair< KoID, KoID > > KisHSVAdjustmentFactory::supportedModels() co= nst -{ - QList< QPair< KoID, KoID > > l; - l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer8BitsColorDepth= ID)); - l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer16BitsColorDept= hID)); - l.append(QPair< KoID, KoID >(RGBAColorModelID , Float16BitsColorDepthI= D)); - l.append(QPair< KoID, KoID >(RGBAColorModelID , Float32BitsColorDepthI= D)); - return l; -} - -KoColorTransformation* KisHSVAdjustmentFactory::createTransformation(const= KoColorSpace* colorSpace, QHash parameters) const -{ - KoColorTransformation * adj; - if (colorSpace->colorModelId() !=3D RGBAColorModelID) { - kError() << "Unsupported color space " << colorSpace->id() << " in= KisHSVAdjustmentFactory::createTransformation"; - return 0; - } - if (colorSpace->colorDepthId() =3D=3D Integer8BitsColorDepthID) { - adj =3D new KisHSVAdjustment< quint8 >(); - } else if (colorSpace->colorDepthId() =3D=3D Integer16BitsColorDepthID= ) { - adj =3D new KisHSVAdjustment< quint16 >(); - } -#ifdef HAVE_OPENEXR - else if (colorSpace->colorDepthId() =3D=3D Float16BitsColorDepthID) { - adj =3D new KisHSVAdjustment< half >(); - } -#endif - else if (colorSpace->colorDepthId() =3D=3D Float32BitsColorDepthID) { - adj =3D new KisHSVAdjustment< float >(); - } else { - kError() << "Unsupported color space " << colorSpace->id() << " in= KisHSVAdjustmentFactory::createTransformation"; - return 0; - } - adj->setParameters(parameters); - return adj; - -}