summaryrefslogtreecommitdiffstats
path: root/src/imageplugins/emboss
diff options
context:
space:
mode:
Diffstat (limited to 'src/imageplugins/emboss')
-rw-r--r--src/imageplugins/emboss/Makefile.am34
-rw-r--r--src/imageplugins/emboss/digikamimageplugin_emboss.desktop51
-rw-r--r--src/imageplugins/emboss/digikamimageplugin_emboss_ui.rc20
-rw-r--r--src/imageplugins/emboss/emboss.cpp127
-rw-r--r--src/imageplugins/emboss/emboss.h75
-rw-r--r--src/imageplugins/emboss/embosstool.cpp167
-rw-r--r--src/imageplugins/emboss/embosstool.h82
-rw-r--r--src/imageplugins/emboss/imageeffect_emboss.cpp170
-rw-r--r--src/imageplugins/emboss/imageeffect_emboss.h69
-rw-r--r--src/imageplugins/emboss/imageplugin_emboss.cpp72
-rw-r--r--src/imageplugins/emboss/imageplugin_emboss.h57
11 files changed, 924 insertions, 0 deletions
diff --git a/src/imageplugins/emboss/Makefile.am b/src/imageplugins/emboss/Makefile.am
new file mode 100644
index 00000000..c595aa30
--- /dev/null
+++ b/src/imageplugins/emboss/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_emboss_la_SOURCES = imageplugin_emboss.cpp \
+ embosstool.cpp emboss.cpp
+
+digikamimageplugin_emboss_la_LIBADD = $(LIB_TDEPARTS) \
+ $(top_builddir)/src/digikam/libdigikam.la
+
+digikamimageplugin_emboss_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) -ltdecore -ltdeui $(LIB_TQT) -ltdefx -lkdcraw -ltdeio
+
+kde_services_DATA = digikamimageplugin_emboss.desktop
+
+kde_module_LTLIBRARIES = digikamimageplugin_emboss.la
+
+rcdir = $(kde_datadir)/digikam
+rc_DATA = digikamimageplugin_emboss_ui.rc
+
diff --git a/src/imageplugins/emboss/digikamimageplugin_emboss.desktop b/src/imageplugins/emboss/digikamimageplugin_emboss.desktop
new file mode 100644
index 00000000..414f235b
--- /dev/null
+++ b/src/imageplugins/emboss/digikamimageplugin_emboss.desktop
@@ -0,0 +1,51 @@
+[Desktop Entry]
+Name=ImagePlugin_Emboss
+Name[bg]=Приставка за снимки - Релеф
+Name[da]=Billedplugin_Præg i relief
+Name[el]=ΠρόσθετοΕικόνας_Εμβάθυνση
+Name[fi]=Kohokuvio
+Name[hr]=Reljef
+Name[it]=PluginImmagini_Rilievo
+Name[nl]=Afbeeldingsplugin_Reliëf
+Name[sr]=Рељеф
+Name[sr@Latn]=Reljef
+Name[sv]=Insticksprogram för reliefeffekt
+Name[tr]=ResimEklentisi_Kabart
+Name[xx]=xxImagePlugin_Embossxx
+Type=Service
+X-TDE-ServiceTypes=Digikam/ImagePlugin
+Encoding=UTF-8
+Comment=Emboss image effect plugin for digiKam
+Comment[bg]=Приставка на digiKam за добавяне на релеф към снимки
+Comment[ca]=Connector pel digiKam d'efecte d'imatge de relleu
+Comment[cs]=Efektový modul pro tvorbu reliéfu pro digiKam
+Comment[da]=Reliefprægnings-plugin for Digikam
+Comment[de]=digiKam-Modul zum Erzeugen eines Gravureffektes
+Comment[el]=Πρόσθετο εφέ εμβάθυνσης για το digiKam
+Comment[es]=Plugin para digiKam con efectos de bajo relieve
+Comment[et]=DigiKami kohrutuse pildiefektiplugin
+Comment[fa]=برجسته کردن وصلۀ جلوۀ تصویر برای digiKam
+Comment[fi]=Kohokuvioefekti kohteiden ääriviivoista
+Comment[gl]=Un plugin de digiKam para dar-lle relevo á imaxe
+Comment[hr]=digiKam dodatak za efekt reljefa
+Comment[is]=Íforrit fyrir digiKam sem framkallar upphleypingaráhrif
+Comment[it]=Plugin di effetto di rilievo delle immagini per digiKam
+Comment[ja]=digiKam エンボス効果プラグイン
+Comment[nds]=digiKam-Moduul för Ingraav-Effekten
+Comment[nl]=Digikam-plugin voor reliëf-afbeeldingen
+Comment[pa]=ਡਿਜ਼ੀਕੈਮ ਲਈ ਈਮਬੋਸ ਚਿੱਤਰ ਪਰਭਾਵ ਪਲੱਗਇਨ
+Comment[pl]=Wtyczka do programu digiKam oferująca efekty zniekształceń
+Comment[pt]=Um 'plugin' do digiKam para gravar em relevo a imagem
+Comment[pt_BR]=Plugin de efeito de estampa
+Comment[ru]=Модуль рельефного рисунка для digiKam
+Comment[sk]=digiKam plugin pre efekt reliéfu
+Comment[sr]=digiKam-ов прикључак за ефекат рељефа на сликама
+Comment[sr@Latn]=digiKam-ov priključak za efekat reljefa na slikama
+Comment[sv]=Digikam insticksprogram för reliefbildeffekt
+Comment[tr]=digiKam için resim kabartma etkisi eklentisi
+Comment[uk]=Втулок створення ефекту барельєфу для digiKam
+Comment[vi]=Phần bổ sung hiệu ứng chạm nổi ảnh cho digiKam
+Comment[xx]=xxEmboss image effect plugin for digiKamxx
+
+X-TDE-Library=digikamimageplugin_emboss
+author=Gilles Caulier, caulier dot gilles at gmail dot com
diff --git a/src/imageplugins/emboss/digikamimageplugin_emboss_ui.rc b/src/imageplugins/emboss/digikamimageplugin_emboss_ui.rc
new file mode 100644
index 00000000..1a6943c6
--- /dev/null
+++ b/src/imageplugins/emboss/digikamimageplugin_emboss_ui.rc
@@ -0,0 +1,20 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui version="5" name="digikamimageplugin_emboss" >
+
+ <MenuBar>
+
+ <Menu name="Filters" ><text>F&amp;ilters</text>
+ <Action name="imageplugin_emboss" />
+ </Menu>
+
+ </MenuBar>
+
+ <ToolBar name="ToolBar" >
+ <text>Main Toolbar</text>
+ </ToolBar>
+
+ <ActionProperties>
+ <Action shortcut="" name="imageplugin_emboss" />
+ </ActionProperties>
+
+</kpartgui>
diff --git a/src/imageplugins/emboss/emboss.cpp b/src/imageplugins/emboss/emboss.cpp
new file mode 100644
index 00000000..d4225148
--- /dev/null
+++ b/src/imageplugins/emboss/emboss.cpp
@@ -0,0 +1,127 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-05-25
+ * Description : Emboss 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>
+ *
+ * Original Emboss algorithm copyrighted 2004 by
+ * Pieter Z. Voloshyn <pieter dot voloshyn 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.
+ *
+ * ============================================================ */
+
+// C++ includes.
+
+#include <cmath>
+#include <cstdlib>
+
+// Local includes.
+
+#include "dimg.h"
+#include "dimgimagefilters.h"
+#include "emboss.h"
+
+namespace DigikamEmbossImagesPlugin
+{
+
+Emboss::Emboss(Digikam::DImg *orgImage, TQObject *parent, int depth)
+ : Digikam::DImgThreadedFilter(orgImage, parent, "Emboss")
+{
+ m_depth = depth;
+ initFilter();
+}
+
+void Emboss::filterImage(void)
+{
+ embossImage(&m_orgImage, &m_destImage, m_depth);
+}
+
+// This method have been ported from Pieter Z. Voloshyn algorithm code.
+
+/* Function to apply the Emboss effect
+ *
+ * data => The image data in RGBA mode.
+ * Width => Width of image.
+ * Height => Height of image.
+ * d => Emboss value
+ *
+ * Theory => This is an amazing effect. And the theory is very simple to
+ * understand. You get the diference between the colors and
+ * increase it. After this, get the gray tone
+ */
+
+void Emboss::embossImage(Digikam::DImg *orgImage, Digikam::DImg *destImage, int d)
+{
+ int Width = orgImage->width();
+ int Height = orgImage->height();
+ uchar* data = orgImage->bits();
+ bool sixteenBit = orgImage->sixteenBit();
+ int bytesDepth = orgImage->bytesDepth();
+ uchar* Bits = destImage->bits();
+
+ // Initial copy
+ memcpy (Bits, data, destImage->numBytes());
+
+ double Depth = d / 10.0;
+
+ int progress;
+ int red, green, blue, gray;
+ Digikam::DColor color, colorOther;
+ int offset, offsetOther;
+
+ for (int h = 0 ; !m_cancel && (h < Height) ; h++)
+ {
+ for (int w = 0 ; !m_cancel && (w < Width) ; w++)
+ {
+ offset = getOffset(Width, w, h, bytesDepth);
+ offsetOther = getOffset(Width, w + Lim_Max (w, 1, Width), h + Lim_Max (h, 1, Height), bytesDepth);
+
+ color.setColor(Bits + offset, sixteenBit);
+ colorOther.setColor(Bits + offsetOther, sixteenBit);
+
+ if (sixteenBit)
+ {
+ red = abs ((int)((color.red() - colorOther.red()) * Depth + 32768));
+ green = abs ((int)((color.green() - colorOther.green()) * Depth + 32768));
+ blue = abs ((int)((color.blue() - colorOther.blue()) * Depth + 32768));
+
+ gray = CLAMP065535 ((red + green + blue) / 3);
+ }
+ else
+ {
+ red = abs ((int)((color.red() - colorOther.red()) * Depth + 128));
+ green = abs ((int)((color.green() - colorOther.green()) * Depth + 128));
+ blue = abs ((int)((color.blue() - colorOther.blue()) * Depth + 128));
+
+ gray = CLAMP0255 ((red + green + blue) / 3);
+ }
+
+ // Overwrite RGB values to destination. Alpha remains unchanged.
+ color.setRed(gray);
+ color.setGreen(gray);
+ color.setBlue(gray);
+ color.setPixel(Bits + offset);
+ }
+
+ progress = (int) (((double)h * 100.0) / Height);
+ if ( progress%5 == 0 )
+ postProgress( progress );
+ }
+}
+
+} // NameSpace DigikamEmbossImagesPlugin
diff --git a/src/imageplugins/emboss/emboss.h b/src/imageplugins/emboss/emboss.h
new file mode 100644
index 00000000..470755a6
--- /dev/null
+++ b/src/imageplugins/emboss/emboss.h
@@ -0,0 +1,75 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-05-25
+ * Description : Emboss 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>
+ *
+ * Original Emboss algorithm copyrighted 2004 by
+ * Pieter Z. Voloshyn <pieter dot voloshyn 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 EMBOSS_H
+#define EMBOSS_H
+
+// Digikam includes.
+
+#include "dimgthreadedfilter.h"
+
+namespace DigikamEmbossImagesPlugin
+{
+
+class Emboss : public Digikam::DImgThreadedFilter
+{
+
+public:
+
+ Emboss(Digikam::DImg *orgImage, TQObject *parent=0, int depth=30);
+ ~Emboss(){};
+
+private:
+
+ virtual void filterImage(void);
+
+
+ void embossImage(Digikam::DImg *orgImage, Digikam::DImg *destImage, int d);
+
+ // Function to limit the max and min values defined by the developer.
+
+ inline int Lim_Max (int Now, int Up, int Max)
+ {
+ --Max;
+ while (Now > Max - Up)
+ --Up;
+ return (Up);
+ };
+
+ inline int getOffset(int Width, int X, int Y, int bytesDepth)
+ {
+ return (Y * Width * bytesDepth) + (X * bytesDepth);
+ };
+
+private:
+
+ int m_depth;
+};
+
+} // NameSpace DigikamEmbossImagesPlugin
+
+#endif /* EMBOSS_H */
diff --git a/src/imageplugins/emboss/embosstool.cpp b/src/imageplugins/emboss/embosstool.cpp
new file mode 100644
index 00000000..f16ef4de
--- /dev/null
+++ b/src/imageplugins/emboss/embosstool.cpp
@@ -0,0 +1,167 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2004-08-26
+ * Description : a digiKam image editor plugin to emboss
+ * an image.
+ *
+ * Copyright (C) 2004-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 <tqlabel.h>
+#include <tqlayout.h>
+#include <tqwhatsthis.h>
+
+// KDE includes.
+
+#include <tdeaboutdata.h>
+#include <tdeapplication.h>
+#include <tdeconfig.h>
+#include <kiconloader.h>
+#include <tdelocale.h>
+#include <kstandarddirs.h>
+
+// LibKDcraw includes.
+
+#include <libkdcraw/rnuminput.h>
+
+// Local includes.
+
+#include "daboutdata.h"
+#include "imageiface.h"
+#include "imagepanelwidget.h"
+#include "editortoolsettings.h"
+#include "emboss.h"
+#include "embosstool.h"
+#include "embosstool.moc"
+
+using namespace KDcrawIface;
+using namespace Digikam;
+
+namespace DigikamEmbossImagesPlugin
+{
+
+EmbossTool::EmbossTool(TQObject* parent)
+ : EditorToolThreaded(parent)
+{
+ setName("emboss");
+ setToolName(i18n("Emboss"));
+ setToolIcon(SmallIcon("embosstool"));
+
+ // -------------------------------------------------------------
+
+ m_gboxSettings = new EditorToolSettings(EditorToolSettings::Default|
+ EditorToolSettings::Ok|
+ EditorToolSettings::Cancel|
+ EditorToolSettings::PanIcon);
+ TQGridLayout* grid = new TQGridLayout( m_gboxSettings->plainPage(), 2, 1);
+ TQLabel *label1 = new TQLabel(i18n("Depth:"), m_gboxSettings->plainPage());
+
+ m_depthInput = new RIntNumInput(m_gboxSettings->plainPage());
+ m_depthInput->setRange(10, 300, 1);
+ m_depthInput->setDefaultValue(30);
+ TQWhatsThis::add( m_depthInput, i18n("<p>Set here the depth of the embossing image effect.") );
+
+ grid->addMultiCellWidget(label1, 0, 0, 0, 1);
+ grid->addMultiCellWidget(m_depthInput, 1, 1, 0, 1);
+ grid->setRowStretch(2, 10);
+ grid->setMargin(m_gboxSettings->spacingHint());
+ grid->setSpacing(m_gboxSettings->spacingHint());
+
+ setToolSettings(m_gboxSettings);
+
+ // -------------------------------------------------------------
+
+ m_previewWidget = new ImagePanelWidget(470, 350, "emboss Tool", m_gboxSettings->panIconView());
+
+ setToolView(m_previewWidget);
+ init();
+
+ // -------------------------------------------------------------
+
+ connect(m_depthInput, TQ_SIGNAL(valueChanged (int)),
+ this, TQ_SLOT(slotTimer()));
+}
+
+EmbossTool::~EmbossTool()
+{
+}
+
+void EmbossTool::renderingFinished()
+{
+ m_depthInput->setEnabled(true);
+}
+
+void EmbossTool::readSettings()
+{
+ TDEConfig* config = kapp->config();
+ config->setGroup("emboss Tool");
+ m_depthInput->blockSignals(true);
+ m_depthInput->setValue(config->readNumEntry("DepthAjustment", m_depthInput->defaultValue()));
+ m_depthInput->blockSignals(false);
+}
+
+void EmbossTool::writeSettings()
+{
+ TDEConfig* config = kapp->config();
+ config->setGroup("emboss Tool");
+ config->writeEntry("DepthAjustment", m_depthInput->value());
+ m_previewWidget->writeSettings();
+ config->sync();
+}
+
+void EmbossTool::slotResetSettings()
+{
+ m_depthInput->blockSignals(true);
+ m_depthInput->slotReset();
+ m_depthInput->blockSignals(false);
+}
+
+void EmbossTool::prepareEffect()
+{
+ m_depthInput->setEnabled(false);
+
+ DImg image = m_previewWidget->getOriginalRegionImage();
+ int depth = m_depthInput->value();
+
+ setFilter(dynamic_cast<DImgThreadedFilter*>(new Emboss(&image, this, depth)));
+}
+
+void EmbossTool::prepareFinal()
+{
+ m_depthInput->setEnabled(false);
+
+ int depth = m_depthInput->value();
+ ImageIface iface(0, 0);
+ setFilter(dynamic_cast<DImgThreadedFilter*>(new Emboss(iface.getOriginalImg(), this, depth)));
+}
+
+void EmbossTool::putPreviewData()
+{
+ m_previewWidget->setPreviewImage(filter()->getTargetImage());
+}
+
+void EmbossTool::putFinalData()
+{
+ ImageIface iface(0, 0);
+ iface.putOriginalImage(i18n("Emboss"), filter()->getTargetImage().bits());
+}
+
+} // NameSpace DigikamEmbossImagesPlugin
diff --git a/src/imageplugins/emboss/embosstool.h b/src/imageplugins/emboss/embosstool.h
new file mode 100644
index 00000000..224858f7
--- /dev/null
+++ b/src/imageplugins/emboss/embosstool.h
@@ -0,0 +1,82 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2004-08-26
+ * Description : a digiKam image editor plugin to emboss
+ * an image.
+ *
+ * Copyright (C) 2004-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 EMBOSSTOOL_H
+#define EMBOSSTOOL_H
+
+// Digikam includes.
+
+#include "editortool.h"
+
+namespace KDcrawIface
+{
+class RIntNumInput;
+}
+
+namespace Digikam
+{
+class EditorToolSettings;
+class ImagePanelWidget;
+}
+
+namespace DigikamEmbossImagesPlugin
+{
+
+class EmbossTool : public Digikam::EditorToolThreaded
+{
+ TQ_OBJECT
+
+
+public:
+
+ EmbossTool(TQObject* parent);
+ ~EmbossTool();
+
+private slots:
+
+ void slotResetSettings();
+
+private:
+
+ void readSettings();
+ void writeSettings();
+ void prepareEffect();
+ void prepareFinal();
+ void putPreviewData();
+ void putFinalData();
+ void renderingFinished();
+
+private:
+
+ KDcrawIface::RIntNumInput *m_depthInput;
+
+ Digikam::ImagePanelWidget *m_previewWidget;
+
+ Digikam::EditorToolSettings *m_gboxSettings;
+};
+
+} // NameSpace DigikamEmbossImagesPlugin
+
+#endif /* EMBOSSTOOL_H */
diff --git a/src/imageplugins/emboss/imageeffect_emboss.cpp b/src/imageplugins/emboss/imageeffect_emboss.cpp
new file mode 100644
index 00000000..b4557c80
--- /dev/null
+++ b/src/imageplugins/emboss/imageeffect_emboss.cpp
@@ -0,0 +1,170 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2004-08-26
+ * Description : a digiKam image editor plugin to emboss
+ * an image.
+ *
+ * Copyright (C) 2004-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 <tqlabel.h>
+#include <tqwhatsthis.h>
+#include <tqlayout.h>
+
+// KDE includes.
+
+#include <tdelocale.h>
+#include <tdeaboutdata.h>
+#include <kiconloader.h>
+#include <tdeapplication.h>
+#include <kstandarddirs.h>
+#include <knuminput.h>
+#include <tdeconfig.h>
+
+// Local includes.
+
+#include "version.h"
+#include "imageiface.h"
+#include "imagewidget.h"
+#include "emboss.h"
+#include "imageeffect_emboss.h"
+#include "imageeffect_emboss.moc"
+
+namespace DigikamEmbossImagesPlugin
+{
+
+ImageEffect_Emboss::ImageEffect_Emboss(TQWidget* parent)
+ : Digikam::CtrlPanelDlg(parent, i18n("Emboss Image"), "emboss", false, false, true,
+ Digikam::ImagePannelWidget::SeparateViewAll)
+{
+ TQString whatsThis;
+
+ TDEAboutData* about = new TDEAboutData("digikam",
+ I18N_NOOP("Emboss Image"),
+ digikam_version,
+ I18N_NOOP("Emboss image effect plugin for digiKam."),
+ TDEAboutData::License_GPL,
+ "(c) 2004-2006, 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("Pieter Z. Voloshyn", I18N_NOOP("Emboss algorithm"),
+ "pieter dot voloshyn 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, 1, 1, 0, spacingHint());
+ TQLabel *label1 = new TQLabel(i18n("Depth:"), gboxSettings);
+
+ m_depthInput = new KIntNumInput(gboxSettings);
+ m_depthInput->setRange(10, 300, 1, true);
+ TQWhatsThis::add( m_depthInput, i18n("<p>Set here the depth of the embossing image effect.") );
+
+ gridSettings->addMultiCellWidget(label1, 0, 0, 0, 1);
+ gridSettings->addMultiCellWidget(m_depthInput, 1, 1, 0, 1);
+
+ m_imagePreviewWidget->setUserAreaWidget(gboxSettings);
+
+ // -------------------------------------------------------------
+
+ connect(m_depthInput, TQ_SIGNAL(valueChanged (int)),
+ this, TQ_SLOT(slotTimer()));
+}
+
+ImageEffect_Emboss::~ImageEffect_Emboss()
+{
+}
+
+void ImageEffect_Emboss::renderingFinished()
+{
+ m_depthInput->setEnabled(true);
+}
+
+void ImageEffect_Emboss::readUserSettings()
+{
+ TDEConfig* config = kapp->config();
+ config->setGroup("emboss Tool Dialog");
+ m_depthInput->blockSignals(true);
+ m_depthInput->setValue(config->readNumEntry("DepthAjustment", 30));
+ m_depthInput->blockSignals(false);
+}
+
+void ImageEffect_Emboss::writeUserSettings()
+{
+ TDEConfig* config = kapp->config();
+ config->setGroup("emboss Tool Dialog");
+ config->writeEntry("DepthAjustment", m_depthInput->value());
+ config->sync();
+}
+
+void ImageEffect_Emboss::resetValues()
+{
+ m_depthInput->blockSignals(true);
+ m_depthInput->setValue(30);
+ m_depthInput->blockSignals(false);
+}
+
+void ImageEffect_Emboss::prepareEffect()
+{
+ m_depthInput->setEnabled(false);
+
+ Digikam::DImg image = m_imagePreviewWidget->getOriginalRegionImage();
+
+ int depth = m_depthInput->value();
+
+ m_threadedFilter = dynamic_cast<Digikam::DImgThreadedFilter *>(new Emboss(&image, this, depth));
+}
+
+void ImageEffect_Emboss::prepareFinal()
+{
+ m_depthInput->setEnabled(false);
+
+ int depth = m_depthInput->value();
+
+ Digikam::ImageIface iface(0, 0);
+ m_threadedFilter = dynamic_cast<Digikam::DImgThreadedFilter *>(new Emboss(iface.getOriginalImg(), this, depth));
+}
+
+void ImageEffect_Emboss::putPreviewData(void)
+{
+ m_imagePreviewWidget->setPreviewImage(m_threadedFilter->getTargetImage());
+}
+
+void ImageEffect_Emboss::putFinalData(void)
+{
+ Digikam::ImageIface iface(0, 0);
+
+ iface.putOriginalImage(i18n("Emboss"),
+ m_threadedFilter->getTargetImage().bits());
+}
+
+} // NameSpace DigikamEmbossImagesPlugin
+
diff --git a/src/imageplugins/emboss/imageeffect_emboss.h b/src/imageplugins/emboss/imageeffect_emboss.h
new file mode 100644
index 00000000..19cf4f77
--- /dev/null
+++ b/src/imageplugins/emboss/imageeffect_emboss.h
@@ -0,0 +1,69 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2004-08-26
+ * Description : a digiKam image editor plugin to emboss
+ * an image.
+ *
+ * Copyright (C) 2004-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_EMBOSS_H
+#define IMAGEEFFECT_EMBOSS_H
+
+// Digikam includes.
+
+#include "ctrlpaneldlg.h"
+
+class KIntNumInput;
+
+namespace DigikamEmbossImagesPlugin
+{
+
+class ImageEffect_Emboss : public Digikam::CtrlPanelDlg
+{
+ TQ_OBJECT
+
+
+public:
+
+ ImageEffect_Emboss(TQWidget* parent);
+ ~ImageEffect_Emboss();
+
+private slots:
+
+ void readUserSettings();
+
+private:
+
+ void writeUserSettings();
+ void resetValues();
+ void prepareEffect();
+ void prepareFinal();
+ void putPreviewData();
+ void putFinalData();
+ void renderingFinished();
+
+private:
+
+ KIntNumInput *m_depthInput;
+};
+
+} // NameSpace DigikamEmbossImagesPlugin
+
+#endif /* IMAGEEFFECT_EMBOSS_H */
diff --git a/src/imageplugins/emboss/imageplugin_emboss.cpp b/src/imageplugins/emboss/imageplugin_emboss.cpp
new file mode 100644
index 00000000..6bd616d6
--- /dev/null
+++ b/src/imageplugins/emboss/imageplugin_emboss.cpp
@@ -0,0 +1,72 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2004-08-26
+ * Description : a digiKam image editor plugin to emboss
+ * an image.
+ *
+ * Copyright (C) 2004-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 "embosstool.h"
+#include "imageplugin_emboss.h"
+#include "imageplugin_emboss.moc"
+
+using namespace DigikamEmbossImagesPlugin;
+
+K_EXPORT_COMPONENT_FACTORY(digikamimageplugin_emboss,
+ KGenericFactory<ImagePlugin_Emboss>("digikamimageplugin_emboss"));
+
+ImagePlugin_Emboss::ImagePlugin_Emboss(TQObject *parent, const char*,
+ const TQStringList &)
+ : Digikam::ImagePlugin(parent, "ImagePlugin_Emboss")
+{
+ m_embossAction = new TDEAction(i18n("Emboss..."), "embosstool", 0,
+ this, TQ_SLOT(slotEmboss()),
+ actionCollection(), "imageplugin_emboss");
+
+ setXMLFile( "digikamimageplugin_emboss_ui.rc" );
+
+ DDebug() << "ImagePlugin_Emboss plugin loaded" << endl;
+}
+
+ImagePlugin_Emboss::~ImagePlugin_Emboss()
+{
+}
+
+void ImagePlugin_Emboss::setEnabledActions(bool enable)
+{
+ m_embossAction->setEnabled(enable);
+}
+
+void ImagePlugin_Emboss::slotEmboss()
+{
+ EmbossTool *tool = new EmbossTool(this);
+ loadTool(tool);
+}
diff --git a/src/imageplugins/emboss/imageplugin_emboss.h b/src/imageplugins/emboss/imageplugin_emboss.h
new file mode 100644
index 00000000..1ccac064
--- /dev/null
+++ b/src/imageplugins/emboss/imageplugin_emboss.h
@@ -0,0 +1,57 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2004-08-26
+ * Description : a digiKam image editor plugin to emboss
+ * an image.
+ *
+ * Copyright (C) 2004-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_EMBOSS_H
+#define IMAGEPLUGIN_EMBOSS_H
+
+// Digikam includes.
+
+#include "imageplugin.h"
+#include "digikam_export.h"
+
+class TDEAction;
+
+class DIGIKAMIMAGEPLUGINS_EXPORT ImagePlugin_Emboss : public Digikam::ImagePlugin
+{
+ TQ_OBJECT
+
+
+public:
+
+ ImagePlugin_Emboss(TQObject *parent, const char* name,
+ const TQStringList &args);
+ ~ImagePlugin_Emboss();
+
+ void setEnabledActions(bool enable);
+
+private slots:
+
+ void slotEmboss();
+
+private:
+
+ TDEAction *m_embossAction;
+};
+
+#endif /* IMAGEPLUGIN_EMBOSS_H */