diff --git a/krita/image/filter/kis_color_transformation_filter.cc b/krita/image/filter/kis_color_transformation_filter.cc index 755bb8e013c..0b61dd4c919 100644 --- a/krita/image/filter/kis_color_transformation_filter.cc +++ b/krita/image/filter/kis_color_transformation_filter.cc @@ -1,81 +1,86 @@ /* * Copyright (c) 2004, 2009 Cyrille Berger * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library 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_color_transformation_filter.h" #include #include #include #include #include #ifndef NDEBUG #include #endif #include #include "kis_color_transformation_configuration.h" KisColorTransformationFilter::KisColorTransformationFilter(const KoID& id, const KoID & category, const QString & entry) : KisFilter(id, category, entry) { } KisColorTransformationFilter::~KisColorTransformationFilter() { } void KisColorTransformationFilter::processImpl(KisPaintDeviceSP device, const QRect& applyRect, const KisFilterConfiguration* config, KoUpdater* progressUpdater ) const { Q_ASSERT(!device.isNull()); if (progressUpdater) { progressUpdater->setRange(0, applyRect.height() * applyRect.width()); } const KoColorSpace * cs = device->colorSpace(); KoColorTransformation * colorTransformation = 0; const KisColorTransformationConfiguration * colorTransformationConfiguration = dynamic_cast(config); if (colorTransformationConfiguration) { colorTransformation = colorTransformationConfiguration->colorTransformation(cs, this); } else { colorTransformation = createTransformation(cs, config); } if (!colorTransformation) return; KisSequentialIterator it(device, applyRect); int p = 0; int conseq; do { conseq = it.nConseqPixels(); colorTransformation->transform(it.oldRawData(), it.rawData(), conseq); if (progressUpdater) progressUpdater->setValue(p += conseq); } while(it.nextPixels(conseq)); if (!colorTransformationConfiguration) { delete colorTransformation; } } + +KisFilterConfiguration * KisColorTransformationFilter::factoryConfiguration(const KisPaintDeviceSP) const +{ + return new KisColorTransformationConfiguration(id(), 0); +} diff --git a/krita/image/filter/kis_color_transformation_filter.h b/krita/image/filter/kis_color_transformation_filter.h index f30125337fa..7fa24561695 100644 --- a/krita/image/filter/kis_color_transformation_filter.h +++ b/krita/image/filter/kis_color_transformation_filter.h @@ -1,46 +1,48 @@ /* * Copyright (c) 2009 Cyrille Berger * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library 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. */ #ifndef _KIS_COLOR_TRANSFORMATION_FILTER_H_ #define _KIS_COLOR_TRANSFORMATION_FILTER_H_ #include "kis_filter.h" #include "krita_export.h" /** * This is a base class for filters that implement a filter for * \ref KoColorTransformation based filters. */ class KRITAIMAGE_EXPORT KisColorTransformationFilter : public KisFilter { public: KisColorTransformationFilter(const KoID& id, const KoID & category, const QString & entry); virtual ~KisColorTransformationFilter(); virtual void processImpl(KisPaintDeviceSP device, const QRect& applyRect, const KisFilterConfiguration* config, KoUpdater* progressUpdater ) const; /** * Create the color transformation that will be applied on the device. */ virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfiguration* config) const = 0; + + virtual KisFilterConfiguration* factoryConfiguration(const KisPaintDeviceSP) const; }; #endif