[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/krita-gsoc-filters-sahil] krita/plugins/colorspaces/extensions: Renaming Files
From:       Sahil Nagpal <nagpal.sahil01 () gmail ! com>
Date:       2013-06-30 21:07:55
Message-ID: E1UtOqh-0002GC-Au () scm ! kde ! org
[Download RAW message or body]

Git commit ad6c5c9722464a80b9d83f19ae28f2b8c5c361b4 by Sahil Nagpal.
Committed on 30/06/2013 at 20:22.
Pushed by sahilnagpal into branch 'krita-gsoc-filters-sahil'.

Renaming Files

M  +6    -6    krita/plugins/colorspaces/extensions/CMakeLists.txt
C  +29   -30   krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.cpp \
[from: krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp - 061% \
similarity] M  +2    -2    \
krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.h C  +27   -28   \
krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.cpp [from: \
krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp - 065% \
similarity] M  +2    -2    \
krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.h C  +38   -31   \
krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.cpp [from: \
krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp - 056% \
similarity] M  +2    -2    \
krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.h M  +13   -13   \
krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp M  +2    -2   \
krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.h C  +47   -46   \
krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.cpp [from: \
krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp - 051% \
similarity] M  +2    -2    \
krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.h C  +31   -27   \
krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.cpp [from: \
krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp - 060% \
similarity] M  +2    -2    \
krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.h A  +271  -0    \
krita/plugins/colorspaces/extensions/kis_hsv_adjustment.cpp     [License: LGPL (v2)]

http://commits.kde.org/calligra/ad6c5c9722464a80b9d83f19ae28f2b8c5c361b4

diff --git a/krita/plugins/colorspaces/extensions/CMakeLists.txt \
b/krita/plugins/colorspaces/extensions/CMakeLists.txt index cd9d6ce..3c197c4 100644
--- a/krita/plugins/colorspaces/extensions/CMakeLists.txt
+++ b/krita/plugins/colorspaces/extensions/CMakeLists.txt
@@ -1,12 +1,12 @@
 set( extensions_plugin_PART_SRCS 
 extensions_plugin.cc 
-kis_hsv_adjustment.cc
+kis_hsv_adjustment.cpp
 kis_dodgehighlights_adjustment.cpp
-kis_dodgemidtones_adjustment.cc
-kis_dodgeshadows_adjustment.cc
-kis_burnhighlights_adjustment.cc
-kis_burnmidtones_adjustment.cc
-kis_burnshadows_adjustment.cc
+kis_dodgemidtones_adjustment.cpp
+kis_dodgeshadows_adjustment.cpp
+kis_burnhighlights_adjustment.cpp
+kis_burnmidtones_adjustment.cpp
+kis_burnshadows_adjustment.cpp
 )
 
 kde4_add_plugin( krita_colorspaces_extensions ${extensions_plugin_PART_SRCS} )
diff --git a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp \
b/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.cpp similarity \
index 61% copy from krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp
 copy to krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.cpp
index df0d1d9..83e625c 100644
--- a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp
+++ b/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.cpp
@@ -4,7 +4,7 @@
  * 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.
+ * 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
@@ -17,7 +17,7 @@
  * Boston, MA 02110-1301, USA.
 */
 
-#include "kis_dodgehighlights_adjustment.h"
+#include "kis_burnhighlights_adjustment.h"
 #include <KoConfig.h>
 
 #include <kis_debug.h>
@@ -31,42 +31,41 @@
 #include <KoID.h>
 
 template<typename _channel_type_>
-class KisDodgeHighlightsAdjustment : public KoColorTransformation
+class KisBurnHighlightsAdjustment : public KoColorTransformation
 {
     typedef KoBgrTraits<_channel_type_> RGBTrait;
     typedef typename RGBTrait::Pixel RGBPixel;
 
 public:
- 	KisDodgeHighlightsAdjustment(){};
+ 	KisBurnHighlightsAdjustment(){};
 
  	void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const
  	{
- 		const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
+        const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
         RGBPixel* dst = reinterpret_cast<RGBPixel*>(dstU8);
-        float r, g, b;
-        while(nPixels > 0)
-        {   
-            r = exposure * KoColorSpaceMaths<_channel_type_, \
                float>::scaleToA(src->red);
-            g = exposure * KoColorSpaceMaths<_channel_type_, \
                float>::scaleToA(src->green);
-            b = exposure * KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->blue); +        float value_red, value_green, value_blue;
+        while(nPixels > 0) {
+
+            value_red = (1.0 - exposure * (0.33333)) * \
KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->red); +            \
value_green = (1.0 - exposure * (0.33333)) * KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->green); +            value_blue = (1.0 - exposure * (0.33333)) \
* KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->blue);  
-            dst->red = KoColorSpaceMaths< float, _channel_type_>::scaleToA(r);
-            dst->green = KoColorSpaceMaths< float, _channel_type_ >::scaleToA(g);
-            dst->blue = KoColorSpaceMaths< float, _channel_type_>::scaleToA(b);
+            dst->red = KoColorSpaceMaths< float, \
_channel_type_>::scaleToA(value_red); +            dst->green = KoColorSpaceMaths< \
float, _channel_type_ >::scaleToA(value_green); +            dst->blue = \
KoColorSpaceMaths< float, _channel_type_>::scaleToA(value_blue);  dst->alpha = \
src->alpha;  
             --nPixels;
             ++src;
-            ++dst;
+            ++dst;	
         }
-
     }
 
 	virtual QList<QString> parameters() const
 	{
-  	QList<QString> list;
-  	list << "exposure";
-  	return list;
+        QList<QString> list;
+        list << "exposure";
+        return list;
 	}
 
 	virtual int parameterId(const QString& name) const
@@ -92,12 +91,12 @@ private:
 	float exposure;
  };
 
- KisDodgeHighlightsAdjustmentFactory::KisDodgeHighlightsAdjustmentFactory()
-    : KoColorTransformationFactory("DodgeHighlights", i18n("DODGE Adjustment"))
+ KisBurnHighlightsAdjustmentFactory::KisBurnHighlightsAdjustmentFactory()
+    : KoColorTransformationFactory("BurnHighlights", i18n("BurnHighlights \
Adjustment"))  {
 }
 
-QList< QPair< KoID, KoID > > KisDodgeHighlightsAdjustmentFactory::supportedModels() \
const +QList< QPair< KoID, KoID > > \
KisBurnHighlightsAdjustmentFactory::supportedModels() const  {
     QList< QPair< KoID, KoID > > l;
     l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer8BitsColorDepthID));
@@ -106,21 +105,21 @@ QList< QPair< KoID, KoID > > \
KisDodgeHighlightsAdjustmentFactory::supportedModel  return l;
 }
 
-KoColorTransformation* \
KisDodgeHighlightsAdjustmentFactory::createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const +KoColorTransformation* \
KisBurnHighlightsAdjustmentFactory::createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const  {
     KoColorTransformation * adj;
     if (colorSpace->colorModelId() != RGBAColorModelID) {
-        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeHighlightsAdjustment::createTransformation"; +        kError() << \
"Unsupported color space " << colorSpace->id() << " in \
KisBurnHighlightsAdjustment::createTransformation";  return 0;
     }
-    if (colorSpace->colorDepthId() == Float32BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< float >();
+    if (colorSpace->colorDepthId() == Integer8BitsColorDepthID) {
+        adj = new KisBurnHighlightsAdjustment< quint8 >();
     } else if (colorSpace->colorDepthId() == Integer16BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< quint16 >();
-    } else if (colorSpace->colorDepthId() == Integer8BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< quint8 >();
+        adj = new KisBurnHighlightsAdjustment< quint16 >();
+    } else if (colorSpace->colorDepthId() == Float32BitsColorDepthID) {
+        adj = new KisBurnHighlightsAdjustment< float >();
     } else {
-        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeHighlightsAdjustment::createTransformation"; +        kError() << \
"Unsupported color space " << colorSpace->id() << " in \
KisBurnHighlightsAdjustment::createTransformation";  return 0;
     }
     adj->setParameters(parameters);
diff --git a/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.h \
b/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.h index \
                9648231..9d8c768 100644
--- a/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.h
+++ b/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.h
@@ -4,7 +4,7 @@
  * 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.
+ * 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
@@ -34,4 +34,4 @@
 
  };
 
- #endif
\ No newline at end of file
+ #endif
diff --git a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp \
b/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.cpp similarity \
index 65% copy from krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp
 copy to krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.cpp
index df0d1d9..c23ec45 100644
--- a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp
+++ b/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.cpp
@@ -4,7 +4,7 @@
  * 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.
+ * 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
@@ -17,7 +17,7 @@
  * Boston, MA 02110-1301, USA.
 */
 
-#include "kis_dodgehighlights_adjustment.h"
+#include "kis_burnmidtones_adjustment.h"
 #include <KoConfig.h>
 
 #include <kis_debug.h>
@@ -31,50 +31,49 @@
 #include <KoID.h>
 
 template<typename _channel_type_>
-class KisDodgeHighlightsAdjustment : public KoColorTransformation
+class KisBurnMidtonesAdjustment : public KoColorTransformation
 {
     typedef KoBgrTraits<_channel_type_> RGBTrait;
     typedef typename RGBTrait::Pixel RGBPixel;
 
 public:
- 	KisDodgeHighlightsAdjustment(){};
+ 	KisBurnMidtonesAdjustment(){};
 
  	void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const
  	{
  		const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
         RGBPixel* dst = reinterpret_cast<RGBPixel*>(dstU8);
-        float r, g, b;
-        while(nPixels > 0)
-        {   
-            r = exposure * KoColorSpaceMaths<_channel_type_, \
                float>::scaleToA(src->red);
-            g = exposure * KoColorSpaceMaths<_channel_type_, \
                float>::scaleToA(src->green);
-            b = exposure * KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->blue); +        float value_red, value_green, value_blue;
+        while(nPixels > 0) {
+
+            value_red = pow(KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->red), (1.0 + exposure * (0.333333))); +            value_green \
= pow(KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->green), (1.0 + exposure \
* (0.333333))); +            value_blue = pow(KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->blue), (1.0 + exposure * (0.333333)));  
-            dst->red = KoColorSpaceMaths< float, _channel_type_>::scaleToA(r);
-            dst->green = KoColorSpaceMaths< float, _channel_type_ >::scaleToA(g);
-            dst->blue = KoColorSpaceMaths< float, _channel_type_>::scaleToA(b);
+            dst->red = KoColorSpaceMaths< float, _channel_type_ \
>::scaleToA(value_red); +            dst->green = KoColorSpaceMaths< float, \
> _channel_type_ >::scaleToA(value_green);
+            dst->blue = KoColorSpaceMaths< float, _channel_type_ \
>::scaleToA(value_blue);  dst->alpha = src->alpha;
             
             --nPixels;
             ++src;
             ++dst;
         }
-
     }
 
 	virtual QList<QString> parameters() const
 	{
-  	QList<QString> list;
-  	list << "exposure";
-  	return list;
+        QList<QString> list;
+        list << "exposure";
+        return list;
 	}
 
 	virtual int parameterId(const QString& name) const
-    {
+	{
         if (name == "exposure")
         return 0;
         return -1;
-    }
+	}
 
     virtual void setParameter(int id, const QVariant& parameter)
     {
@@ -92,12 +91,12 @@ private:
 	float exposure;
  };
 
- KisDodgeHighlightsAdjustmentFactory::KisDodgeHighlightsAdjustmentFactory()
-    : KoColorTransformationFactory("DodgeHighlights", i18n("DODGE Adjustment"))
+ KisBurnMidtonesAdjustmentFactory::KisBurnMidtonesAdjustmentFactory()
+    : KoColorTransformationFactory("BurnMidtones", i18n("BurnMidtones Adjustment"))
 {
 }
 
-QList< QPair< KoID, KoID > > KisDodgeHighlightsAdjustmentFactory::supportedModels() \
const +QList< QPair< KoID, KoID > > \
KisBurnMidtonesAdjustmentFactory::supportedModels() const  {
     QList< QPair< KoID, KoID > > l;
     l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer8BitsColorDepthID));
@@ -106,21 +105,21 @@ QList< QPair< KoID, KoID > > \
KisDodgeHighlightsAdjustmentFactory::supportedModel  return l;
 }
 
-KoColorTransformation* \
KisDodgeHighlightsAdjustmentFactory::createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const +KoColorTransformation* \
KisBurnMidtonesAdjustmentFactory::createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const  {
     KoColorTransformation * adj;
     if (colorSpace->colorModelId() != RGBAColorModelID) {
-        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeHighlightsAdjustment::createTransformation"; +        kError() << \
"Unsupported color space " << colorSpace->id() << " in \
KisBurnMidtonesAdjustment::createTransformation";  return 0;
     }
     if (colorSpace->colorDepthId() == Float32BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< float >();
+        adj = new KisBurnMidtonesAdjustment< float >();
     } else if (colorSpace->colorDepthId() == Integer16BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< quint16 >();
+        adj = new KisBurnMidtonesAdjustment< quint16 >();
     } else if (colorSpace->colorDepthId() == Integer8BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< quint8 >();
+        adj = new KisBurnMidtonesAdjustment< quint8 >();
     } else {
-        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeHighlightsAdjustment::createTransformation"; +        kError() << \
"Unsupported color space " << colorSpace->id() << " in \
KisBurnMidtonesAdjustment::createTransformation";  return 0;
     }
     adj->setParameters(parameters);
diff --git a/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.h \
b/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.h index \
                4b9597b..22cc230 100644
--- a/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.h
+++ b/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.h
@@ -4,7 +4,7 @@
  * 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.
+ * 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
@@ -34,4 +34,4 @@
 
  };
 
- #endif
\ No newline at end of file
+ #endif
diff --git a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp \
b/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.cpp similarity \
index 56% copy from krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp
 copy to krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.cpp
index df0d1d9..492a833 100644
--- a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp
+++ b/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.cpp
@@ -4,7 +4,7 @@
  * 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.
+ * 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
@@ -17,7 +17,7 @@
  * Boston, MA 02110-1301, USA.
 */
 
-#include "kis_dodgehighlights_adjustment.h"
+#include "kis_burnshadows_adjustment.h"
 #include <KoConfig.h>
 
 #include <kis_debug.h>
@@ -31,42 +31,49 @@
 #include <KoID.h>
 
 template<typename _channel_type_>
-class KisDodgeHighlightsAdjustment : public KoColorTransformation
-{
+class KisBurnShadowsAdjustment : public KoColorTransformation
+ {
     typedef KoBgrTraits<_channel_type_> RGBTrait;
     typedef typename RGBTrait::Pixel RGBPixel;
 
 public:
- 	KisDodgeHighlightsAdjustment(){};
+ 	KisBurnShadowsAdjustment(){};
 
  	void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const
  	{
- 		const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
+        const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
         RGBPixel* dst = reinterpret_cast<RGBPixel*>(dstU8);
-        float r, g, b;
-        while(nPixels > 0)
-        {   
-            r = exposure * KoColorSpaceMaths<_channel_type_, \
                float>::scaleToA(src->red);
-            g = exposure * KoColorSpaceMaths<_channel_type_, \
                float>::scaleToA(src->green);
-            b = exposure * KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->blue); +        float factor, value_red, value_green, \
value_blue, new_value_red, new_value_green, new_value_blue; +        while (nPixels > \
0) { +
+            factor = exposure * 0.333333;
+            value_red =  KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->red); +            value_green =  \
KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->green); +            \
value_blue =  KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->blue); +
+            if( value_red < factor ) new_value_red = 0;
+            else new_value_red = (value_red - factor)/(1 - factor);
+            if( value_green < factor ) new_value_green = 0;
+            else new_value_green = (value_green - factor)/(1 - factor);
+            if( value_blue < factor ) new_value_blue = 0;
+            else new_value_blue = (value_blue - factor)/(1 - factor);
             
-            dst->red = KoColorSpaceMaths< float, _channel_type_>::scaleToA(r);
-            dst->green = KoColorSpaceMaths< float, _channel_type_ >::scaleToA(g);
-            dst->blue = KoColorSpaceMaths< float, _channel_type_>::scaleToA(b);
+            dst->red = KoColorSpaceMaths< float, _channel_type_ \
>::scaleToA(new_value_red); +            dst->green = KoColorSpaceMaths< float, \
> _channel_type_ >::scaleToA(new_value_green);
+            dst->blue = KoColorSpaceMaths< float, _channel_type_ \
>::scaleToA(new_value_blue);  dst->alpha = src->alpha;
             
             --nPixels;
             ++src;
             ++dst;
         }
-
-    }
+ 	}
 
 	virtual QList<QString> parameters() const
 	{
-  	QList<QString> list;
-  	list << "exposure";
-  	return list;
+        QList<QString> list;
+        list << "exposure";
+        return list;
 	}
 
 	virtual int parameterId(const QString& name) const
@@ -92,12 +99,12 @@ private:
 	float exposure;
  };
 
- KisDodgeHighlightsAdjustmentFactory::KisDodgeHighlightsAdjustmentFactory()
-    : KoColorTransformationFactory("DodgeHighlights", i18n("DODGE Adjustment"))
+ KisBurnShadowsAdjustmentFactory::KisBurnShadowsAdjustmentFactory()
+    : KoColorTransformationFactory("BurnShadows", i18n("BurnShadows Adjustment"))
 {
 }
 
-QList< QPair< KoID, KoID > > KisDodgeHighlightsAdjustmentFactory::supportedModels() \
const +QList< QPair< KoID, KoID > > \
KisBurnShadowsAdjustmentFactory::supportedModels() const  {
     QList< QPair< KoID, KoID > > l;
     l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer8BitsColorDepthID));
@@ -106,21 +113,21 @@ QList< QPair< KoID, KoID > > \
KisDodgeHighlightsAdjustmentFactory::supportedModel  return l;
 }
 
-KoColorTransformation* \
KisDodgeHighlightsAdjustmentFactory::createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const +KoColorTransformation* \
KisBurnShadowsAdjustmentFactory::createTransformation(const KoColorSpace* colorSpace, \
QHash<QString, QVariant> parameters) const  {
     KoColorTransformation * adj;
     if (colorSpace->colorModelId() != RGBAColorModelID) {
-        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeHighlightsAdjustment::createTransformation"; +        kError() << \
"Unsupported color space " << colorSpace->id() << " in \
KisBurnShadowsAdjustment::createTransformation";  return 0;
     }
-    if (colorSpace->colorDepthId() == Float32BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< float >();
+    if (colorSpace->colorDepthId() == Integer8BitsColorDepthID) {
+        adj = new KisBurnShadowsAdjustment< quint8 >();
     } else if (colorSpace->colorDepthId() == Integer16BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< quint16 >();
-    } else if (colorSpace->colorDepthId() == Integer8BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< quint8 >();
+        adj = new KisBurnShadowsAdjustment< quint16 >();
+    } else if (colorSpace->colorDepthId() == Float32BitsColorDepthID) {
+        adj = new KisBurnShadowsAdjustment< float >();
     } else {
-        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeHighlightsAdjustment::createTransformation"; +        kError() << \
"Unsupported color space " << colorSpace->id() << " in \
KisBurnShadowsAdjustment::createTransformation";  return 0;
     }
     adj->setParameters(parameters);
diff --git a/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.h \
b/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.h index \
                61ec996..ccf5870 100644
--- a/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.h
+++ b/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.h
@@ -4,7 +4,7 @@
  * 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.
+ * 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
@@ -34,4 +34,4 @@
 
  };
 
- #endif
\ No newline at end of file
+ #endif
diff --git a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp \
b/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp index \
                df0d1d9..4858ac9 100644
--- a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp
+++ b/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp
@@ -4,7 +4,7 @@
  * 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.
+ * 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
@@ -43,16 +43,16 @@ public:
  	{
  		const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
         RGBPixel* dst = reinterpret_cast<RGBPixel*>(dstU8);
-        float r, g, b;
-        while(nPixels > 0)
-        {   
-            r = exposure * KoColorSpaceMaths<_channel_type_, \
                float>::scaleToA(src->red);
-            g = exposure * KoColorSpaceMaths<_channel_type_, \
                float>::scaleToA(src->green);
-            b = exposure * KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->blue); +        float value_red, value_green, value_blue;
+        while(nPixels > 0) {
+
+            value_red = (1.0 + exposure * (0.33333)) * \
KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->red); +            \
value_green = (1.0 + exposure * (0.33333)) * KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->green); +            value_blue = (1.0 + exposure * (0.33333)) \
* KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->blue);  
-            dst->red = KoColorSpaceMaths< float, _channel_type_>::scaleToA(r);
-            dst->green = KoColorSpaceMaths< float, _channel_type_ >::scaleToA(g);
-            dst->blue = KoColorSpaceMaths< float, _channel_type_>::scaleToA(b);
+            dst->red = KoColorSpaceMaths< float, \
_channel_type_>::scaleToA(value_red); +            dst->green = KoColorSpaceMaths< \
float, _channel_type_ >::scaleToA(value_green); +            dst->blue = \
KoColorSpaceMaths< float, _channel_type_>::scaleToA(value_blue);  dst->alpha = \
src->alpha;  
             --nPixels;
@@ -64,9 +64,9 @@ public:
 
 	virtual QList<QString> parameters() const
 	{
-  	QList<QString> list;
-  	list << "exposure";
-  	return list;
+        QList<QString> list;
+        list << "exposure";
+        return list;
 	}
 
 	virtual int parameterId(const QString& name) const
diff --git a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.h \
b/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.h index \
                c0f7a09..8cb5568 100644
--- a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.h
+++ b/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.h
@@ -4,7 +4,7 @@
  * 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.
+ * 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
@@ -34,4 +34,4 @@
 
  };
 
- #endif
\ No newline at end of file
+ #endif
diff --git a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp \
b/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.cpp similarity \
index 51% copy from krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp
 copy to krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.cpp
index df0d1d9..beec029 100644
--- a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp
+++ b/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.cpp
@@ -4,7 +4,7 @@
  * 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.
+ * 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
@@ -17,59 +17,61 @@
  * Boston, MA 02110-1301, USA.
 */
 
-#include "kis_dodgehighlights_adjustment.h"
+#include "kis_dodgemidtones_adjustment.h"
 #include <KoConfig.h>
 
 #include <kis_debug.h>
 #include <klocale.h>
 
-#include <KoColorConversions.h>
-#include <KoColorModelStandardIds.h>
-#include <KoColorSpace.h>
-#include <KoColorSpaceTraits.h>
-#include <KoColorTransformation.h>
-#include <KoID.h>
-
+ #include <KoColorConversions.h>
+ #include <KoColorModelStandardIds.h>
+ #include <KoColorSpace.h>
+ #include <KoColorSpaceTraits.h>
+ #include <KoColorTransformation.h>
+ #include <KoID.h>
+ 
 template<typename _channel_type_>
-class KisDodgeHighlightsAdjustment : public KoColorTransformation
-{
+class KisDodgeMidtonesAdjustment : public KoColorTransformation
+ {
     typedef KoBgrTraits<_channel_type_> RGBTrait;
     typedef typename RGBTrait::Pixel RGBPixel;
 
 public:
- 	KisDodgeHighlightsAdjustment(){};
+ 	KisDodgeMidtonesAdjustment(){};
 
- 	void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const
- 	{
- 		const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
+public:
+    
+    void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const
+    {
+    	const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
         RGBPixel* dst = reinterpret_cast<RGBPixel*>(dstU8);
-        float r, g, b;
-        while(nPixels > 0)
-        {   
-            r = exposure * KoColorSpaceMaths<_channel_type_, \
                float>::scaleToA(src->red);
-            g = exposure * KoColorSpaceMaths<_channel_type_, \
                float>::scaleToA(src->green);
-            b = exposure * KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->blue); +        float  factor, value_red, value_green, \
value_blue; +        while(nPixels > 0) {
+
+            factor = 1.0/(1.0 + exposure);
+            value_red = pow(KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->red), factor); +            value_green = \
pow(KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->green), factor); +        \
value_blue = pow(KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->blue), \
factor);  
-            dst->red = KoColorSpaceMaths< float, _channel_type_>::scaleToA(r);
-            dst->green = KoColorSpaceMaths< float, _channel_type_ >::scaleToA(g);
-            dst->blue = KoColorSpaceMaths< float, _channel_type_>::scaleToA(b);
+            dst->red = KoColorSpaceMaths< float, _channel_type_ \
>::scaleToA(value_red); +            dst->green = KoColorSpaceMaths< float, \
> _channel_type_ >::scaleToA(value_green);
+            dst->blue = KoColorSpaceMaths< float, _channel_type_ \
>::scaleToA(value_blue);  dst->alpha = src->alpha;
             
             --nPixels;
             ++src;
             ++dst;
         }
-
     }
 
-	virtual QList<QString> parameters() const
-	{
-  	QList<QString> list;
-  	list << "exposure";
-  	return list;
-	}
+    virtual QList<QString> parameters() const
+    {
+    	QList<QString> list;
+    	list << "exposure";
+    	return list;
+    }
 
-	virtual int parameterId(const QString& name) const
+    virtual int parameterId(const QString& name) const
     {
         if (name == "exposure")
         return 0;
@@ -90,40 +92,39 @@ public:
 private:
 
 	float exposure;
- };
+};
 
- KisDodgeHighlightsAdjustmentFactory::KisDodgeHighlightsAdjustmentFactory()
-    : KoColorTransformationFactory("DodgeHighlights", i18n("DODGE Adjustment"))
+ KisDodgeMidtonesAdjustmentFactory::KisDodgeMidtonesAdjustmentFactory()
+    : KoColorTransformationFactory("DodgeMidtones", i18n("DodgeMidtones \
Adjustment"))  {
 }
 
-QList< QPair< KoID, KoID > > KisDodgeHighlightsAdjustmentFactory::supportedModels() \
const +QList< QPair< KoID, KoID > > \
KisDodgeMidtonesAdjustmentFactory::supportedModels() const  {
     QList< QPair< KoID, KoID > > l;
     l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer8BitsColorDepthID));
     l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer16BitsColorDepthID));
-    l.append(QPair< KoID, KoID >(RGBAColorModelID , Float32BitsColorDepthID));
+    l.append(QPair< KoID, KoID >(RGBAColorModelID , Float32BitsColorDepthID)); 
     return l;
 }
 
-KoColorTransformation* \
KisDodgeHighlightsAdjustmentFactory::createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const +KoColorTransformation* \
KisDodgeMidtonesAdjustmentFactory::createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const  {
     KoColorTransformation * adj;
     if (colorSpace->colorModelId() != RGBAColorModelID) {
-        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeHighlightsAdjustment::createTransformation"; +        kError() << \
"Unsupported color space " << colorSpace->id() << " in \
KisDodgeMidtonesAdjustmentFactory::createTransformation";  return 0;
     }
     if (colorSpace->colorDepthId() == Float32BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< float >();
-    } else if (colorSpace->colorDepthId() == Integer16BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< quint16 >();
-    } else if (colorSpace->colorDepthId() == Integer8BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< quint8 >();
+        adj = new KisDodgeMidtonesAdjustment< float >();
+    } else if(colorSpace->colorDepthId() == Integer16BitsColorDepthID) {
+        adj = new KisDodgeMidtonesAdjustment< quint16 >();
+    } else if(colorSpace->colorDepthId() == Integer8BitsColorDepthID) {
+        adj = new KisDodgeMidtonesAdjustment< quint8 >();
     } else {
-        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeHighlightsAdjustment::createTransformation"; +        kError() << \
"Unsupported color space " << colorSpace->id() << " in \
KisDodgeMidtonesAdjustmentFactory::createTransformation";  return 0;
     }
     adj->setParameters(parameters);
     return adj;
-
 }
diff --git a/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.h \
b/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.h index \
                1bf31ef..20509a9 100644
--- a/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.h
+++ b/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.h
@@ -4,7 +4,7 @@
  * 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.
+ * 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
@@ -34,4 +34,4 @@
 
  };
 
- #endif
\ No newline at end of file
+ #endif
diff --git a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp \
b/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.cpp similarity \
index 60% copy from krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp
 copy to krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.cpp
index df0d1d9..3e4fd2e 100644
--- a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp
+++ b/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.cpp
@@ -4,7 +4,7 @@
  * 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.
+ * 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
@@ -17,7 +17,7 @@
  * Boston, MA 02110-1301, USA.
 */
 
-#include "kis_dodgehighlights_adjustment.h"
+#include "kis_dodgeshadows_adjustment.h"
 #include <KoConfig.h>
 
 #include <kis_debug.h>
@@ -31,42 +31,46 @@
 #include <KoID.h>
 
 template<typename _channel_type_>
-class KisDodgeHighlightsAdjustment : public KoColorTransformation
+class KisDodgeShadowsAdjustment : public KoColorTransformation
 {
     typedef KoBgrTraits<_channel_type_> RGBTrait;
     typedef typename RGBTrait::Pixel RGBPixel;
 
 public:
- 	KisDodgeHighlightsAdjustment(){};
+ 	KisDodgeShadowsAdjustment(){};
 
  	void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const
  	{
- 		const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
+        const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
         RGBPixel* dst = reinterpret_cast<RGBPixel*>(dstU8);
-        float r, g, b;
-        while(nPixels > 0)
-        {   
-            r = exposure * KoColorSpaceMaths<_channel_type_, \
                float>::scaleToA(src->red);
-            g = exposure * KoColorSpaceMaths<_channel_type_, \
                float>::scaleToA(src->green);
-            b = exposure * KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->blue); +        float factor, value_red, value_green, \
value_blue, new_value_red, new_value_green, new_value_blue; +        while (nPixels > \
0) { +
+            value_red = KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->red); +            value_green = \
KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->green); +            \
value_blue = KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->blue); +
+            factor = exposure * 0.333333;
+            new_value_red = factor + value_red  - factor * value_red;
+            new_value_green = factor + value_green  - factor * value_green;
+            new_value_blue = factor + value_blue  - factor * value_blue;
             
-            dst->red = KoColorSpaceMaths< float, _channel_type_>::scaleToA(r);
-            dst->green = KoColorSpaceMaths< float, _channel_type_ >::scaleToA(g);
-            dst->blue = KoColorSpaceMaths< float, _channel_type_>::scaleToA(b);
+            dst->red = KoColorSpaceMaths< float, _channel_type_ \
>::scaleToA(new_value_red); +            dst->green = KoColorSpaceMaths< float, \
> _channel_type_ >::scaleToA(new_value_green);
+            dst->blue = KoColorSpaceMaths< float, _channel_type_ \
>::scaleToA(new_value_blue);  dst->alpha = src->alpha;
             
             --nPixels;
             ++src;
             ++dst;
         }
-
     }
 
 	virtual QList<QString> parameters() const
 	{
-  	QList<QString> list;
-  	list << "exposure";
-  	return list;
+        QList<QString> list;
+        list << "exposure";
+        return list;
 	}
 
 	virtual int parameterId(const QString& name) const
@@ -92,12 +96,12 @@ private:
 	float exposure;
  };
 
- KisDodgeHighlightsAdjustmentFactory::KisDodgeHighlightsAdjustmentFactory()
-    : KoColorTransformationFactory("DodgeHighlights", i18n("DODGE Adjustment"))
+ KisDodgeShadowsAdjustmentFactory::KisDodgeShadowsAdjustmentFactory()
+    : KoColorTransformationFactory("DodgeShadows", i18n("DodgeShadows Adjustment"))
 {
 }
 
-QList< QPair< KoID, KoID > > KisDodgeHighlightsAdjustmentFactory::supportedModels() \
const +QList< QPair< KoID, KoID > > \
KisDodgeShadowsAdjustmentFactory::supportedModels() const  {
     QList< QPair< KoID, KoID > > l;
     l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer8BitsColorDepthID));
@@ -106,21 +110,21 @@ QList< QPair< KoID, KoID > > \
KisDodgeHighlightsAdjustmentFactory::supportedModel  return l;
 }
 
-KoColorTransformation* \
KisDodgeHighlightsAdjustmentFactory::createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const +KoColorTransformation* \
KisDodgeShadowsAdjustmentFactory::createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const  {
     KoColorTransformation * adj;
     if (colorSpace->colorModelId() != RGBAColorModelID) {
-        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeHighlightsAdjustment::createTransformation"; +        kError() << \
"Unsupported color space " << colorSpace->id() << " in \
KisDodgeShadowsAdjustmentFactory::createTransformation";  return 0;
     }
     if (colorSpace->colorDepthId() == Float32BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< float >();
+        adj = new KisDodgeShadowsAdjustment < float >();
     } else if (colorSpace->colorDepthId() == Integer16BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< quint16 >();
+        adj = new KisDodgeShadowsAdjustment< quint16 >();
     } else if (colorSpace->colorDepthId() == Integer8BitsColorDepthID) {
-        adj = new KisDodgeHighlightsAdjustment< quint8 >();
+        adj = new KisDodgeShadowsAdjustment< quint8 >();
     } else {
-        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeHighlightsAdjustment::createTransformation"; +        kError() << \
"Unsupported color space " << colorSpace->id() << " in \
KisDodgeShadowsAdjustmentFactory::createTransformation";  return 0;
     }
     adj->setParameters(parameters);
diff --git a/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.h \
b/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.h index \
                4e14f1b..d2f19b3 100644
--- a/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.h
+++ b/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.h
@@ -4,7 +4,7 @@
  * 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.
+ * 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
@@ -34,4 +34,4 @@
 
  };
 
- #endif
\ No newline at end of file
+ #endif
diff --git a/krita/plugins/colorspaces/extensions/kis_hsv_adjustment.cpp \
b/krita/plugins/colorspaces/extensions/kis_hsv_adjustment.cpp new file mode 100644
index 0000000..d79de72
--- /dev/null
+++ b/krita/plugins/colorspaces/extensions/kis_hsv_adjustment.cpp
@@ -0,0 +1,271 @@
+/*
+ *  Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
+ *
+ * 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 <KoConfig.h>
+#ifdef HAVE_OPENEXR
+#include <half.h>
+#endif
+
+#include <kis_debug.h>
+#include <klocale.h>
+
+#include <KoColorConversions.h>
+#include <KoColorModelStandardIds.h>
+#include <KoColorSpace.h>
+#include <KoColorSpaceTraits.h>
+#include <KoColorTransformation.h>
+#include <KoID.h>
+
+#define SCALE_TO_FLOAT( v ) KoColorSpaceMaths< _channel_type_, float>::scaleToA( v )
+#define SCALE_FROM_FLOAT( v  ) KoColorSpaceMaths< float, _channel_type_>::scaleToA( \
v ) +
+template<typename _channel_type_>
+void clamp(float* r, float* g, float* b);
+
+#define FLOAT_CLAMP( v ) * v = (*v < 0.0) ? 0.0 : ( (*v>1.0) ? 1.0 : *v )
+
+template<>
+void clamp<quint8>(float* r, float* g, float* b)
+{
+    FLOAT_CLAMP(r);
+    FLOAT_CLAMP(g);
+    FLOAT_CLAMP(b);
+}
+
+template<>
+void clamp<quint16>(float* r, float* g, float* b)
+{
+    FLOAT_CLAMP(r);
+    FLOAT_CLAMP(g);
+    FLOAT_CLAMP(b);
+}
+
+#ifdef HAVE_OPENEXR
+template<>
+void clamp<half>(float* r, float* g, float* b)
+{
+    Q_UNUSED(r);
+    Q_UNUSED(g);
+    Q_UNUSED(b);
+}
+#endif
+
+template<>
+void clamp<float>(float* r, float* g, float* b)
+{
+    Q_UNUSED(r);
+    Q_UNUSED(g);
+    Q_UNUSED(b);
+}
+
+
+template<typename _channel_type_>
+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) const
+    {
+
+        const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
+        RGBPixel* dst = reinterpret_cast<RGBPixel*>(dstU8);
+        float h, s, v, r, g, b;
+        while (nPixels > 0) {
+
+            if (m_colorize) {
+                h = m_adj_h * 360;
+                if (h >= 360.0) h = 0;
+
+                s = m_adj_s;
+
+                r = SCALE_TO_FLOAT(src->red);
+                g = SCALE_TO_FLOAT(src->green);
+                b = SCALE_TO_FLOAT(src->blue);
+
+                float luminance = r * 0.2126 + g * 0.7152 + b * 0.0722;
+
+                if (m_adj_v > 0) {
+                    luminance *= (1.0 - m_adj_v);
+                    luminance += 1.0 - (1.0 - m_adj_v);
+                }
+                else if (m_adj_v < 0 ){
+                    luminance *= (m_adj_v + 1.0);
+                }
+                v = luminance;
+                HSLToRGB(h, s, v, &r, &g, &b);
+
+            }
+            else {
+
+                if (m_type == 0) {
+                    RGBToHSV(SCALE_TO_FLOAT(src->red), SCALE_TO_FLOAT(src->green), \
SCALE_TO_FLOAT(src->blue), &h, &s, &v); +                    h += m_adj_h * 180;
+                    if (h > 360) h -= 360;
+                    if (h < 0) h += 360;
+                    s += m_adj_s;
+                    v += 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 += m_adj_h * 180;
+                    if (h > 360) h -= 360;
+                    if (h < 0) h += 360;
+
+                    s *= (m_adj_s + 1.0);
+                    if (s < 0.0) s = 0.0;
+                    if (s > 1.0) s = 1.0;
+
+                    if (m_adj_v < 0)
+                        v *= (m_adj_v + 1.0);
+                    else
+                        v += (m_adj_v * (1.0 - v));
+
+
+                    HSLToRGB(h, s, v, &r, &g, &b);
+                }
+
+            }
+
+            clamp< _channel_type_ >(&r, &g, &b);
+            dst->red = SCALE_FROM_FLOAT(r);
+            dst->green = SCALE_FROM_FLOAT(g);
+            dst->blue = SCALE_FROM_FLOAT(b);
+            dst->alpha = src->alpha;
+
+            --nPixels;
+            ++src;
+            ++dst;
+        }
+    }
+
+    virtual QList<QString> parameters() const
+    {
+      QList<QString> list;
+      list << "h" << "s" << "v" << "type" << "colorize";
+      return list;
+    }
+
+    virtual int parameterId(const QString& name) const
+    {
+        if (name == "h") {
+            return 0;
+        } else if (name == "s") {
+            return 1;
+        } else if (name == "v") {
+            return 2;
+        } else if (name == "type") {
+            return 3;
+        } else if (name == "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 for \
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 = parameter.toDouble();
+            break;
+        case 1:
+            m_adj_s = parameter.toDouble();
+            break;
+        case 2:
+            m_adj_v = parameter.toDouble();
+            break;
+        case 3:
+            m_type = parameter.toDouble();
+            break;
+        case 4:
+            m_colorize = 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 Adjustment"))
+{
+}
+
+QList< QPair< KoID, KoID > > KisHSVAdjustmentFactory::supportedModels() const
+{
+    QList< QPair< KoID, KoID > > l;
+    l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer8BitsColorDepthID));
+    l.append(QPair< KoID, KoID >(RGBAColorModelID , Integer16BitsColorDepthID));
+    l.append(QPair< KoID, KoID >(RGBAColorModelID , Float16BitsColorDepthID));
+    l.append(QPair< KoID, KoID >(RGBAColorModelID , Float32BitsColorDepthID));
+    return l;
+}
+
+KoColorTransformation* KisHSVAdjustmentFactory::createTransformation(const \
KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const +{
+    KoColorTransformation * adj;
+    if (colorSpace->colorModelId() != RGBAColorModelID) {
+        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisHSVAdjustmentFactory::createTransformation"; +        return 0;
+    }
+    if (colorSpace->colorDepthId() == Integer8BitsColorDepthID) {
+        adj = new KisHSVAdjustment< quint8 >();
+    } else if (colorSpace->colorDepthId() == Integer16BitsColorDepthID) {
+        adj = new KisHSVAdjustment< quint16 >();
+    }
+#ifdef HAVE_OPENEXR
+    else if (colorSpace->colorDepthId() == Float16BitsColorDepthID) {
+        adj = new KisHSVAdjustment< half >();
+    }
+#endif
+    else if (colorSpace->colorDepthId() == Float32BitsColorDepthID) {
+        adj = new KisHSVAdjustment< float >();
+    } else {
+        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisHSVAdjustmentFactory::createTransformation"; +        return 0;
+    }
+    adj->setParameters(parameters);
+    return adj;
+
+}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic