[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: Fixing The Dodge And Burn
From:       Sahil Nagpal <nagpal.sahil01 () gmail ! com>
Date:       2013-06-23 21:07:08
Message-ID: E1UqrV6-0003Jq-5H () scm ! kde ! org
[Download RAW message or body]

Git commit 42ad6d48bb511d7ef33ba086c5bfbc382eb096d7 by Sahil Nagpal.
Committed on 21/06/2013 at 21:33.
Pushed by sahilnagpal into branch 'krita-gsoc-filters-sahil'.

Fixing The Dodge And Burn Filters

M  +7    -1    krita/plugins/colorspaces/extensions/CMakeLists.txt
M  +15   -0    krita/plugins/colorspaces/extensions/extensions_plugin.cc
A  +128  -0    krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.cc  \
[License: LGPL (v2)] C  +13   -17   \
krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.h [from: \
krita/plugins/colorspaces/extensions/extensions_plugin.cc - 053% similarity] A  +128  \
-0    krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.cc     \
[License: LGPL (v2)] C  +13   -17   \
krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.h [from: \
krita/plugins/colorspaces/extensions/extensions_plugin.cc - 053% similarity] A  +127  \
-0    krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.cc     \
[License: LGPL (v2)] C  +13   -17   \
krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.h [from: \
krita/plugins/colorspaces/extensions/extensions_plugin.cc - 053% similarity] A  +129  \
-0    krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp     \
[License: LGPL (v2)] C  +13   -17   \
krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.h [from: \
krita/plugins/colorspaces/extensions/extensions_plugin.cc - 053% similarity] A  +129  \
-0    krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.cc     \
[License: LGPL (v2)] C  +13   -17   \
krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.h [from: \
krita/plugins/colorspaces/extensions/extensions_plugin.cc - 053% similarity] A  +127  \
-0    krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.cc     \
[License: LGPL (v2)] C  +13   -17   \
krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.h [from: \
krita/plugins/colorspaces/extensions/extensions_plugin.cc - 053% similarity]     \
[License: UNKNOWN]  *

The files marked with a * at the end have a non valid license. Please read: \
http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are \
listed at that page.


http://commits.kde.org/calligra/42ad6d48bb511d7ef33ba086c5bfbc382eb096d7

diff --git a/krita/plugins/colorspaces/extensions/CMakeLists.txt \
b/krita/plugins/colorspaces/extensions/CMakeLists.txt index 4dfff18..cd9d6ce 100644
--- a/krita/plugins/colorspaces/extensions/CMakeLists.txt
+++ b/krita/plugins/colorspaces/extensions/CMakeLists.txt
@@ -1,6 +1,12 @@
 set( extensions_plugin_PART_SRCS 
 extensions_plugin.cc 
-kis_hsv_adjustment.cc 
+kis_hsv_adjustment.cc
+kis_dodgehighlights_adjustment.cpp
+kis_dodgemidtones_adjustment.cc
+kis_dodgeshadows_adjustment.cc
+kis_burnhighlights_adjustment.cc
+kis_burnmidtones_adjustment.cc
+kis_burnshadows_adjustment.cc
 )
 
 kde4_add_plugin( krita_colorspaces_extensions ${extensions_plugin_PART_SRCS} )
diff --git a/krita/plugins/colorspaces/extensions/extensions_plugin.cc \
b/krita/plugins/colorspaces/extensions/extensions_plugin.cc index 18fe6d9..b4eab40 \
                100644
--- a/krita/plugins/colorspaces/extensions/extensions_plugin.cc
+++ b/krita/plugins/colorspaces/extensions/extensions_plugin.cc
@@ -24,6 +24,13 @@
 #include <KoColorTransformationFactoryRegistry.h>
 
 #include "kis_hsv_adjustment.h"
+#include "kis_dodgemidtones_adjustment.h"
+#include "kis_dodgehighlights_adjustment.h"
+#include "kis_dodgeshadows_adjustment.h"
+#include "kis_burnmidtones_adjustment.h"
+#include "kis_burnhighlights_adjustment.h"
+#include "kis_burnshadows_adjustment.h"
+
 
 K_PLUGIN_FACTORY(ExtensionsPluginFactory, registerPlugin<ExtensionsPlugin>();)
 K_EXPORT_PLUGIN(ExtensionsPluginFactory("krita"))
@@ -32,6 +39,14 @@ ExtensionsPlugin::ExtensionsPlugin(QObject *parent, const \
QVariantList &)  {
     Q_UNUSED(parent);
     KoColorTransformationFactoryRegistry::addColorTransformationFactory(new \
KisHSVAdjustmentFactory); +    
+    KoColorTransformationFactoryRegistry::addColorTransformationFactory(new \
KisDodgeMidtonesAdjustmentFactory); +    \
KoColorTransformationFactoryRegistry::addColorTransformationFactory(new \
KisDodgeHighlightsAdjustmentFactory); +    \
KoColorTransformationFactoryRegistry::addColorTransformationFactory(new \
KisDodgeShadowsAdjustmentFactory); +    
+    KoColorTransformationFactoryRegistry::addColorTransformationFactory(new \
KisBurnMidtonesAdjustmentFactory); +    \
KoColorTransformationFactoryRegistry::addColorTransformationFactory(new \
KisBurnHighlightsAdjustmentFactory); +    \
KoColorTransformationFactoryRegistry::addColorTransformationFactory(new \
KisBurnShadowsAdjustmentFactory);  }
 
 ExtensionsPlugin::~ExtensionsPlugin()
diff --git a/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.cc \
b/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.cc new file mode \
100644 index 0000000..0521466
--- /dev/null
+++ b/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.cc
@@ -0,0 +1,128 @@
+/*
+ *  Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
+ *
+ * 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 <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>
+
+template<typename _channel_type_>
+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 = 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); +           \
 +            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->alpha = src->alpha;
+            
+            --nPixels;
+            ++src;
+            ++dst;	
+        }
+    }
+
+	virtual QList<QString> parameters() const
+	{
+  	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)
+    {
+        switch(id)
+        {
+        case 0:
+            exposure = parameter.toDouble();
+            break;
+        default:
+            ;
+        }
+    }
+private:
+
+	float exposure;
+ };
+
+ KisBurnHighlightsAdjustmentFactory::KisBurnHighlightsAdjustmentFactory()
+    : KoColorTransformationFactory("BurnHighlights", i18n("BurnHighlights \
Adjustment")) +{
+}
+
+QList< QPair< KoID, KoID > > KisBurnHighlightsAdjustmentFactory::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));
+    return l;
+}
+
+KoColorTransformation* \
KisBurnHighlightsAdjustmentFactory::createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const +{
+    KoColorTransformation * adj;
+    if (colorSpace->colorModelId() != RGBAColorModelID) {
+        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisBurnHighlightsAdjustment::createTransformation"; +        return 0;
+    }
+    if (colorSpace->colorDepthId() == Integer8BitsColorDepthID) {
+        adj = new KisBurnHighlightsAdjustment< quint8 >();
+    } else if (colorSpace->colorDepthId() == Integer16BitsColorDepthID) {
+        adj = new KisBurnHighlightsAdjustment< quint16 >();
+    } else if (colorSpace->colorDepthId() == Float32BitsColorDepthID) {
+        adj = 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/extensions_plugin.cc \
b/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.h similarity \
index 53% copy from krita/plugins/colorspaces/extensions/extensions_plugin.cc
copy to krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.h
index 18fe6d9..9648231 100644
--- a/krita/plugins/colorspaces/extensions/extensions_plugin.cc
+++ b/krita/plugins/colorspaces/extensions/kis_burnhighlights_adjustment.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
+ *  Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,25 +17,21 @@
  * Boston, MA 02110-1301, USA.
 */
 
-#include "extensions_plugin.h"
-#include <kis_debug.h>
-#include <kpluginfactory.h>
+ #ifndef _KIS_BURN_HIGHLIGHTS_ADJUSTMENT_H_
+ #define _KIS_BURN_HIGHLIGHTS_ADJUSTMENT_H_
 
-#include <KoColorTransformationFactoryRegistry.h>
+ #include "KoColorTransformationFactory.h"
 
-#include "kis_hsv_adjustment.h"
+ class KisBurnHighlightsAdjustmentFactory : public KoColorTransformationFactory
+ {
+ public:
 
-K_PLUGIN_FACTORY(ExtensionsPluginFactory, registerPlugin<ExtensionsPlugin>();)
-K_EXPORT_PLUGIN(ExtensionsPluginFactory("krita"))
+ 	KisBurnHighlightsAdjustmentFactory();
 
-ExtensionsPlugin::ExtensionsPlugin(QObject *parent, const QVariantList &)
-{
-    Q_UNUSED(parent);
-    KoColorTransformationFactoryRegistry::addColorTransformationFactory(new \
                KisHSVAdjustmentFactory);
-}
+ 	virtual QList< QPair< KoID, KoID > > supportedModels() const;
 
-ExtensionsPlugin::~ExtensionsPlugin()
-{
-}
+ 	virtual KoColorTransformation* createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const;  
-#include "extensions_plugin.moc"
+ };
+
+ #endif
\ No newline at end of file
diff --git a/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.cc \
b/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.cc new file mode \
100644 index 0000000..8861756
--- /dev/null
+++ b/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.cc
@@ -0,0 +1,128 @@
+/*
+ *  Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
+ *
+ * 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 <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>
+
+template<typename _channel_type_>
+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 = reinterpret_cast<const RGBPixel*>(srcU8);
+        RGBPixel* dst = reinterpret_cast<RGBPixel*>(dstU8);
+        float r, g, b; 
+        while(nPixels > 0)
+        {   
+            r = pow(KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->red), \
exposure); +            g = pow(KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->green), exposure); +            b = \
pow(KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->blue), exposure); +       \
 +            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->alpha = src->alpha;
+            
+            --nPixels;
+            ++src;
+            ++dst;
+        }
+    }
+
+	virtual QList<QString> parameters() const
+	{
+  	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)
+    {
+        switch(id)
+        {
+        case 0:
+            exposure = parameter.toDouble();
+            break;
+        default:
+            ;
+        }
+    }
+private:
+
+	float exposure;
+ };
+
+ KisBurnMidtonesAdjustmentFactory::KisBurnMidtonesAdjustmentFactory()
+    : KoColorTransformationFactory("BurnMidtones", i18n("BurnMidtones Adjustment"))
+{
+}
+
+QList< QPair< KoID, KoID > > KisBurnMidtonesAdjustmentFactory::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));
+    return l;
+}
+
+KoColorTransformation* KisBurnMidtonesAdjustmentFactory::createTransformation(const \
KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const +{
+    KoColorTransformation * adj;
+    if (colorSpace->colorModelId() != RGBAColorModelID) {
+        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisBurnMidtonesAdjustment::createTransformation"; +        return 0;
+    }
+    if (colorSpace->colorDepthId() == Float32BitsColorDepthID) {
+        adj = new KisBurnMidtonesAdjustment< float >();
+    } else if (colorSpace->colorDepthId() == Integer16BitsColorDepthID) {
+        adj = new KisBurnMidtonesAdjustment< quint16 >();
+    } else if (colorSpace->colorDepthId() == Integer8BitsColorDepthID) {
+        adj = 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/extensions_plugin.cc \
b/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.h similarity index \
53% copy from krita/plugins/colorspaces/extensions/extensions_plugin.cc
copy to krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.h
index 18fe6d9..4b9597b 100644
--- a/krita/plugins/colorspaces/extensions/extensions_plugin.cc
+++ b/krita/plugins/colorspaces/extensions/kis_burnmidtones_adjustment.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
+ *  Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,25 +17,21 @@
  * Boston, MA 02110-1301, USA.
 */
 
-#include "extensions_plugin.h"
-#include <kis_debug.h>
-#include <kpluginfactory.h>
+ #ifndef _KIS_BURN_MIDTONES_ADJUSTMENT_H_
+ #define _KIS_BURN_MIDTONES_ADJUSTMENT_H_
 
-#include <KoColorTransformationFactoryRegistry.h>
+ #include "KoColorTransformationFactory.h"
 
-#include "kis_hsv_adjustment.h"
+ class KisBurnMidtonesAdjustmentFactory : public KoColorTransformationFactory
+ {
+ public:
 
-K_PLUGIN_FACTORY(ExtensionsPluginFactory, registerPlugin<ExtensionsPlugin>();)
-K_EXPORT_PLUGIN(ExtensionsPluginFactory("krita"))
+ 	KisBurnMidtonesAdjustmentFactory();
 
-ExtensionsPlugin::ExtensionsPlugin(QObject *parent, const QVariantList &)
-{
-    Q_UNUSED(parent);
-    KoColorTransformationFactoryRegistry::addColorTransformationFactory(new \
                KisHSVAdjustmentFactory);
-}
+ 	virtual QList< QPair< KoID, KoID > > supportedModels() const;
 
-ExtensionsPlugin::~ExtensionsPlugin()
-{
-}
+ 	virtual KoColorTransformation* createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const;  
-#include "extensions_plugin.moc"
+ };
+
+ #endif
\ No newline at end of file
diff --git a/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.cc \
b/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.cc new file mode \
100644 index 0000000..5131ccf
--- /dev/null
+++ b/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.cc
@@ -0,0 +1,127 @@
+/*
+ *  Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
+ *
+ * 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 <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>
+
+template<typename _channel_type_>
+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 = reinterpret_cast<const RGBPixel*>(srcU8);
+        RGBPixel* dst = reinterpret_cast<RGBPixel*>(dstU8);
+        float r, g, b;
+        while (nPixels > 0) {
+            r = (KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->red) - \
exposure) / (1.0 - exposure); +            g = (KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->green) - exposure) / (1.0 - exposure); +            b = \
(KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->blue) - exposure) / (1.0 - \
exposure); +            
+            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->alpha = src->alpha;
+            
+            --nPixels;
+            ++src;
+            ++dst;
+        }
+ 	}
+
+	virtual QList<QString> parameters() const
+	{
+  	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)
+    {
+        switch(id)
+        {
+        case 0:
+            exposure = parameter.toDouble();
+            break;
+        default:
+            ;
+        }
+    }
+private:
+
+	float exposure;
+ };
+
+ KisBurnShadowsAdjustmentFactory::KisBurnShadowsAdjustmentFactory()
+    : KoColorTransformationFactory("BurnShadows", i18n("BurnShadows Adjustment"))
+{
+}
+
+QList< QPair< KoID, KoID > > KisBurnShadowsAdjustmentFactory::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));
+    return l;
+}
+
+KoColorTransformation* KisBurnShadowsAdjustmentFactory::createTransformation(const \
KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const +{
+    KoColorTransformation * adj;
+    if (colorSpace->colorModelId() != RGBAColorModelID) {
+        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisBurnShadowsAdjustment::createTransformation"; +        return 0;
+    }
+    if (colorSpace->colorDepthId() == Integer8BitsColorDepthID) {
+        adj = new KisBurnShadowsAdjustment< quint8 >();
+    } else if (colorSpace->colorDepthId() == Integer16BitsColorDepthID) {
+        adj = new KisBurnShadowsAdjustment< quint16 >();
+    } else if (colorSpace->colorDepthId() == Float32BitsColorDepthID) {
+        adj = 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/extensions_plugin.cc \
b/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.h similarity index \
53% copy from krita/plugins/colorspaces/extensions/extensions_plugin.cc
copy to krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.h
index 18fe6d9..61ec996 100644
--- a/krita/plugins/colorspaces/extensions/extensions_plugin.cc
+++ b/krita/plugins/colorspaces/extensions/kis_burnshadows_adjustment.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
+ *  Copyright (c) 2013 Sahil Nagpal <nagpal.sahil@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,25 +17,21 @@
  * Boston, MA 02110-1301, USA.
 */
 
-#include "extensions_plugin.h"
-#include <kis_debug.h>
-#include <kpluginfactory.h>
+ #ifndef _KIS_BURN_SHADOWS_ADJUSTMENT_H_
+ #define _KIS_BURN_SHADOWS_ADJUSTMENT_H_
 
-#include <KoColorTransformationFactoryRegistry.h>
+ #include "KoColorTransformationFactory.h"
 
-#include "kis_hsv_adjustment.h"
+ class KisBurnShadowsAdjustmentFactory : public KoColorTransformationFactory
+ {
+ public:
 
-K_PLUGIN_FACTORY(ExtensionsPluginFactory, registerPlugin<ExtensionsPlugin>();)
-K_EXPORT_PLUGIN(ExtensionsPluginFactory("krita"))
+ 	KisBurnShadowsAdjustmentFactory();
 
-ExtensionsPlugin::ExtensionsPlugin(QObject *parent, const QVariantList &)
-{
-    Q_UNUSED(parent);
-    KoColorTransformationFactoryRegistry::addColorTransformationFactory(new \
                KisHSVAdjustmentFactory);
-}
+ 	virtual QList< QPair< KoID, KoID > > supportedModels() const;
 
-ExtensionsPlugin::~ExtensionsPlugin()
-{
-}
+ 	virtual KoColorTransformation* createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const;  
-#include "extensions_plugin.moc"
+ };
+
+ #endif
\ No newline at end of file
diff --git a/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp \
b/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp new file \
mode 100644 index 0000000..df0d1d9
--- /dev/null
+++ b/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.cpp
@@ -0,0 +1,129 @@
+/*
+ *  Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
+ *
+ * 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_dodgehighlights_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>
+
+template<typename _channel_type_>
+class KisDodgeHighlightsAdjustment : public KoColorTransformation
+{
+    typedef KoBgrTraits<_channel_type_> RGBTrait;
+    typedef typename RGBTrait::Pixel RGBPixel;
+
+public:
+ 	KisDodgeHighlightsAdjustment(){};
+
+ 	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); +           \
 +            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->alpha = src->alpha;
+            
+            --nPixels;
+            ++src;
+            ++dst;
+        }
+
+    }
+
+	virtual QList<QString> parameters() const
+	{
+  	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)
+    {
+        switch(id)
+        {
+        case 0:
+            exposure = parameter.toDouble();
+            break;
+        default:
+            ;
+        }
+    }
+private:
+
+	float exposure;
+ };
+
+ KisDodgeHighlightsAdjustmentFactory::KisDodgeHighlightsAdjustmentFactory()
+    : KoColorTransformationFactory("DodgeHighlights", i18n("DODGE Adjustment"))
+{
+}
+
+QList< QPair< KoID, KoID > > KisDodgeHighlightsAdjustmentFactory::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));
+    return l;
+}
+
+KoColorTransformation* \
KisDodgeHighlightsAdjustmentFactory::createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const +{
+    KoColorTransformation * adj;
+    if (colorSpace->colorModelId() != RGBAColorModelID) {
+        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeHighlightsAdjustment::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 >();
+    } else {
+        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeHighlightsAdjustment::createTransformation"; +        return 0;
+    }
+    adj->setParameters(parameters);
+    return adj;
+
+}
diff --git a/krita/plugins/colorspaces/extensions/extensions_plugin.cc \
b/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.h similarity \
index 53% copy from krita/plugins/colorspaces/extensions/extensions_plugin.cc
copy to krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.h
index 18fe6d9..c0f7a09 100644
--- a/krita/plugins/colorspaces/extensions/extensions_plugin.cc
+++ b/krita/plugins/colorspaces/extensions/kis_dodgehighlights_adjustment.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
+ *  Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,25 +17,21 @@
  * Boston, MA 02110-1301, USA.
 */
 
-#include "extensions_plugin.h"
-#include <kis_debug.h>
-#include <kpluginfactory.h>
+ #ifndef _KIS_DODGE_HIGHLIGHTS_ADJUSTMENT_H_
+ #define _KIS_DODGE_HIGHLIGHTS_ADJUSTMENT_H_
 
-#include <KoColorTransformationFactoryRegistry.h>
+ #include "KoColorTransformationFactory.h"
 
-#include "kis_hsv_adjustment.h"
+ class KisDodgeHighlightsAdjustmentFactory : public KoColorTransformationFactory
+ {
+ public:
 
-K_PLUGIN_FACTORY(ExtensionsPluginFactory, registerPlugin<ExtensionsPlugin>();)
-K_EXPORT_PLUGIN(ExtensionsPluginFactory("krita"))
+ 	KisDodgeHighlightsAdjustmentFactory();
 
-ExtensionsPlugin::ExtensionsPlugin(QObject *parent, const QVariantList &)
-{
-    Q_UNUSED(parent);
-    KoColorTransformationFactoryRegistry::addColorTransformationFactory(new \
                KisHSVAdjustmentFactory);
-}
+ 	virtual QList< QPair< KoID, KoID > > supportedModels() const;
 
-ExtensionsPlugin::~ExtensionsPlugin()
-{
-}
+ 	virtual KoColorTransformation* createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const;  
-#include "extensions_plugin.moc"
+ };
+
+ #endif
\ No newline at end of file
diff --git a/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.cc \
b/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.cc new file mode \
100644 index 0000000..260c108
--- /dev/null
+++ b/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.cc
@@ -0,0 +1,129 @@
+/*
+ *  Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
+ *
+ * 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 <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>
+ 
+template<typename _channel_type_>
+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) const
+    {
+    	const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
+        RGBPixel* dst = reinterpret_cast<RGBPixel*>(dstU8);
+        float r, g, b; 
+        while(nPixels > 0)
+        {   
+            r = pow(KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->red), \
exposure); +            g = pow(KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->green), exposure); +            b = \
pow(KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->blue), exposure); +       \
 +            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->alpha = src->alpha;
+            
+            --nPixels;
+            ++src;
+            ++dst;
+        }
+    }
+
+    virtual QList<QString> parameters() const
+    {
+    	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)
+    {
+        switch(id)
+        {
+        case 0:
+            exposure = parameter.toDouble();
+            break;
+        default:
+            ;
+        }
+    }
+private:
+
+	float exposure;
+};
+
+ KisDodgeMidtonesAdjustmentFactory::KisDodgeMidtonesAdjustmentFactory()
+    : KoColorTransformationFactory("DodgeMidtones", i18n("DodgeMidtones \
Adjustment")) +{
+}
+
+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)); 
+    return l;
+}
+
+KoColorTransformation* KisDodgeMidtonesAdjustmentFactory::createTransformation(const \
KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const +{
+    KoColorTransformation * adj;
+    if (colorSpace->colorModelId() != RGBAColorModelID) {
+        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeMidtonesAdjustmentFactory::createTransformation"; +        return 0;
+    }
+    if (colorSpace->colorDepthId() == Float32BitsColorDepthID) {
+        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 \
KisDodgeMidtonesAdjustmentFactory::createTransformation"; +        return 0;
+    }
+    adj->setParameters(parameters);
+    return adj;
+}
diff --git a/krita/plugins/colorspaces/extensions/extensions_plugin.cc \
b/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.h similarity \
index 53% copy from krita/plugins/colorspaces/extensions/extensions_plugin.cc
copy to krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.h
index 18fe6d9..1bf31ef 100644
--- a/krita/plugins/colorspaces/extensions/extensions_plugin.cc
+++ b/krita/plugins/colorspaces/extensions/kis_dodgemidtones_adjustment.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
+ *  Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,25 +17,21 @@
  * Boston, MA 02110-1301, USA.
 */
 
-#include "extensions_plugin.h"
-#include <kis_debug.h>
-#include <kpluginfactory.h>
+ #ifndef _KIS_DODGE_MIDTONES_ADJUSTMENT_H_
+ #define _KIS_DODGE_MIDTONES_ADJUSTMENT_H_
 
-#include <KoColorTransformationFactoryRegistry.h>
+ #include "KoColorTransformationFactory.h"
 
-#include "kis_hsv_adjustment.h"
+ class KisDodgeMidtonesAdjustmentFactory : public KoColorTransformationFactory
+ {
+ public:
 
-K_PLUGIN_FACTORY(ExtensionsPluginFactory, registerPlugin<ExtensionsPlugin>();)
-K_EXPORT_PLUGIN(ExtensionsPluginFactory("krita"))
+ 	KisDodgeMidtonesAdjustmentFactory();
 
-ExtensionsPlugin::ExtensionsPlugin(QObject *parent, const QVariantList &)
-{
-    Q_UNUSED(parent);
-    KoColorTransformationFactoryRegistry::addColorTransformationFactory(new \
                KisHSVAdjustmentFactory);
-}
+ 	virtual QList< QPair< KoID, KoID > > supportedModels() const;
 
-ExtensionsPlugin::~ExtensionsPlugin()
-{
-}
+ 	virtual KoColorTransformation* createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const;  
-#include "extensions_plugin.moc"
+ };
+
+ #endif
\ No newline at end of file
diff --git a/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.cc \
b/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.cc new file mode \
100644 index 0000000..dd2fa1b
--- /dev/null
+++ b/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.cc
@@ -0,0 +1,127 @@
+/*
+ *  Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
+ *
+ * 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 <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>
+
+template<typename _channel_type_>
+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 = 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))  - exposure * KoColorSpaceMaths<_channel_type_, \
float>::scaleToA(src->red); +            g = (exposure + \
KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->green)) - exposure * \
KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->green); +            b = \
(exposure + KoColorSpaceMaths<_channel_type_, float>::scaleToA(src->blue)) - exposure \
* 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->alpha = src->alpha;
+            
+            --nPixels;
+            ++src;
+            ++dst;
+        }
+    }
+
+	virtual QList<QString> parameters() const
+	{
+  	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)
+    {
+        switch(id)
+        {
+        case 0:
+            exposure = parameter.toDouble();
+            break;
+        default:
+            ;
+        }
+    }
+private:
+
+	float exposure;
+ };
+
+ KisDodgeShadowsAdjustmentFactory::KisDodgeShadowsAdjustmentFactory()
+    : KoColorTransformationFactory("DodgeShadows", i18n("DodgeShadows Adjustment"))
+{
+}
+
+QList< QPair< KoID, KoID > > KisDodgeShadowsAdjustmentFactory::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));
+    return l;
+}
+
+KoColorTransformation* KisDodgeShadowsAdjustmentFactory::createTransformation(const \
KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const +{
+    KoColorTransformation * adj;
+    if (colorSpace->colorModelId() != RGBAColorModelID) {
+        kError() << "Unsupported color space " << colorSpace->id() << " in \
KisDodgeShadowsAdjustmentFactory::createTransformation"; +        return 0;
+    }
+    if (colorSpace->colorDepthId() == Float32BitsColorDepthID) {
+        adj = new KisDodgeShadowsAdjustment < float >();
+    } else if (colorSpace->colorDepthId() == Integer16BitsColorDepthID) {
+        adj = new KisDodgeShadowsAdjustment< quint16 >();
+    } else if (colorSpace->colorDepthId() == Integer8BitsColorDepthID) {
+        adj = 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/extensions_plugin.cc \
b/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.h similarity index \
53% copy from krita/plugins/colorspaces/extensions/extensions_plugin.cc
copy to krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.h
index 18fe6d9..4e14f1b 100644
--- a/krita/plugins/colorspaces/extensions/extensions_plugin.cc
+++ b/krita/plugins/colorspaces/extensions/kis_dodgeshadows_adjustment.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
+ *  Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,25 +17,21 @@
  * Boston, MA 02110-1301, USA.
 */
 
-#include "extensions_plugin.h"
-#include <kis_debug.h>
-#include <kpluginfactory.h>
+ #ifndef _KIS_DODGE_SHADOWS_ADJUSTMENT_H_
+ #define _KIS_DODGE_SHADOWS_ADJUSTMENT_H_
 
-#include <KoColorTransformationFactoryRegistry.h>
+ #include "KoColorTransformationFactory.h"
 
-#include "kis_hsv_adjustment.h"
+ class KisDodgeShadowsAdjustmentFactory : public KoColorTransformationFactory
+ {
+ public:
 
-K_PLUGIN_FACTORY(ExtensionsPluginFactory, registerPlugin<ExtensionsPlugin>();)
-K_EXPORT_PLUGIN(ExtensionsPluginFactory("krita"))
+ 	KisDodgeShadowsAdjustmentFactory();
 
-ExtensionsPlugin::ExtensionsPlugin(QObject *parent, const QVariantList &)
-{
-    Q_UNUSED(parent);
-    KoColorTransformationFactoryRegistry::addColorTransformationFactory(new \
                KisHSVAdjustmentFactory);
-}
+ 	virtual QList< QPair< KoID, KoID > > supportedModels() const;
 
-ExtensionsPlugin::~ExtensionsPlugin()
-{
-}
+ 	virtual KoColorTransformation* createTransformation(const KoColorSpace* \
colorSpace, QHash<QString, QVariant> parameters) const;  
-#include "extensions_plugin.moc"
+ };
+
+ #endif
\ No newline at end of file


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

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