summaryrefslogtreecommitdiffstats
path: root/src/imageplugins/infrared
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2024-11-22 18:41:30 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2024-11-22 18:41:30 +0900
commitee0d99607c14cb63d3ebdb3a970b508949fa8219 (patch)
tree94ac1efedb94cb38bf6879ba0610fe75b554216b /src/imageplugins/infrared
parent4adff739380e4ae9f30e443ee95644f184456869 (diff)
downloaddigikam-ee0d99607c14cb63d3ebdb3a970b508949fa8219.tar.gz
digikam-ee0d99607c14cb63d3ebdb3a970b508949fa8219.zip
Rename 'digikam' folder to 'src'
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/imageplugins/infrared')
-rw-r--r--src/imageplugins/infrared/Makefile.am34
-rw-r--r--src/imageplugins/infrared/digikamimageplugin_infrared.desktop52
-rw-r--r--src/imageplugins/infrared/digikamimageplugin_infrared_ui.rc19
-rw-r--r--src/imageplugins/infrared/imageeffect_infrared.cpp227
-rw-r--r--src/imageplugins/infrared/imageeffect_infrared.h76
-rw-r--r--src/imageplugins/infrared/imageplugin_infrared.cpp71
-rw-r--r--src/imageplugins/infrared/imageplugin_infrared.h57
-rw-r--r--src/imageplugins/infrared/infrared.cpp367
-rw-r--r--src/imageplugins/infrared/infrared.h60
-rw-r--r--src/imageplugins/infrared/infraredtool.cpp225
-rw-r--r--src/imageplugins/infrared/infraredtool.h86
11 files changed, 1274 insertions, 0 deletions
diff --git a/src/imageplugins/infrared/Makefile.am b/src/imageplugins/infrared/Makefile.am
new file mode 100644
index 00000000..1e9cd294
--- /dev/null
+++ b/src/imageplugins/infrared/Makefile.am
@@ -0,0 +1,34 @@
+METASOURCES = AUTO
+
+INCLUDES = -I$(top_srcdir)/src/utilities/imageeditor/editor \
+ -I$(top_srcdir)/src/utilities/imageeditor/canvas \
+ -I$(top_srcdir)/src/libs/histogram \
+ -I$(top_srcdir)/src/libs/levels \
+ -I$(top_srcdir)/src/libs/curves \
+ -I$(top_srcdir)/src/libs/whitebalance \
+ -I$(top_srcdir)/src/libs/widgets/common \
+ -I$(top_srcdir)/src/libs/widgets/iccprofiles \
+ -I$(top_srcdir)/src/libs/widgets/imageplugins \
+ -I$(top_srcdir)/src/libs/dialogs \
+ -I$(top_srcdir)/src/libs/dimg \
+ -I$(top_srcdir)/src/libs/dmetadata \
+ -I$(top_srcdir)/src/libs/dimg/filters \
+ -I$(top_srcdir)/src/digikam \
+ $(LIBKDCRAW_CFLAGS) \
+ $(all_includes)
+
+digikamimageplugin_infrared_la_SOURCES = imageplugin_infrared.cpp \
+ infraredtool.cpp infrared.cpp
+
+digikamimageplugin_infrared_la_LIBADD = $(LIB_TDEPARTS) \
+ $(top_builddir)/src/digikam/libdigikam.la
+
+digikamimageplugin_infrared_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) -ltdecore -ltdeui $(LIB_TQT) -ltdefx -lkdcraw -ltdeio
+
+kde_services_DATA = digikamimageplugin_infrared.desktop
+
+kde_module_LTLIBRARIES = digikamimageplugin_infrared.la
+
+rcdir = $(kde_datadir)/digikam
+rc_DATA = digikamimageplugin_infrared_ui.rc
+
diff --git a/src/imageplugins/infrared/digikamimageplugin_infrared.desktop b/src/imageplugins/infrared/digikamimageplugin_infrared.desktop
new file mode 100644
index 00000000..716de474
--- /dev/null
+++ b/src/imageplugins/infrared/digikamimageplugin_infrared.desktop
@@ -0,0 +1,52 @@
+[Desktop Entry]
+Name=ImagePlugin_Infrared
+Name[bg]=Приставка за снимки - Инфрачервен филм
+Name[da]=Plugin for infrarødt
+Name[el]=ΠρόσθετοΕικόνας_Υπέρυθρο
+Name[fi]=Infrapuna
+Name[hr]=Infracrveno
+Name[it]=PluginImmagini_Infrarosso
+Name[ms]=ImagePlugin_Inframerah
+Name[nl]=Afbeeldingsplugin_Infrarood
+Name[sr]=Инфрацрвено
+Name[sr@Latn]=Infracrveno
+Name[sv]=Insticksprogram för infrarött
+Name[tr]=ResimEklentisi_Kızılötesi
+Name[xx]=xxImagePlugin_Infraredxx
+
+Type=Service
+X-TDE-ServiceTypes=Digikam/ImagePlugin
+Encoding=UTF-8
+Comment=Simulate infrared film plugin for digiKam
+Comment[bg]=Приставка на digiKam за наподобяване на снимка с инфрачервен филм
+Comment[ca]=Connector pel digiKam de simulació de pel·lícula d'infraroigs
+Comment[da]=Digikam plugin til at simulere infrarød film
+Comment[de]=digiKam-Modul für die Simulation eines Infrarot-Filmes
+Comment[el]=Πρόσθετο εξομοίωσης υπέρυθρου φιλμ για το digiKam
+Comment[es]=Plugin para digiKam para simular la película infrarroja
+Comment[et]=DigiKami infrapunafilmi matkimise plugin
+Comment[fa]=شبیه‌سازی وصلۀ فیلم مادون قرمز برای digiKam
+Comment[fi]=Jäljittelee infrapunafilmiä
+Comment[gl]=Un plugin de digiKam para simulazón de infravermellos
+Comment[hr]=digiKam dodatak za oponašanje IC filma
+Comment[is]=Íforrit fyrir digiKam sem líkir eftir innrauðri filmu
+Comment[it]=Plugin di simulazione di pellicola infrarossa per digiKam
+Comment[ja]=digiKam 赤外線フィルム効果プラグイン
+Comment[nds]=digiKam-Moduul för't Simuleren vun Infraroot-Filmen
+Comment[nl]=Digikam-plugin voor infraroodfilm-effect
+Comment[pa]=ਡਿਜ਼ੀਕੈਮ ਲਈ ਸਿਮੂਲੇਸ਼ਨ ਇੰਫਰਾਰੈੱਡ ਫਿਲਮ ਪਲੱਗਇਨ
+Comment[pl]=Wtyczka do programu digiKam symulująca efekt podczerwonej kliszy
+Comment[pt]=Um 'plugin' do digiKam para simulação de infravermelhos
+Comment[pt_BR]=Um 'plugin' do digiKam para simulação de infravermelhos
+Comment[ru]=Модуль имитирующий инфракрасное фильм для digiKam
+Comment[sk]=digiKam plugin pre napodobenie infračerveného filmu
+Comment[sr]=digiKam-ов прикључак који симулира инфрацрвени филм
+Comment[sr@Latn]=digiKam-ov priključak koji simulira infracrveni film
+Comment[sv]=Digikam insticksprogram för att simulera infraröd film
+Comment[tr]=digiKam için kızılötesi film benzetme eklentisi
+Comment[uk]=Втулок симуляції інфрачервоного фільму для digiKam
+Comment[vi]=Phần bổ sung mô phỏng phim ảnh hồng ngoại cho digiKam
+Comment[xx]=xxSimulate infrared film plugin for digiKamxx
+
+X-TDE-Library=digikamimageplugin_infrared
+author=Gilles Caulier, caulier dot gilles at gmail dot com
diff --git a/src/imageplugins/infrared/digikamimageplugin_infrared_ui.rc b/src/imageplugins/infrared/digikamimageplugin_infrared_ui.rc
new file mode 100644
index 00000000..1df83fa6
--- /dev/null
+++ b/src/imageplugins/infrared/digikamimageplugin_infrared_ui.rc
@@ -0,0 +1,19 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui version="5" name="digikamimageplugin_infrared" >
+ <MenuBar>
+
+ <Menu name="Filters" ><text>F&amp;ilters</text>
+ <Action name="imageplugin_infrared" />
+ </Menu>
+
+ </MenuBar>
+
+ <ToolBar name="ToolBar" >
+ <text>Main Toolbar</text>
+ </ToolBar>
+
+ <ActionProperties>
+ <Action shortcut="" name="imageplugin_infrared" />
+ </ActionProperties>
+
+</kpartgui>
diff --git a/src/imageplugins/infrared/imageeffect_infrared.cpp b/src/imageplugins/infrared/imageeffect_infrared.cpp
new file mode 100644
index 00000000..f8069255
--- /dev/null
+++ b/src/imageplugins/infrared/imageeffect_infrared.cpp
@@ -0,0 +1,227 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-02-22
+ * Description : a digiKam image editor plugin for simulate
+ * infrared film.
+ *
+ * Copyright (C) 2005-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2006-2008 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * ============================================================ */
+
+// TQt includes.
+
+#include <tqimage.h>
+#include <tqlabel.h>
+#include <tqwhatsthis.h>
+#include <tqlcdnumber.h>
+#include <tqslider.h>
+#include <tqlayout.h>
+#include <tqdatetime.h>
+#include <tqcheckbox.h>
+
+// KDE includes.
+
+#include <tdelocale.h>
+#include <tdeaboutdata.h>
+#include <kiconloader.h>
+#include <tdeapplication.h>
+#include <kstandarddirs.h>
+#include <tdeconfig.h>
+
+// Local includes.
+
+#include "version.h"
+#include "ddebug.h"
+#include "dimg.h"
+#include "imageiface.h"
+#include "imagewidget.h"
+#include "infrared.h"
+#include "imageeffect_infrared.h"
+#include "imageeffect_infrared.moc"
+
+namespace DigikamInfraredImagesPlugin
+{
+
+ImageEffect_Infrared::ImageEffect_Infrared(TQWidget* parent)
+ : Digikam::CtrlPanelDlg(parent, i18n("Simulate Infrared Film to Photograph"),
+ "infrared", false, false, true,
+ Digikam::ImagePannelWidget::SeparateViewAll)
+{
+ TQString whatsThis;
+
+ TDEAboutData* about = new TDEAboutData("digikam",
+ I18N_NOOP("Infrared Film"),
+ digikam_version,
+ I18N_NOOP("A digiKam image plugin to simulate infrared film."),
+ TDEAboutData::License_GPL,
+ "(c) 2005, Gilles Caulier\n"
+ "(c) 2006-2008, Gilles Caulier and Marcel Wiesweg",
+ 0,
+ "http://www.digikam.org");
+
+ about->addAuthor("Gilles Caulier", I18N_NOOP("Author and maintainer"),
+ "caulier dot gilles at gmail dot com");
+
+ about->addAuthor("Marcel Wiesweg", I18N_NOOP("Developer"),
+ "marcel dot wiesweg at gmx dot de");
+
+ setAboutData(about);
+
+ // -------------------------------------------------------------
+
+ TQWidget *gboxSettings = new TQWidget(m_imagePreviewWidget);
+ TQGridLayout* gridSettings = new TQGridLayout( gboxSettings, 2, 1, 0, spacingHint());
+ TQLabel *label1 = new TQLabel(i18n("Sensitivity (ISO):"), gboxSettings);
+
+ m_sensibilitySlider = new TQSlider(1, 25, 1, 1, TQt::Horizontal, gboxSettings);
+ m_sensibilitySlider->setTracking ( false );
+ m_sensibilitySlider->setTickInterval(1);
+ m_sensibilitySlider->setTickmarks(TQSlider::Below);
+
+ m_sensibilityLCDValue = new TQLCDNumber (4, gboxSettings);
+ m_sensibilityLCDValue->setSegmentStyle ( TQLCDNumber::Flat );
+ m_sensibilityLCDValue->display( TQString::number(200) );
+ whatsThis = i18n("<p>Set here the ISO-sensitivity of the simulated infrared film. "
+ "Increasing this value will increase the proportion of green color in the mix. "
+ "It will also increase the halo effect on the hightlights, and the film "
+ "graininess (if that box is checked).</p>"
+ "<p>Note: to simulate an <b>Ilford SFX200</b> infrared film, use a sensitivity excursion of 200 to 800. "
+ "A sensitivity over 800 simulates <b>Kodak HIE</b> high-speed infrared film. This last one creates a more "
+ "dramatic photographic style.</p>");
+
+ TQWhatsThis::add( m_sensibilityLCDValue, whatsThis);
+ TQWhatsThis::add( m_sensibilitySlider, whatsThis);
+
+ gridSettings->addMultiCellWidget(label1, 0, 0, 0, 1);
+ gridSettings->addMultiCellWidget(m_sensibilitySlider, 1, 1, 0, 0);
+ gridSettings->addMultiCellWidget(m_sensibilityLCDValue, 1, 1, 1, 1);
+
+ // -------------------------------------------------------------
+
+ m_addFilmGrain = new TQCheckBox( i18n("Add film grain"), gboxSettings);
+ m_addFilmGrain->setChecked( true );
+ TQWhatsThis::add( m_addFilmGrain, i18n("<p>This option adds infrared film grain to "
+ "the image depending on ISO-sensitivity."));
+ gridSettings->addMultiCellWidget(m_addFilmGrain, 2, 2, 0, 1);
+
+ m_imagePreviewWidget->setUserAreaWidget(gboxSettings);
+
+ // -------------------------------------------------------------
+
+ connect( m_sensibilitySlider, TQ_SIGNAL(valueChanged(int)),
+ this, TQ_SLOT(slotTimer()) );
+
+ // this connection is necessary to change the LCD display when
+ // the value is changed by single clicking on the slider
+ connect( m_sensibilitySlider, TQ_SIGNAL(valueChanged(int)),
+ this, TQ_SLOT(slotSliderMoved(int)) );
+
+ connect( m_sensibilitySlider, TQ_SIGNAL(sliderMoved(int)),
+ this, TQ_SLOT(slotSliderMoved(int)) );
+
+ connect( m_addFilmGrain, TQ_SIGNAL(toggled (bool)),
+ this, TQ_SLOT(slotEffect()) );
+}
+
+ImageEffect_Infrared::~ImageEffect_Infrared()
+{
+}
+
+void ImageEffect_Infrared::renderingFinished()
+{
+ m_sensibilitySlider->setEnabled(true);
+ m_addFilmGrain->setEnabled(true);
+}
+
+void ImageEffect_Infrared::readUserSettings()
+{
+ TDEConfig* config = kapp->config();
+ config->setGroup("infrared Tool Dialog");
+ m_sensibilitySlider->blockSignals(true);
+ m_addFilmGrain->blockSignals(true);
+ m_sensibilitySlider->setValue(config->readNumEntry("SensitivityAjustment", 1));
+ m_addFilmGrain->setChecked(config->readBoolEntry("AddFilmGrain", false));
+ m_sensibilitySlider->blockSignals(false);
+ m_addFilmGrain->blockSignals(false);
+ slotSliderMoved(m_sensibilitySlider->value());
+}
+
+void ImageEffect_Infrared::writeUserSettings()
+{
+ TDEConfig* config = kapp->config();
+ config->setGroup("infrared Tool Dialog");
+ config->writeEntry("SensitivityAjustment", m_sensibilitySlider->value());
+ config->writeEntry("AddFilmGrain", m_addFilmGrain->isChecked());
+ config->sync();
+}
+
+void ImageEffect_Infrared::resetValues()
+{
+ m_sensibilitySlider->blockSignals(true);
+ m_addFilmGrain->blockSignals(true);
+ m_sensibilitySlider->setValue(1);
+ m_addFilmGrain->setChecked(false);
+ m_sensibilitySlider->blockSignals(false);
+ m_addFilmGrain->blockSignals(false);
+}
+
+void ImageEffect_Infrared::slotSliderMoved(int v)
+{
+ m_sensibilityLCDValue->display( TQString::number(100 + 100 * v) );
+}
+
+void ImageEffect_Infrared::prepareEffect()
+{
+ m_addFilmGrain->setEnabled(false);
+ m_sensibilitySlider->setEnabled(false);
+
+ Digikam::DImg image = m_imagePreviewWidget->getOriginalRegionImage();
+ int s = 100 + 100 * m_sensibilitySlider->value();
+ bool g = m_addFilmGrain->isChecked();
+
+ m_threadedFilter = dynamic_cast<Digikam::DImgThreadedFilter *>(
+ new Infrared(&image, this, s, g));
+}
+
+void ImageEffect_Infrared::prepareFinal()
+{
+ m_addFilmGrain->setEnabled(false);
+ m_sensibilitySlider->setEnabled(false);
+
+ int s = 100 + 100 * m_sensibilitySlider->value();
+ bool g = m_addFilmGrain->isChecked();
+
+ Digikam::ImageIface iface(0, 0);
+
+ m_threadedFilter = dynamic_cast<Digikam::DImgThreadedFilter *>(
+ new Infrared(iface.getOriginalImg(), this, s, g));
+}
+
+void ImageEffect_Infrared::putPreviewData(void)
+{
+ m_imagePreviewWidget->setPreviewImage(m_threadedFilter->getTargetImage());
+}
+
+void ImageEffect_Infrared::putFinalData(void)
+{
+ Digikam::ImageIface iface(0, 0);
+ iface.putOriginalImage(i18n("Infrared"), m_threadedFilter->getTargetImage().bits());
+}
+
+} // NameSpace DigikamInfraredImagesPlugin
+
diff --git a/src/imageplugins/infrared/imageeffect_infrared.h b/src/imageplugins/infrared/imageeffect_infrared.h
new file mode 100644
index 00000000..d6c28237
--- /dev/null
+++ b/src/imageplugins/infrared/imageeffect_infrared.h
@@ -0,0 +1,76 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-02-22
+ * Description : a digiKam image editor plugin for simulate
+ * infrared film.
+ *
+ * Copyright (C) 2005-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2006-2008 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * ============================================================ */
+
+#ifndef IMAGEEFFECT_INFRARED_H
+#define IMAGEEFFECT_INFRARED_H
+
+// Digikam includes.
+
+#include "ctrlpaneldlg.h"
+
+class TQSlider;
+class TQLCDNumber;
+class TQCheckBox;
+
+namespace DigikamInfraredImagesPlugin
+{
+
+class ImageEffect_Infrared : public Digikam::CtrlPanelDlg
+{
+ TQ_OBJECT
+
+
+public:
+
+ ImageEffect_Infrared(TQWidget* parent);
+ ~ImageEffect_Infrared();
+
+private slots:
+
+ void slotSliderMoved(int);
+ void readUserSettings();
+
+private:
+
+ void writeUserSettings();
+ void resetValues();
+ void prepareEffect();
+ void prepareFinal();
+ void putPreviewData();
+ void putFinalData();
+ void renderingFinished();
+
+private:
+
+ TQCheckBox *m_addFilmGrain;
+
+ TQSlider *m_sensibilitySlider;
+
+ TQLCDNumber *m_sensibilityLCDValue;
+};
+
+} // NameSpace DigikamInfraredImagesPlugin
+
+#endif /* IMAGEEFFECT_INFRARED_H */
diff --git a/src/imageplugins/infrared/imageplugin_infrared.cpp b/src/imageplugins/infrared/imageplugin_infrared.cpp
new file mode 100644
index 00000000..4b845908
--- /dev/null
+++ b/src/imageplugins/infrared/imageplugin_infrared.cpp
@@ -0,0 +1,71 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-02-22
+ * Description : a digiKam image editor plugin for simulate
+ * infrared film.
+ *
+ * Copyright (C) 2005-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * ============================================================ */
+
+// KDE includes.
+
+#include <tdelocale.h>
+#include <kgenericfactory.h>
+#include <klibloader.h>
+#include <tdeaction.h>
+#include <kcursor.h>
+#include <tdeapplication.h>
+
+// Local includes.
+
+#include "ddebug.h"
+#include "infraredtool.h"
+#include "imageplugin_infrared.h"
+#include "imageplugin_infrared.moc"
+
+using namespace DigikamInfraredImagesPlugin;
+
+K_EXPORT_COMPONENT_FACTORY(digikamimageplugin_infrared,
+ KGenericFactory<ImagePlugin_Infrared>("digikamimageplugin_infrared"));
+
+ImagePlugin_Infrared::ImagePlugin_Infrared(TQObject *parent, const char*, const TQStringList &)
+ : Digikam::ImagePlugin(parent, "ImagePlugin_Infrared")
+{
+ m_infraredAction = new TDEAction(i18n("Infrared Film..."), "infrared", 0,
+ this, TQ_SLOT(slotInfrared()),
+ actionCollection(), "imageplugin_infrared");
+
+ setXMLFile( "digikamimageplugin_infrared_ui.rc" );
+
+ DDebug() << "ImagePlugin_Infrared plugin loaded" << endl;
+}
+
+ImagePlugin_Infrared::~ImagePlugin_Infrared()
+{
+}
+
+void ImagePlugin_Infrared::setEnabledActions(bool enable)
+{
+ m_infraredAction->setEnabled(enable);
+}
+
+void ImagePlugin_Infrared::slotInfrared()
+{
+ InfraredTool *tool = new InfraredTool(this);
+ loadTool(tool);
+}
diff --git a/src/imageplugins/infrared/imageplugin_infrared.h b/src/imageplugins/infrared/imageplugin_infrared.h
new file mode 100644
index 00000000..7b6fa12a
--- /dev/null
+++ b/src/imageplugins/infrared/imageplugin_infrared.h
@@ -0,0 +1,57 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-02-22
+ * Description : a digiKam image editor plugin for simulate
+ * infrared film.
+ *
+ * Copyright (C) 2005-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * ============================================================ */
+
+#ifndef IMAGEPLUGIN_INFRARED_H
+#define IMAGEPLUGIN_INFRARED_H
+
+// Digikam includes.
+
+#include "imageplugin.h"
+#include "digikam_export.h"
+
+class TDEAction;
+
+class DIGIKAMIMAGEPLUGINS_EXPORT ImagePlugin_Infrared : public Digikam::ImagePlugin
+{
+ TQ_OBJECT
+
+
+public:
+
+ ImagePlugin_Infrared(TQObject *parent, const char* name,
+ const TQStringList &args);
+ ~ImagePlugin_Infrared();
+
+ void setEnabledActions(bool enable);
+
+private slots:
+
+ void slotInfrared();
+
+private:
+
+ TDEAction *m_infraredAction;
+};
+
+#endif /* IMAGEPLUGIN_INFRARED_H */
diff --git a/src/imageplugins/infrared/infrared.cpp b/src/imageplugins/infrared/infrared.cpp
new file mode 100644
index 00000000..fa2983d5
--- /dev/null
+++ b/src/imageplugins/infrared/infrared.cpp
@@ -0,0 +1,367 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-05-25
+ * Description : Infrared threaded image filter.
+ *
+ * Copyright (C) 2005-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2006-2007 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * ============================================================ */
+
+// C++ includes.
+
+#include <cmath>
+#include <cstdlib>
+
+// TQt includes.
+
+#include <tqdatetime.h>
+
+// Local includes.
+
+#include "ddebug.h"
+#include "dimg.h"
+#include "dimggaussianblur.h"
+#include "imagecurves.h"
+#include "imagehistogram.h"
+#include "dimgimagefilters.h"
+#include "infrared.h"
+
+namespace DigikamInfraredImagesPlugin
+{
+
+Infrared::Infrared(Digikam::DImg *orgImage, TQObject *parent, int sensibility, bool grain)
+ : Digikam::DImgThreadedFilter(orgImage, parent, "Infrared")
+{
+ m_sensibility = sensibility;
+ m_grain = grain;
+ initFilter();
+}
+
+void Infrared::filterImage(void)
+{
+ infraredImage(&m_orgImage, m_sensibility, m_grain);
+}
+
+// This method is based on the Simulate Infrared Film tutorial from GimpGuru.org web site
+// available at this url : http://www.gimpguru.org/Tutorials/SimulatedInfrared/
+
+inline static int intMult8(uint a, uint b)
+{
+ uint t = a * b + 0x80;
+ return ((t >> 8) + t) >> 8;
+}
+
+inline static int intMult16(uint a, uint b)
+{
+ uint t = a * b + 0x8000;
+ return ((t >> 16) + t) >> 16;
+}
+
+/* More info about IR film can be seen at this url :
+
+http://www.pauck.de/marco/photo/infrared/comparison_of_films/comparison_of_films.html
+*/
+
+void Infrared::infraredImage(Digikam::DImg *orgImage, int Sensibility, bool Grain)
+{
+ // Sensibility: 200..2600
+
+ if (Sensibility <= 0) return;
+
+ int Width = orgImage->width();
+ int Height = orgImage->height();
+ int bytesDepth = orgImage->bytesDepth();
+ uint numBytes = orgImage->numBytes();
+ bool sixteenBit = orgImage->sixteenBit();
+ uchar* data = orgImage->bits();
+
+ // Infrared film variables depending on Sensibility.
+ // We can reproduce famous Ilford SFX200 infrared film
+ // http://www.ilford.com/html/us_english/prod_html/sfx200/sfx200.html
+ // This film have a sensibility escursion from 200 to 800 ISO.
+ // Over 800 ISO, we reproduce The Kodak HIE hight speed infrared film.
+
+ // Infrared film grain.
+ int Noise = (Sensibility + 3000) / 10;
+ if (sixteenBit)
+ Noise = (Noise + 1) * 256 - 1;
+
+ int blurRadius = (int)((Sensibility / 200.0) + 1.0); // Gaussian blur infrared hightlight effect
+ // [2 to 5].
+ float greenBoost = 2.1 - (Sensibility / 2000.0); // Infrared green color boost [1.7 to 2.0].
+
+ int nRand, offset, progress;
+
+ uchar* pBWBits = 0; // Black and White conversion.
+ uchar* pBWBlurBits = 0; // Black and White with blur.
+ uchar* pGrainBits = 0; // Grain blured without curves adjustment.
+ uchar* pMaskBits = 0; // Grain mask with curves adjustment.
+ uchar* pOverlayBits = 0; // Overlay to merge with original converted in gray scale.
+ uchar* pOutBits = m_destImage.bits(); // Destination image with merged grain mask and original.
+
+ Digikam::DColor bwData, bwBlurData, grainData, maskData, overData, outData;
+
+ //------------------------------------------
+ // 1 - Create GrayScale green boosted image.
+ //------------------------------------------
+
+ // Convert to gray scale with boosting Green channel.
+ // Infrared film increase green color.
+
+ Digikam::DImg BWImage(Width, Height, sixteenBit); // Black and White conversion.
+ pBWBits = BWImage.bits();
+ memcpy (pBWBits, data, numBytes);
+
+ Digikam::DImgImageFilters().channelMixerImage(pBWBits, Width, Height, sixteenBit, // Image data.
+ true, // Preserve luminosity.
+ true, // Monochrome.
+ 0.4, greenBoost, -0.8, // Red channel gains.
+ 0.0, 1.0, 0.0, // Green channel gains (not used).
+ 0.0, 0.0, 1.0); // Blue channel gains (not used).
+ postProgress( 10 );
+ if (m_cancel)
+ {
+ return;
+ }
+
+ // Apply a Gaussian blur to the black and white image.
+ // This way simulate Infrared film dispersion for the highlights.
+
+ Digikam::DImg BWBlurImage(Width, Height, sixteenBit);
+ pBWBlurBits = BWBlurImage.bits();
+
+ Digikam::DImgGaussianBlur(this, BWImage, BWBlurImage, 10, 20, blurRadius);
+
+ if (m_cancel)
+ {
+ return;
+ }
+
+ //-----------------------------------------------------------------
+ // 2 - Create Gaussian blured averlay mask with grain if necessary.
+ //-----------------------------------------------------------------
+
+
+ if (Grain)
+ {
+
+ // Create gray grain mask.
+
+ TQDateTime dt = TQDateTime::currentDateTime();
+ TQDateTime Y2000( TQDate(2000, 1, 1), TQTime(0, 0, 0) );
+ uint seed = ((uint) dt.secsTo(Y2000));
+
+ pGrainBits = new uchar[numBytes]; // Grain blured without curves adjustment.
+ uchar *ptr;
+ int component;
+ grainData.setSixteenBit(sixteenBit);
+
+ for (int x = 0; !m_cancel && x < Width; x++)
+ {
+ for (int y = 0; !m_cancel && y < Height; y++)
+ {
+ ptr = pGrainBits + x*bytesDepth + (y*Width*bytesDepth);
+
+ nRand = (rand_r(&seed) % Noise) - (Noise / 2);
+ if (sixteenBit)
+ component = CLAMP(32768 + nRand, 0, 65535);
+ else
+ component = CLAMP(128 + nRand, 0, 255);
+
+ grainData.setRed (component);
+ grainData.setGreen(component);
+ grainData.setBlue (component);
+ grainData.setAlpha(0);
+
+ grainData.setPixel(ptr);
+ }
+
+ // Update progress bar in dialog.
+ progress = (int) (30.0 + ((double)x * 10.0) / Width);
+
+ if (progress%5 == 0)
+ postProgress( progress );
+ }
+
+ // Smooth grain mask using gaussian blur.
+
+ Digikam::DImgImageFilters().gaussianBlurImage(pGrainBits, Width, Height, sixteenBit, 1);
+
+ postProgress( 40 );
+ if (m_cancel)
+ {
+ delete [] pGrainBits;
+ return;
+ }
+ }
+
+ postProgress( 50 );
+ if (m_cancel)
+ {
+ delete [] pGrainBits;
+ return;
+ }
+
+ // Normally, film grain tends to be most noticeable in the midtones, and much less
+ // so in the shadows and highlights. Adjust histogram curve to adjust grain like this.
+
+ if (Grain)
+ {
+ Digikam::ImageCurves *grainCurves = new Digikam::ImageCurves(sixteenBit);
+ pMaskBits = new uchar[numBytes]; // Grain mask with curves adjustment.
+
+ // We modify only global luminosity of the grain.
+ if (sixteenBit)
+ {
+ grainCurves->setCurvePoint(Digikam::ImageHistogram::ValueChannel, 0, TQPoint(0, 0));
+ grainCurves->setCurvePoint(Digikam::ImageHistogram::ValueChannel, 8, TQPoint(32768, 32768));
+ grainCurves->setCurvePoint(Digikam::ImageHistogram::ValueChannel, 16, TQPoint(65535, 0));
+ }
+ else
+ {
+ grainCurves->setCurvePoint(Digikam::ImageHistogram::ValueChannel, 0, TQPoint(0, 0));
+ grainCurves->setCurvePoint(Digikam::ImageHistogram::ValueChannel, 8, TQPoint(128, 128));
+ grainCurves->setCurvePoint(Digikam::ImageHistogram::ValueChannel, 16, TQPoint(255, 0));
+ }
+
+ // Calculate curves and lut to apply on grain.
+ grainCurves->curvesCalculateCurve(Digikam::ImageHistogram::ValueChannel);
+ grainCurves->curvesLutSetup(Digikam::ImageHistogram::AlphaChannel);
+ grainCurves->curvesLutProcess(pGrainBits, pMaskBits, Width, Height);
+ delete grainCurves;
+
+ // delete it here, not used any more
+ delete [] pGrainBits;
+ pGrainBits = 0;
+ }
+
+ postProgress( 60 );
+ if (m_cancel)
+ {
+ delete [] pGrainBits;
+ delete [] pMaskBits;
+ return;
+ }
+
+ // Merge gray scale image with grain using shade coefficient.
+
+ if (Grain)
+ {
+ pOverlayBits = new uchar[numBytes]; // Overlay to merge with original converted in gray scale.
+
+ // get composer for default blending
+ Digikam::DColorComposer *composer = Digikam::DColorComposer::getComposer(Digikam::DColorComposer::PorterDuffNone);
+ int alpha;
+
+ int Shade = 52; // This value control the shading pixel effect between original image and grain mask.
+ if (sixteenBit)
+ Shade = (Shade + 1) * 256 - 1;
+
+ for (int x = 0; !m_cancel && x < Width; x++)
+ {
+ for (int y = 0; !m_cancel && y < Height; y++)
+ {
+ int offset = x*bytesDepth + (y*Width*bytesDepth);
+
+ // read color from orig image
+ bwBlurData.setColor(pBWBlurBits + offset, sixteenBit);
+ // read color from mask
+ maskData.setColor(pMaskBits + offset, sixteenBit);
+ // set shade as alpha value - it will be used as source alpha when blending
+ maskData.setAlpha(Shade);
+
+ // compose, write result to blendData.
+ // Preserve alpha, do not blend it (taken from old algorithm - correct?)
+ alpha = bwBlurData.alpha();
+ composer->compose(bwBlurData, maskData);
+ bwBlurData.setAlpha(alpha);
+
+ // write to destination
+ bwBlurData.setPixel(pOverlayBits + offset);
+ }
+
+ // Update progress bar in dialog.
+ progress = (int) (70.0 + ((double)x * 10.0) / Width);
+
+ if (progress%5 == 0)
+ postProgress( progress );
+ }
+
+ delete composer;
+
+ // delete it here, not used any more
+ BWBlurImage.reset();
+ delete [] pMaskBits;
+ pMaskBits = 0;
+ }
+ else
+ {
+ // save a memcpy
+ pOverlayBits = pBWBlurBits;
+ pBWBlurBits = 0;
+ }
+
+ //------------------------------------------
+ // 3 - Merge Grayscale image & overlay mask.
+ //------------------------------------------
+
+ // Merge overlay and gray scale image using 'Overlay' Gimp method for increase the highlight.
+ // The result is usually a brighter picture.
+ // Overlay mode composite value computation is D = A * (B + (2 * B) * (255 - A)).
+
+ outData.setSixteenBit(sixteenBit);
+ for (int x = 0; !m_cancel && x < Width; x++)
+ {
+ for (int y = 0; !m_cancel && y < Height; y++)
+ {
+ offset = x*bytesDepth + (y*Width*bytesDepth);
+
+ bwData.setColor (pBWBits + offset, sixteenBit);
+ overData.setColor(pOverlayBits + offset, sixteenBit);
+
+ if (sixteenBit)
+ {
+ outData.setRed ( intMult16 (bwData.red(), bwData.red() + intMult16(2 * overData.red(), 65535 - bwData.red()) ) );
+ outData.setGreen( intMult16 (bwData.green(), bwData.green() + intMult16(2 * overData.green(), 65535 - bwData.green()) ) );
+ outData.setBlue ( intMult16 (bwData.blue(), bwData.blue() + intMult16(2 * overData.blue(), 65535 - bwData.blue()) ) );
+ }
+ else
+ {
+ outData.setRed ( intMult8 (bwData.red(), bwData.red() + intMult8(2 * overData.red(), 255 - bwData.red()) ) );
+ outData.setGreen( intMult8 (bwData.green(), bwData.green() + intMult8(2 * overData.green(), 255 - bwData.green()) ) );
+ outData.setBlue ( intMult8 (bwData.blue(), bwData.blue() + intMult8(2 * overData.blue(), 255 - bwData.blue()) ) );
+ }
+ outData.setAlpha( bwData.alpha() );
+ outData.setPixel( pOutBits + offset );
+ }
+
+ // Update progress bar in dialog.
+ progress = (int) (80.0 + ((double)x * 20.0) / Width);
+
+ if (progress%5 == 0)
+ postProgress(progress);
+ }
+
+ delete [] pGrainBits;
+ delete [] pMaskBits;
+
+ if (Grain)
+ delete [] pOverlayBits;
+}
+
+} // NameSpace DigikamInfraredImagesPlugin
diff --git a/src/imageplugins/infrared/infrared.h b/src/imageplugins/infrared/infrared.h
new file mode 100644
index 00000000..fc2f89ee
--- /dev/null
+++ b/src/imageplugins/infrared/infrared.h
@@ -0,0 +1,60 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-05-25
+ * Description : Infrared threaded image filter.
+ *
+ * Copyright (C) 2005-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2006-2007 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * ============================================================ */
+
+#ifndef INFRARED_H
+#define INFRARED_H
+
+// Digikam includes.
+
+#include "dimgthreadedfilter.h"
+
+namespace DigikamInfraredImagesPlugin
+{
+
+class Infrared : public Digikam::DImgThreadedFilter
+{
+
+public:
+
+ Infrared(Digikam::DImg *orgImage, TQObject *parent=0, int sensibility=1, bool grain=true);
+
+ ~Infrared(){};
+
+private: // Infrared filter data.
+
+ bool m_grain;
+
+ int m_sensibility;
+
+private: // Infrared filter methods.
+
+ virtual void filterImage(void);
+
+ void infraredImage(Digikam::DImg *orgImage, int Sensibility, bool Grain);
+
+};
+
+} // NameSpace DigikamInfraredImagesPlugin
+
+#endif /* INFRARED_H */
diff --git a/src/imageplugins/infrared/infraredtool.cpp b/src/imageplugins/infrared/infraredtool.cpp
new file mode 100644
index 00000000..f34d1c8a
--- /dev/null
+++ b/src/imageplugins/infrared/infraredtool.cpp
@@ -0,0 +1,225 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-02-22
+ * Description : a digiKam image editor plugin for simulate
+ * infrared film.
+ *
+ * Copyright (C) 2005-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2006-2008 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * ============================================================ */
+
+// TQt includes.
+
+#include <tqimage.h>
+#include <tqlabel.h>
+#include <tqwhatsthis.h>
+#include <tqlcdnumber.h>
+#include <tqslider.h>
+#include <tqlayout.h>
+#include <tqdatetime.h>
+#include <tqcheckbox.h>
+
+// KDE includes.
+
+#include <tdelocale.h>
+#include <tdeaboutdata.h>
+#include <kiconloader.h>
+#include <tdeapplication.h>
+#include <kstandarddirs.h>
+#include <tdeconfig.h>
+
+// Local includes.
+
+#include "daboutdata.h"
+#include "ddebug.h"
+#include "dimg.h"
+#include "imageiface.h"
+#include "imagepanelwidget.h"
+#include "editortoolsettings.h"
+#include "infrared.h"
+#include "infraredtool.h"
+#include "infraredtool.moc"
+
+using namespace Digikam;
+
+namespace DigikamInfraredImagesPlugin
+{
+
+InfraredTool::InfraredTool(TQObject* parent)
+ : EditorToolThreaded(parent)
+{
+ setName("infrared");
+ setToolName(i18n("Infrared"));
+ setToolIcon(SmallIcon("infrared"));
+
+ // -------------------------------------------------------------
+
+ m_gboxSettings = new EditorToolSettings(EditorToolSettings::Default|
+ EditorToolSettings::Ok|
+ EditorToolSettings::Cancel|
+ EditorToolSettings::Try,
+ EditorToolSettings::PanIcon);
+
+ TQGridLayout* grid = new TQGridLayout(m_gboxSettings->plainPage(), 3, 1);
+ TQLabel *label1 = new TQLabel(i18n("Sensitivity (ISO):"), m_gboxSettings->plainPage());
+
+ m_sensibilitySlider = new TQSlider(1, 25, 1, 1, TQt::Horizontal, m_gboxSettings->plainPage());
+ m_sensibilitySlider->setTracking(false);
+ m_sensibilitySlider->setTickInterval(1);
+ m_sensibilitySlider->setTickmarks(TQSlider::Below);
+
+ m_sensibilityLCDValue = new TQLCDNumber(4, m_gboxSettings->plainPage());
+ m_sensibilityLCDValue->setSegmentStyle(TQLCDNumber::Flat);
+ m_sensibilityLCDValue->display(TQString::number(200));
+ TQString whatsThis = i18n("<p>Set here the ISO-sensitivity of the simulated infrared film. "
+ "Increasing this value will increase the proportion of green color in the mix. "
+ "It will also increase the halo effect on the hightlights, and the film "
+ "graininess (if that box is checked).</p>"
+ "<p>Note: to simulate an <b>Ilford SFX200</b> infrared film, use a sensitivity excursion of 200 to 800. "
+ "A sensitivity over 800 simulates <b>Kodak HIE</b> high-speed infrared film. This last one creates a more "
+ "dramatic photographic style.</p>");
+
+ TQWhatsThis::add(m_sensibilityLCDValue, whatsThis);
+ TQWhatsThis::add(m_sensibilitySlider, whatsThis);
+
+ // -------------------------------------------------------------
+
+ m_addFilmGrain = new TQCheckBox(i18n("Add film grain"), m_gboxSettings->plainPage());
+ m_addFilmGrain->setChecked(true);
+ TQWhatsThis::add( m_addFilmGrain, i18n("<p>This option adds infrared film grain to "
+ "the image depending on ISO-sensitivity."));
+
+ grid->addMultiCellWidget(label1, 0, 0, 0, 1);
+ grid->addMultiCellWidget(m_sensibilitySlider, 1, 1, 0, 0);
+ grid->addMultiCellWidget(m_sensibilityLCDValue, 1, 1, 1, 1);
+ grid->addMultiCellWidget(m_addFilmGrain, 2, 2, 0, 1);
+ grid->setRowStretch(3, 10);
+ grid->setMargin(m_gboxSettings->spacingHint());
+ grid->setSpacing(m_gboxSettings->spacingHint());
+
+ setToolSettings(m_gboxSettings);
+
+ // -------------------------------------------------------------
+
+ m_previewWidget = new ImagePanelWidget(470, 350, "infrared Tool", m_gboxSettings->panIconView());
+
+ setToolView(m_previewWidget);
+ init();
+
+ // -------------------------------------------------------------
+
+ connect( m_sensibilitySlider, TQ_SIGNAL(valueChanged(int)),
+ this, TQ_SLOT(slotTimer()) );
+
+ // this connection is necessary to change the LCD display when
+ // the value is changed by single clicking on the slider
+ connect( m_sensibilitySlider, TQ_SIGNAL(valueChanged(int)),
+ this, TQ_SLOT(slotSliderMoved(int)) );
+
+ connect( m_sensibilitySlider, TQ_SIGNAL(sliderMoved(int)),
+ this, TQ_SLOT(slotSliderMoved(int)) );
+
+ connect( m_addFilmGrain, TQ_SIGNAL(toggled (bool)),
+ this, TQ_SLOT(slotEffect()) );
+}
+
+InfraredTool::~InfraredTool()
+{
+}
+
+void InfraredTool::renderingFinished()
+{
+ m_sensibilitySlider->setEnabled(true);
+ m_addFilmGrain->setEnabled(true);
+}
+
+void InfraredTool::readSettings()
+{
+ TDEConfig* config = kapp->config();
+ config->setGroup("infrared Tool");
+ m_sensibilitySlider->blockSignals(true);
+ m_addFilmGrain->blockSignals(true);
+ m_sensibilitySlider->setValue(config->readNumEntry("SensitivityAjustment", 1));
+ m_addFilmGrain->setChecked(config->readBoolEntry("AddFilmGrain", false));
+ m_sensibilitySlider->blockSignals(false);
+ m_addFilmGrain->blockSignals(false);
+ slotSliderMoved(m_sensibilitySlider->value());
+}
+
+void InfraredTool::writeSettings()
+{
+ TDEConfig* config = kapp->config();
+ config->setGroup("infrared Tool");
+ config->writeEntry("SensitivityAjustment", m_sensibilitySlider->value());
+ config->writeEntry("AddFilmGrain", m_addFilmGrain->isChecked());
+ m_previewWidget->writeSettings();
+ config->sync();
+}
+
+void InfraredTool::slotResetSettings()
+{
+ m_sensibilitySlider->blockSignals(true);
+ m_addFilmGrain->blockSignals(true);
+ m_sensibilitySlider->setValue(1);
+ m_addFilmGrain->setChecked(false);
+ m_sensibilitySlider->blockSignals(false);
+ m_addFilmGrain->blockSignals(false);
+}
+
+void InfraredTool::slotSliderMoved(int v)
+{
+ m_sensibilityLCDValue->display( TQString::number(100 + 100 * v) );
+}
+
+void InfraredTool::prepareEffect()
+{
+ m_addFilmGrain->setEnabled(false);
+ m_sensibilitySlider->setEnabled(false);
+
+ DImg image = m_previewWidget->getOriginalRegionImage();
+ int s = 100 + 100 * m_sensibilitySlider->value();
+ bool g = m_addFilmGrain->isChecked();
+
+ setFilter(dynamic_cast<DImgThreadedFilter*>(new Infrared(&image, this, s, g)));
+}
+
+void InfraredTool::prepareFinal()
+{
+ m_addFilmGrain->setEnabled(false);
+ m_sensibilitySlider->setEnabled(false);
+
+ int s = 100 + 100 * m_sensibilitySlider->value();
+ bool g = m_addFilmGrain->isChecked();
+
+ ImageIface iface(0, 0);
+
+ setFilter(dynamic_cast<DImgThreadedFilter*>(new Infrared(iface.getOriginalImg(), this, s, g)));
+}
+
+void InfraredTool::putPreviewData()
+{
+ m_previewWidget->setPreviewImage(filter()->getTargetImage());
+}
+
+void InfraredTool::putFinalData()
+{
+ ImageIface iface(0, 0);
+ iface.putOriginalImage(i18n("Infrared"), filter()->getTargetImage().bits());
+}
+
+} // NameSpace DigikamInfraredImagesPlugin
diff --git a/src/imageplugins/infrared/infraredtool.h b/src/imageplugins/infrared/infraredtool.h
new file mode 100644
index 00000000..ddb5144b
--- /dev/null
+++ b/src/imageplugins/infrared/infraredtool.h
@@ -0,0 +1,86 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-02-22
+ * Description : a digiKam image editor plugin for simulate
+ * infrared film.
+ *
+ * Copyright (C) 2005-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2006-2008 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * ============================================================ */
+
+#ifndef INFRAREDTOOL_H
+#define INFRAREDTOOL_H
+
+// Digikam includes.
+
+#include "editortool.h"
+
+class TQSlider;
+class TQLCDNumber;
+class TQCheckBox;
+
+namespace Digikam
+{
+class EditorToolSettings;
+class ImagePanelWidget;
+}
+
+namespace DigikamInfraredImagesPlugin
+{
+
+class InfraredTool : public Digikam::EditorToolThreaded
+{
+ TQ_OBJECT
+
+
+public:
+
+ InfraredTool(TQObject* parent);
+ ~InfraredTool();
+
+private slots:
+
+ void slotSliderMoved(int);
+ void slotResetSettings();
+
+private:
+
+ void readSettings();
+ void writeSettings();
+ void prepareEffect();
+ void prepareFinal();
+ void putPreviewData();
+ void putFinalData();
+ void renderingFinished();
+
+private:
+
+ TQCheckBox *m_addFilmGrain;
+
+ TQSlider *m_sensibilitySlider;
+
+ TQLCDNumber *m_sensibilityLCDValue;
+
+ Digikam::ImagePanelWidget *m_previewWidget;
+
+ Digikam::EditorToolSettings *m_gboxSettings;
+};
+
+} // NameSpace DigikamInfraredImagesPlugin
+
+#endif /* INFRAREDTOOL_H */