summaryrefslogtreecommitdiffstats
path: root/src/imageplugins/texture
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2024-11-22 18:41:30 +0900
committerMichele Calgaro <[email protected]>2024-11-22 20:55:03 +0900
commit5bed6e4a4c916a97f8fe4d1b07f7eecf4d733b90 (patch)
treef89cc49efc9ca1d0e1579ecb079ee7e7088ff8c8 /src/imageplugins/texture
parent0bfbf616d9c1fd7abb1bd02732389ab35e5f8771 (diff)
downloaddigikam-5bed6e4a4c916a97f8fe4d1b07f7eecf4d733b90.tar.gz
digikam-5bed6e4a4c916a97f8fe4d1b07f7eecf4d733b90.zip
Rename 'digikam' folder to 'src'
Signed-off-by: Michele Calgaro <[email protected]> (cherry picked from commit ee0d99607c14cb63d3ebdb3a970b508949fa8219)
Diffstat (limited to 'src/imageplugins/texture')
-rw-r--r--src/imageplugins/texture/Makefile.am35
-rw-r--r--src/imageplugins/texture/digikamimageplugin_texture.desktop52
-rw-r--r--src/imageplugins/texture/digikamimageplugin_texture_ui.rc20
-rw-r--r--src/imageplugins/texture/imageeffect_texture.cpp291
-rw-r--r--src/imageplugins/texture/imageeffect_texture.h100
-rw-r--r--src/imageplugins/texture/imageplugin_texture.cpp70
-rw-r--r--src/imageplugins/texture/imageplugin_texture.h56
-rw-r--r--src/imageplugins/texture/patterns/Makefile.am5
-rw-r--r--src/imageplugins/texture/patterns/bluejean-texture.pngbin0 -> 18748 bytes
-rw-r--r--src/imageplugins/texture/patterns/bricks-texture.pngbin0 -> 7888 bytes
-rw-r--r--src/imageplugins/texture/patterns/bricks2-texture.pngbin0 -> 8867 bytes
-rw-r--r--src/imageplugins/texture/patterns/burlap-texture.pngbin0 -> 7960 bytes
-rw-r--r--src/imageplugins/texture/patterns/canvas-texture.pngbin0 -> 33037 bytes
-rw-r--r--src/imageplugins/texture/patterns/cellwood-texture.pngbin0 -> 55637 bytes
-rw-r--r--src/imageplugins/texture/patterns/fabric-texture.pngbin0 -> 14189 bytes
-rw-r--r--src/imageplugins/texture/patterns/marble-texture.pngbin0 -> 19218 bytes
-rw-r--r--src/imageplugins/texture/patterns/marble2-texture.pngbin0 -> 6551 bytes
-rw-r--r--src/imageplugins/texture/patterns/metalwire-texture.pngbin0 -> 90343 bytes
-rw-r--r--src/imageplugins/texture/patterns/modern-texture.pngbin0 -> 85181 bytes
-rw-r--r--src/imageplugins/texture/patterns/moss-texture.pngbin0 -> 19894 bytes
-rw-r--r--src/imageplugins/texture/patterns/paper-texture.pngbin0 -> 4435 bytes
-rw-r--r--src/imageplugins/texture/patterns/paper2-texture.pngbin0 -> 182714 bytes
-rw-r--r--src/imageplugins/texture/patterns/stone-texture.pngbin0 -> 13774 bytes
-rw-r--r--src/imageplugins/texture/patterns/wall-texture.pngbin0 -> 69570 bytes
-rw-r--r--src/imageplugins/texture/texture.cpp181
-rw-r--r--src/imageplugins/texture/texture.h62
-rw-r--r--src/imageplugins/texture/texturetool.cpp294
-rw-r--r--src/imageplugins/texture/texturetool.h112
28 files changed, 1278 insertions, 0 deletions
diff --git a/src/imageplugins/texture/Makefile.am b/src/imageplugins/texture/Makefile.am
new file mode 100644
index 00000000..22697c65
--- /dev/null
+++ b/src/imageplugins/texture/Makefile.am
@@ -0,0 +1,35 @@
+METASOURCES = AUTO
+SUBDIRS = patterns
+
+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_texture_la_SOURCES = imageplugin_texture.cpp \
+ texturetool.cpp texture.cpp
+
+digikamimageplugin_texture_la_LIBADD = $(LIB_TDEPARTS) \
+ $(top_builddir)/src/digikam/libdigikam.la
+
+digikamimageplugin_texture_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) -ltdecore -ltdeui $(LIB_TQT) -ltdefx -lkdcraw -ltdeio
+
+kde_services_DATA = digikamimageplugin_texture.desktop
+
+kde_module_LTLIBRARIES = digikamimageplugin_texture.la
+
+rcdir = $(kde_datadir)/digikam
+rc_DATA = digikamimageplugin_texture_ui.rc
+
diff --git a/src/imageplugins/texture/digikamimageplugin_texture.desktop b/src/imageplugins/texture/digikamimageplugin_texture.desktop
new file mode 100644
index 00000000..4caf7e41
--- /dev/null
+++ b/src/imageplugins/texture/digikamimageplugin_texture.desktop
@@ -0,0 +1,52 @@
+[Desktop Entry]
+Name=ImagePlugin_Texture
+Name[bg]=Приставка за снимки - Текстури
+Name[el]=ΠρόσθετοΕικόνας_Υφή
+Name[fi]=Taustapinta
+Name[hr]=Tekstura
+Name[it]=PluginImmagini_Trama
+Name[ms]=ImagePlugin_Tekstur
+Name[nl]=Afbeeldingsplugin_Textuur
+Name[sr]=Текстуре
+Name[sr@Latn]=Teksture
+Name[sv]=Insticksprogram för struktur
+Name[tr]=ResimEklentisi_Doku
+Name[xx]=xxImagePlugin_Texturexx
+
+Type=Service
+X-TDE-ServiceTypes=Digikam/ImagePlugin
+Encoding=UTF-8
+Comment=digiKam plugin to apply texture on image
+Comment[bg]=Приставка на digiKam за добавяне на текстури към снимки
+Comment[ca]=Connector pel digiKam per aplicar una textura a una imatge
+Comment[da]=digiKam-plugin til at anvende tekstur på billedet
+Comment[de]=digiKam-Modul für das Anwenden von Texturen auf ein Bild
+Comment[el]=Πρόσθετο εφαρμογής υφής σε εικόνα για το digiKam
+Comment[es]=Plugin para digiKam para aplicar una textura sobre una imagen
+Comment[et]=DigiKami pildile tekstuuri lisamise plugin
+Comment[fa]=وصلۀ digiKam جهت اعمال بافت در تصویر
+Comment[fi]=Lisää kuvaan taustapinnan
+Comment[fr]=Module externe pour appliquer une texture sur une image dans digiKam
+Comment[gl]=Un plugin de digiKam para aplicar unha textura nunha imaxe
+Comment[hr]=digiKam dodatak za primjenu teksture u slici
+Comment[is]=Íforrit fyrir digiKam sem setur áferð á mynd
+Comment[it]=Plugin di digiKam per applicare una trama su un'immagine
+Comment[ja]=digiKam テクスチャ適用プラグイン
+Comment[nds]=digiKam-Moduul för't Överdregen vun Texturen
+Comment[nl]=Digikam-plugin voor het aanbrengen van textuur op een afbeelding
+Comment[pa]=ਚਿੱਤਰ ਉੱਤੇ ਪਾਠ ਲਿਖਣ ਲਈ ਡਿਜ਼ੀਕੈਮ ਪਲੱਗਇਨ
+Comment[pl]=Wtyczka do programu digiKam pozwalająca na nakładanie tekstury na obraz
+Comment[pt]=Um 'plugin' do digiKam para aplicar uma textura numa imagem
+Comment[pt_BR]=Um 'plugin' do digiKam para aplicar uma textura numa imagem
+Comment[ru]=Модуль digiKam для наложения текстур на изображение
+Comment[sk]=digiKam plugin pre aplikovanie textúry na obrázok
+Comment[sr]=digiKam-ов прикључак за додавање текстура у слику
+Comment[sr@Latn]=digiKam-ov priključak za dodavanje tekstura u sliku
+Comment[sv]=Digikam insticksprogram för att lägga till struktur på en bild
+Comment[tr]=Bir resme doku eklemek için digiKam eklentisi
+Comment[uk]=Втулок застосування текстури для digiKam
+Comment[vi]=Phần bổ sung áp dụng hoạ tiết trên ảnh cho digiKam
+Comment[xx]=xxdigiKam plugin to apply texture on imagexx
+
+X-TDE-Library=digikamimageplugin_texture
+author=Gilles Caulier, caulier dot gilles at gmail dot com
diff --git a/src/imageplugins/texture/digikamimageplugin_texture_ui.rc b/src/imageplugins/texture/digikamimageplugin_texture_ui.rc
new file mode 100644
index 00000000..122833cc
--- /dev/null
+++ b/src/imageplugins/texture/digikamimageplugin_texture_ui.rc
@@ -0,0 +1,20 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui version="4" name="digikamimageplugin_texture" >
+
+ <MenuBar>
+
+ <Menu name="Decorate" ><text>&amp;Decorate</text>
+ <Action name="imageplugin_texture" />
+ </Menu>
+
+ </MenuBar>
+
+ <ToolBar name="ToolBar" >
+ <text>Main Toolbar</text>
+ </ToolBar>
+
+ <ActionProperties>
+ <Action shortcut="" name="imageplugin_texture" />
+ </ActionProperties>
+
+</kpartgui>
diff --git a/src/imageplugins/texture/imageeffect_texture.cpp b/src/imageplugins/texture/imageeffect_texture.cpp
new file mode 100644
index 00000000..5f5d7e9f
--- /dev/null
+++ b/src/imageplugins/texture/imageeffect_texture.cpp
@@ -0,0 +1,291 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-03-10
+ * Description : a plugin to apply texture over an image
+ *
+ * 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 <tqlabel.h>
+#include <tqwhatsthis.h>
+#include <tqlayout.h>
+#include <tqcombobox.h>
+#include <tqimage.h>
+
+// KDE includes.
+
+#include <tdeconfig.h>
+#include <tdelocale.h>
+#include <tdeaboutdata.h>
+#include <kiconloader.h>
+#include <tdeapplication.h>
+#include <kstandarddirs.h>
+#include <knuminput.h>
+
+// Local includes.
+
+#include "version.h"
+#include "ddebug.h"
+#include "dimg.h"
+#include "imageiface.h"
+#include "imagewidget.h"
+#include "texture.h"
+#include "imageeffect_texture.h"
+#include "imageeffect_texture.moc"
+
+namespace DigikamTextureImagesPlugin
+{
+
+ImageEffect_Texture::ImageEffect_Texture(TQWidget* parent)
+ : Digikam::CtrlPanelDlg(parent, i18n("Apply Texture"),
+ "texture", false, false, true,
+ Digikam::ImagePannelWidget::SeparateViewAll)
+{
+ TQString whatsThis;
+
+ TDEAboutData* about = new TDEAboutData("digikam",
+ I18N_NOOP("Apply Texture"),
+ digikam_version,
+ I18N_NOOP("A digiKam image plugin to apply a decorative "
+ "texture to an image."),
+ 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("Type:"), gboxSettings);
+
+ m_textureType = new TQComboBox( false, gboxSettings );
+ m_textureType->insertItem( i18n("Paper") );
+ m_textureType->insertItem( i18n("Paper 2") );
+ m_textureType->insertItem( i18n("Fabric") );
+ m_textureType->insertItem( i18n("Burlap") );
+ m_textureType->insertItem( i18n("Bricks") );
+ m_textureType->insertItem( i18n("Bricks 2") );
+ m_textureType->insertItem( i18n("Canvas") );
+ m_textureType->insertItem( i18n("Marble") );
+ m_textureType->insertItem( i18n("Marble 2") );
+ m_textureType->insertItem( i18n("Blue Jean") );
+ m_textureType->insertItem( i18n("Cell Wood") );
+ m_textureType->insertItem( i18n("Metal Wire") );
+ m_textureType->insertItem( i18n("Modern") );
+ m_textureType->insertItem( i18n("Wall") );
+ m_textureType->insertItem( i18n("Moss") );
+ m_textureType->insertItem( i18n("Stone") );
+ TQWhatsThis::add( m_textureType, i18n("<p>Set here the texture type to apply to the image."));
+
+ gridSettings->addMultiCellWidget(label1, 0, 0, 0, 0);
+ gridSettings->addMultiCellWidget(m_textureType, 0, 0, 1, 1);
+
+ // -------------------------------------------------------------
+
+ TQLabel *label2 = new TQLabel(i18n("Relief:"), gboxSettings);
+
+ m_blendGain = new KIntNumInput(gboxSettings);
+ m_blendGain->setRange(1, 255, 1, true);
+ m_blendGain->setValue(200);
+ TQWhatsThis::add( m_blendGain, i18n("<p>Set here the relief gain used to merge texture and image."));
+
+ gridSettings->addMultiCellWidget(label2, 1, 1, 0, 1);
+ gridSettings->addMultiCellWidget(m_blendGain, 2, 2, 0, 1);
+
+ m_imagePreviewWidget->setUserAreaWidget(gboxSettings);
+
+ // -------------------------------------------------------------
+
+ connect(m_textureType, TQ_SIGNAL(activated(int)),
+ this, TQ_SLOT(slotEffect()));
+
+ connect(m_blendGain, TQ_SIGNAL(valueChanged(int)),
+ this, TQ_SLOT(slotTimer()));
+}
+
+ImageEffect_Texture::~ImageEffect_Texture()
+{
+}
+
+void ImageEffect_Texture::renderingFinished()
+{
+ m_textureType->setEnabled(true);
+ m_blendGain->setEnabled(true);
+}
+
+void ImageEffect_Texture::readUserSettings()
+{
+ TDEConfig* config = kapp->config();
+ config->setGroup("texture Tool Dialog");
+ m_textureType->blockSignals(true);
+ m_blendGain->blockSignals(true);
+ m_textureType->setCurrentItem(config->readNumEntry("TextureType", PaperTexture));
+ m_blendGain->setValue(config->readNumEntry("BlendGain", 200));
+ m_textureType->blockSignals(false);
+ m_blendGain->blockSignals(false);
+}
+
+void ImageEffect_Texture::writeUserSettings()
+{
+ TDEConfig* config = kapp->config();
+ config->setGroup("texture Tool Dialog");
+ config->writeEntry("TextureType", m_textureType->currentItem());
+ config->writeEntry("BlendGain", m_blendGain->value());
+ config->sync();
+}
+
+void ImageEffect_Texture::resetValues()
+{
+ m_textureType->blockSignals(true);
+ m_blendGain->blockSignals(true);
+ m_textureType->setCurrentItem(PaperTexture);
+ m_blendGain->setValue(200);
+ m_textureType->blockSignals(false);
+ m_blendGain->blockSignals(false);
+}
+
+void ImageEffect_Texture::prepareEffect()
+{
+ m_textureType->setEnabled(false);
+ m_blendGain->setEnabled(false);
+
+ Digikam::DImg image = m_imagePreviewWidget->getOriginalRegionImage();
+ TQString texture = getTexturePath( m_textureType->currentItem() );
+
+ int b = 255 - m_blendGain->value();
+
+ m_threadedFilter = dynamic_cast<Digikam::DImgThreadedFilter *>(
+ new Texture(&image, this, b, texture));
+}
+
+void ImageEffect_Texture::prepareFinal()
+{
+ m_textureType->setEnabled(false);
+ m_blendGain->setEnabled(false);
+
+ int b = 255 - m_blendGain->value();
+
+ Digikam::ImageIface iface(0, 0);
+ TQString texture = getTexturePath( m_textureType->currentItem() );
+
+ m_threadedFilter = dynamic_cast<Digikam::DImgThreadedFilter *>(
+ new Texture(iface.getOriginalImg(), this, b, texture));
+}
+
+void ImageEffect_Texture::putPreviewData(void)
+{
+ m_imagePreviewWidget->setPreviewImage(m_threadedFilter->getTargetImage());
+}
+
+void ImageEffect_Texture::putFinalData(void)
+{
+ Digikam::ImageIface iface(0, 0);
+ iface.putOriginalImage(i18n("Texture"), m_threadedFilter->getTargetImage().bits());
+}
+
+TQString ImageEffect_Texture::getTexturePath(int texture)
+{
+ TQString pattern;
+
+ switch (texture)
+ {
+ case PaperTexture:
+ pattern = "paper-texture";
+ break;
+
+ case Paper2Texture:
+ pattern = "paper2-texture";
+ break;
+
+ case FabricTexture:
+ pattern = "fabric-texture";
+ break;
+
+ case BurlapTexture:
+ pattern = "burlap-texture";
+ break;
+
+ case BricksTexture:
+ pattern = "bricks-texture";
+ break;
+
+ case Bricks2Texture:
+ pattern = "bricks2-texture";
+ break;
+
+ case CanvasTexture:
+ pattern = "canvas-texture";
+ break;
+
+ case MarbleTexture:
+ pattern = "marble-texture";
+ break;
+
+ case Marble2Texture:
+ pattern = "marble2-texture";
+ break;
+
+ case BlueJeanTexture:
+ pattern = "bluejean-texture";
+ break;
+
+ case CellWoodTexture:
+ pattern = "cellwood-texture";
+ break;
+
+ case MetalWireTexture:
+ pattern = "metalwire-texture";
+ break;
+
+ case ModernTexture:
+ pattern = "modern-texture";
+ break;
+
+ case WallTexture:
+ pattern = "wall-texture";
+ break;
+
+ case MossTexture:
+ pattern = "moss-texture";
+ break;
+
+ case StoneTexture:
+ pattern = "stone-texture";
+ break;
+ }
+
+ TDEGlobal::dirs()->addResourceType(pattern.ascii(), TDEGlobal::dirs()->kde_default("data") +
+ "digikam/data");
+ return (TDEGlobal::dirs()->findResourceDir(pattern.ascii(), pattern + ".png") + pattern + ".png" );
+}
+
+} // NameSpace DigikamTextureImagesPlugin
+
diff --git a/src/imageplugins/texture/imageeffect_texture.h b/src/imageplugins/texture/imageeffect_texture.h
new file mode 100644
index 00000000..d37068b6
--- /dev/null
+++ b/src/imageplugins/texture/imageeffect_texture.h
@@ -0,0 +1,100 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-03-10
+ * Description : a plugin to apply texture over an image
+ *
+ * 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_TEXTURE_H
+#define IMAGEEFFECT_TEXTURE_H
+
+// TQt includes.
+
+#include <tqstring.h>
+
+// Digikam includes.
+
+#include "ctrlpaneldlg.h"
+
+class TQComboBox;
+
+class KIntNumInput;
+
+namespace DigikamTextureImagesPlugin
+{
+
+class ImageEffect_Texture : public Digikam::CtrlPanelDlg
+{
+ TQ_OBJECT
+
+
+public:
+
+ ImageEffect_Texture(TQWidget* parent);
+ ~ImageEffect_Texture();
+
+private:
+
+ TQString getTexturePath(int texture);
+
+private slots:
+
+ void readUserSettings();
+
+private:
+
+ void writeUserSettings();
+ void resetValues();
+ void prepareEffect();
+ void prepareFinal();
+ void putPreviewData();
+ void putFinalData();
+ void renderingFinished();
+
+private:
+
+ enum TextureTypes
+ {
+ PaperTexture=0,
+ Paper2Texture,
+ FabricTexture,
+ BurlapTexture,
+ BricksTexture,
+ Bricks2Texture,
+ CanvasTexture,
+ MarbleTexture,
+ Marble2Texture,
+ BlueJeanTexture,
+ CellWoodTexture,
+ MetalWireTexture,
+ ModernTexture,
+ WallTexture,
+ MossTexture,
+ StoneTexture
+ };
+
+ TQComboBox *m_textureType;
+
+ KIntNumInput *m_blendGain;
+};
+
+} // NameSpace DigikamTextureImagesPlugin
+
+#endif /* IMAGEEFFECT_TEXTURE_H */
diff --git a/src/imageplugins/texture/imageplugin_texture.cpp b/src/imageplugins/texture/imageplugin_texture.cpp
new file mode 100644
index 00000000..ec0e3ba8
--- /dev/null
+++ b/src/imageplugins/texture/imageplugin_texture.cpp
@@ -0,0 +1,70 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-03-10
+ * Description : a plugin to apply texture over an image
+ *
+ * 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 "texturetool.h"
+#include "imageplugin_texture.h"
+#include "imageplugin_texture.moc"
+
+using namespace DigikamTextureImagesPlugin;
+
+K_EXPORT_COMPONENT_FACTORY(digikamimageplugin_texture,
+ KGenericFactory<ImagePlugin_Texture>("digikamimageplugin_texture"));
+
+ImagePlugin_Texture::ImagePlugin_Texture(TQObject *parent, const char*, const TQStringList &)
+ : Digikam::ImagePlugin(parent, "ImagePlugin_Texture")
+{
+ m_textureAction = new TDEAction(i18n("Apply Texture..."), "texture", 0,
+ this, TQ_SLOT(slotTexture()),
+ actionCollection(), "imageplugin_texture");
+
+ setXMLFile( "digikamimageplugin_texture_ui.rc" );
+
+ DDebug() << "ImagePlugin_Texture plugin loaded" << endl;
+}
+
+ImagePlugin_Texture::~ImagePlugin_Texture()
+{
+}
+
+void ImagePlugin_Texture::setEnabledActions(bool enable)
+{
+ m_textureAction->setEnabled(enable);
+}
+
+void ImagePlugin_Texture::slotTexture()
+{
+ TextureTool *tool = new TextureTool(this);
+ loadTool(tool);
+}
diff --git a/src/imageplugins/texture/imageplugin_texture.h b/src/imageplugins/texture/imageplugin_texture.h
new file mode 100644
index 00000000..bae2ba5e
--- /dev/null
+++ b/src/imageplugins/texture/imageplugin_texture.h
@@ -0,0 +1,56 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-03-10
+ * Description : a plugin to apply texture over an image
+ *
+ * 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_TEXTURE_H
+#define IMAGEPLUGIN_TEXTURE_H
+
+// Digikam includes.
+
+#include "imageplugin.h"
+#include "digikam_export.h"
+
+class TDEAction;
+
+class DIGIKAMIMAGEPLUGINS_EXPORT ImagePlugin_Texture : public Digikam::ImagePlugin
+{
+ TQ_OBJECT
+
+
+public:
+
+ ImagePlugin_Texture(TQObject *parent, const char* name,
+ const TQStringList &args);
+ ~ImagePlugin_Texture();
+
+ void setEnabledActions(bool enable);
+
+private slots:
+
+ void slotTexture();
+
+private:
+
+ TDEAction *m_textureAction;
+};
+
+#endif /* IMAGEPLUGIN_TEXTURE_H */
diff --git a/src/imageplugins/texture/patterns/Makefile.am b/src/imageplugins/texture/patterns/Makefile.am
new file mode 100644
index 00000000..414c7f20
--- /dev/null
+++ b/src/imageplugins/texture/patterns/Makefile.am
@@ -0,0 +1,5 @@
+borderpicsdir = $(kde_datadir)/digikam/data
+borderpics_DATA = bricks2-texture.png bricks-texture.png burlap-texture.png canvas-texture.png \
+ marble2-texture.png marble-texture.png paper-texture.png stone-texture.png \
+ fabric-texture.png paper2-texture.png bluejean-texture.png cellwood-texture.png \
+ metalwire-texture.png modern-texture.png wall-texture.png moss-texture.png \ No newline at end of file
diff --git a/src/imageplugins/texture/patterns/bluejean-texture.png b/src/imageplugins/texture/patterns/bluejean-texture.png
new file mode 100644
index 00000000..3885d60b
--- /dev/null
+++ b/src/imageplugins/texture/patterns/bluejean-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/bricks-texture.png b/src/imageplugins/texture/patterns/bricks-texture.png
new file mode 100644
index 00000000..0ebfa881
--- /dev/null
+++ b/src/imageplugins/texture/patterns/bricks-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/bricks2-texture.png b/src/imageplugins/texture/patterns/bricks2-texture.png
new file mode 100644
index 00000000..985c5e84
--- /dev/null
+++ b/src/imageplugins/texture/patterns/bricks2-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/burlap-texture.png b/src/imageplugins/texture/patterns/burlap-texture.png
new file mode 100644
index 00000000..04494770
--- /dev/null
+++ b/src/imageplugins/texture/patterns/burlap-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/canvas-texture.png b/src/imageplugins/texture/patterns/canvas-texture.png
new file mode 100644
index 00000000..6aa3df8e
--- /dev/null
+++ b/src/imageplugins/texture/patterns/canvas-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/cellwood-texture.png b/src/imageplugins/texture/patterns/cellwood-texture.png
new file mode 100644
index 00000000..b94f618c
--- /dev/null
+++ b/src/imageplugins/texture/patterns/cellwood-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/fabric-texture.png b/src/imageplugins/texture/patterns/fabric-texture.png
new file mode 100644
index 00000000..ac88eb74
--- /dev/null
+++ b/src/imageplugins/texture/patterns/fabric-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/marble-texture.png b/src/imageplugins/texture/patterns/marble-texture.png
new file mode 100644
index 00000000..c22ab4ed
--- /dev/null
+++ b/src/imageplugins/texture/patterns/marble-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/marble2-texture.png b/src/imageplugins/texture/patterns/marble2-texture.png
new file mode 100644
index 00000000..45b77f05
--- /dev/null
+++ b/src/imageplugins/texture/patterns/marble2-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/metalwire-texture.png b/src/imageplugins/texture/patterns/metalwire-texture.png
new file mode 100644
index 00000000..cf0b402c
--- /dev/null
+++ b/src/imageplugins/texture/patterns/metalwire-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/modern-texture.png b/src/imageplugins/texture/patterns/modern-texture.png
new file mode 100644
index 00000000..45ed8b7a
--- /dev/null
+++ b/src/imageplugins/texture/patterns/modern-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/moss-texture.png b/src/imageplugins/texture/patterns/moss-texture.png
new file mode 100644
index 00000000..9403189f
--- /dev/null
+++ b/src/imageplugins/texture/patterns/moss-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/paper-texture.png b/src/imageplugins/texture/patterns/paper-texture.png
new file mode 100644
index 00000000..c9c90205
--- /dev/null
+++ b/src/imageplugins/texture/patterns/paper-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/paper2-texture.png b/src/imageplugins/texture/patterns/paper2-texture.png
new file mode 100644
index 00000000..36817ffd
--- /dev/null
+++ b/src/imageplugins/texture/patterns/paper2-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/stone-texture.png b/src/imageplugins/texture/patterns/stone-texture.png
new file mode 100644
index 00000000..6f26b474
--- /dev/null
+++ b/src/imageplugins/texture/patterns/stone-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/patterns/wall-texture.png b/src/imageplugins/texture/patterns/wall-texture.png
new file mode 100644
index 00000000..d7322500
--- /dev/null
+++ b/src/imageplugins/texture/patterns/wall-texture.png
Binary files differ
diff --git a/src/imageplugins/texture/texture.cpp b/src/imageplugins/texture/texture.cpp
new file mode 100644
index 00000000..42477d5d
--- /dev/null
+++ b/src/imageplugins/texture/texture.cpp
@@ -0,0 +1,181 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-05-25
+ * Description : Texture 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>
+
+// Local includes.
+
+#include "dimg.h"
+#include "ddebug.h"
+#include "texture.h"
+
+namespace DigikamTextureImagesPlugin
+{
+
+Texture::Texture(Digikam::DImg *orgImage, TQObject *parent, int blendGain, TQString texturePath)
+ : Digikam::DImgThreadedFilter(orgImage, parent, "Texture")
+{
+ m_blendGain = blendGain;
+ m_texturePath = texturePath;
+
+ initFilter();
+}
+
+// This method is based on the Simulate Texture Film tutorial from GimpGuru.org web site
+// available at this url : http://www.gimpguru.org/Tutorials/SimulatedTexture/
+
+//#define INT_MULT(a,b,t) ((t) = (a) * (b) + 0x80, ( ( (t >> 8) + t ) >> 8))
+
+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;
+}
+
+void Texture::filterImage(void)
+{
+ // Texture tile.
+
+ int w = m_orgImage.width();
+ int h = m_orgImage.height();
+ int bytesDepth = m_orgImage.bytesDepth();
+ bool sixteenBit = m_orgImage.sixteenBit();
+
+ DDebug() << "Texture File: " << m_texturePath << endl;
+ Digikam::DImg texture(m_texturePath);
+ if ( texture.isNull() ) return;
+
+ Digikam::DImg textureImg(w, h, m_orgImage.sixteenBit(), m_orgImage.hasAlpha());
+
+ texture.convertToDepthOfImage(&textureImg);
+
+ for (int x = 0 ; x < w ; x+=texture.width())
+ for (int y = 0 ; y < h ; y+=texture.height())
+ textureImg.bitBltImage(&texture, x, y);
+
+ // Apply texture.
+
+ uchar* data = m_orgImage.bits();
+ uchar* pTeData = textureImg.bits();
+ uchar* pOutBits = m_destImage.bits();
+ uint offset;
+
+ Digikam::DColor teData, transData, inData, outData;
+ uchar *ptr, *dptr, *tptr;
+ int progress;
+
+ int blendGain;
+ if (sixteenBit)
+ blendGain = (m_blendGain + 1) * 256 - 1;
+ else
+ blendGain = m_blendGain;
+
+ // Make textured transparent layout.
+
+ for (int x = 0; !m_cancel && x < w; x++)
+ {
+ for (int y = 0; !m_cancel && y < h; y++)
+ {
+ offset = x*bytesDepth + (y*w*bytesDepth);
+ ptr = data + offset;
+ tptr = pTeData + offset;
+
+ // Read color
+ teData.setColor(tptr, sixteenBit);
+
+ // in the old algorithm, this was
+ //teData.channel.red = (teData.channel.red * (255 - m_blendGain) +
+ // transData.channel.red * m_blendGain) >> 8;
+ // but transdata was uninitialized, its components were apparently 0,
+ // so I removed the part after the "+".
+
+ if (sixteenBit)
+ {
+ teData.blendInvAlpha16(blendGain);
+ }
+ else
+ {
+ teData.blendInvAlpha8(blendGain);
+ }
+
+ // Overwrite RGB.
+ teData.setPixel(tptr);
+ }
+
+ // Update progress bar in dialog.
+ progress = (int) (((double)x * 50.0) / w);
+
+ if (progress%5 == 0)
+ postProgress(progress);
+ }
+
+ // Merge layout and image using overlay method.
+
+ for (int x = 0; !m_cancel && x < w; x++)
+ {
+ for (int y = 0; !m_cancel && y < h; y++)
+ {
+ offset = x*bytesDepth + (y*w*bytesDepth);
+ ptr = data + offset;
+ dptr = pOutBits + offset;
+ tptr = pTeData + offset;
+
+ inData.setColor (ptr, sixteenBit);
+ outData.setColor(dptr, sixteenBit);
+ teData.setColor (tptr, sixteenBit);
+
+ if (sixteenBit)
+ {
+ outData.setRed ( intMult16 (inData.red(), inData.red() + intMult16(2 * teData.red(), 65535 - inData.red()) ) );
+ outData.setGreen( intMult16 (inData.green(), inData.green() + intMult16(2 * teData.green(), 65535 - inData.green()) ) );
+ outData.setBlue ( intMult16 (inData.blue(), inData.blue() + intMult16(2 * teData.blue(), 65535 - inData.blue()) ) );
+ }
+ else
+ {
+ outData.setRed ( intMult8 (inData.red(), inData.red() + intMult8(2 * teData.red(), 255 - inData.red()) ) );
+ outData.setGreen( intMult8 (inData.green(), inData.green() + intMult8(2 * teData.green(), 255 - inData.green()) ) );
+ outData.setBlue ( intMult8 (inData.blue(), inData.blue() + intMult8(2 * teData.blue(), 255 - inData.blue()) ) );
+ }
+ outData.setAlpha( inData.alpha() );
+ outData.setPixel( dptr );
+ }
+
+ // Update progress bar in dialog.
+ progress = (int) (50.0 + ((double)x * 50.0) / w);
+
+ if (progress%5 == 0)
+ postProgress(progress);
+ }
+}
+
+} // NameSpace DigikamTextureImagesPlugin
diff --git a/src/imageplugins/texture/texture.h b/src/imageplugins/texture/texture.h
new file mode 100644
index 00000000..1bcda2ff
--- /dev/null
+++ b/src/imageplugins/texture/texture.h
@@ -0,0 +1,62 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-05-25
+ * Description : Texture 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 TEXTURE_H
+#define TEXTURE_H
+
+// TQt includes.
+
+#include <tqstring.h>
+
+// Digikam includes.
+
+#include "dimgthreadedfilter.h"
+
+namespace DigikamTextureImagesPlugin
+{
+
+class Texture : public Digikam::DImgThreadedFilter
+{
+
+public:
+
+ Texture(Digikam::DImg *orgImage, TQObject *parent=0, int blendGain=200,
+ TQString texturePath=TQString());
+
+ ~Texture(){};
+
+private:
+
+ virtual void filterImage(void);
+
+private:
+
+ int m_blendGain;
+
+ TQString m_texturePath;
+};
+
+} // NameSpace DigikamTextureImagesPlugin
+
+#endif /* TEXTURE_H */
diff --git a/src/imageplugins/texture/texturetool.cpp b/src/imageplugins/texture/texturetool.cpp
new file mode 100644
index 00000000..71e29aea
--- /dev/null
+++ b/src/imageplugins/texture/texturetool.cpp
@@ -0,0 +1,294 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-03-10
+ * Description : a plugin to apply texture over an image
+ *
+ * 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 <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>
+#include <libkdcraw/rcombobox.h>
+
+// Local includes.
+
+#include "daboutdata.h"
+#include "ddebug.h"
+#include "dimg.h"
+#include "imageiface.h"
+#include "imagepanelwidget.h"
+#include "editortoolsettings.h"
+#include "texture.h"
+#include "texturetool.h"
+#include "texturetool.moc"
+
+using namespace KDcrawIface;
+using namespace Digikam;
+
+namespace DigikamTextureImagesPlugin
+{
+
+TextureTool::TextureTool(TQObject* parent)
+ : EditorToolThreaded(parent)
+{
+ setName("texture");
+ setToolName(i18n("Texture"));
+ setToolIcon(SmallIcon("texture"));
+
+ // -------------------------------------------------------------
+
+ m_gboxSettings = new EditorToolSettings(EditorToolSettings::Default|
+ EditorToolSettings::Ok|
+ EditorToolSettings::Cancel|
+ EditorToolSettings::PanIcon);
+ TQGridLayout* grid = new TQGridLayout( m_gboxSettings->plainPage(), 3, 1);
+ TQLabel *label1 = new TQLabel(i18n("Type:"), m_gboxSettings->plainPage());
+
+ m_textureType = new RComboBox(m_gboxSettings->plainPage());
+ m_textureType->insertItem(i18n("Paper"));
+ m_textureType->insertItem(i18n("Paper 2"));
+ m_textureType->insertItem(i18n("Fabric"));
+ m_textureType->insertItem(i18n("Burlap"));
+ m_textureType->insertItem(i18n("Bricks"));
+ m_textureType->insertItem(i18n("Bricks 2"));
+ m_textureType->insertItem(i18n("Canvas"));
+ m_textureType->insertItem(i18n("Marble"));
+ m_textureType->insertItem(i18n("Marble 2"));
+ m_textureType->insertItem(i18n("Blue Jean"));
+ m_textureType->insertItem(i18n("Cell Wood"));
+ m_textureType->insertItem(i18n("Metal Wire"));
+ m_textureType->insertItem(i18n("Modern"));
+ m_textureType->insertItem(i18n("Wall"));
+ m_textureType->insertItem(i18n("Moss"));
+ m_textureType->insertItem(i18n("Stone"));
+ m_textureType->setDefaultItem(PaperTexture);
+ TQWhatsThis::add( m_textureType, i18n("<p>Set here the texture type to apply to the image."));
+
+ // -------------------------------------------------------------
+
+ TQLabel *label2 = new TQLabel(i18n("Relief:"), m_gboxSettings->plainPage());
+
+ m_blendGain = new RIntNumInput(m_gboxSettings->plainPage());
+ m_blendGain->setRange(1, 255, 1);
+ m_blendGain->setDefaultValue(200);
+ TQWhatsThis::add( m_blendGain, i18n("<p>Set here the relief gain used to merge texture and image."));
+
+ grid->addMultiCellWidget(label1, 0, 0, 0, 0);
+ grid->addMultiCellWidget(m_textureType, 0, 0, 1, 1);
+ grid->addMultiCellWidget(label2, 1, 1, 0, 1);
+ grid->addMultiCellWidget(m_blendGain, 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, "texture Tool", m_gboxSettings->panIconView());
+
+ setToolView(m_previewWidget);
+ init();
+
+ // -------------------------------------------------------------
+
+ connect(m_textureType, TQ_SIGNAL(activated(int)),
+ this, TQ_SLOT(slotEffect()));
+
+ connect(m_blendGain, TQ_SIGNAL(valueChanged(int)),
+ this, TQ_SLOT(slotTimer()));
+}
+
+TextureTool::~TextureTool()
+{
+}
+
+void TextureTool::renderingFinished()
+{
+ m_textureType->setEnabled(true);
+ m_blendGain->setEnabled(true);
+}
+
+void TextureTool::readSettings()
+{
+ TDEConfig* config = kapp->config();
+ config->setGroup("texture Tool");
+
+ m_textureType->blockSignals(true);
+ m_blendGain->blockSignals(true);
+
+ m_textureType->setCurrentItem(config->readNumEntry("TextureType", m_textureType->defaultItem()));
+ m_blendGain->setValue(config->readNumEntry("BlendGain", m_blendGain->defaultValue()));
+
+ m_textureType->blockSignals(false);
+ m_blendGain->blockSignals(false);
+}
+
+void TextureTool::writeSettings()
+{
+ TDEConfig* config = kapp->config();
+ config->setGroup("texture Tool");
+ config->writeEntry("TextureType", m_textureType->currentItem());
+ config->writeEntry("BlendGain", m_blendGain->value());
+ m_previewWidget->writeSettings();
+ config->sync();
+}
+
+void TextureTool::slotResetSettings()
+{
+ m_textureType->blockSignals(true);
+ m_blendGain->blockSignals(true);
+
+ m_textureType->slotReset();
+ m_blendGain->slotReset();
+
+ m_textureType->blockSignals(false);
+ m_blendGain->blockSignals(false);
+}
+
+void TextureTool::prepareEffect()
+{
+ m_textureType->setEnabled(false);
+ m_blendGain->setEnabled(false);
+
+ DImg image = m_previewWidget->getOriginalRegionImage();
+ TQString texture = getTexturePath( m_textureType->currentItem() );
+
+ int b = 255 - m_blendGain->value();
+
+ setFilter(dynamic_cast<DImgThreadedFilter*>(new Texture(&image, this, b, texture)));
+}
+
+void TextureTool::prepareFinal()
+{
+ m_textureType->setEnabled(false);
+ m_blendGain->setEnabled(false);
+
+ int b = 255 - m_blendGain->value();
+
+ ImageIface iface(0, 0);
+ TQString texture = getTexturePath( m_textureType->currentItem() );
+
+ setFilter(dynamic_cast<DImgThreadedFilter*>(new Texture(iface.getOriginalImg(), this, b, texture)));
+}
+
+void TextureTool::putPreviewData()
+{
+ m_previewWidget->setPreviewImage(filter()->getTargetImage());
+}
+
+void TextureTool::putFinalData()
+{
+ ImageIface iface(0, 0);
+ iface.putOriginalImage(i18n("Texture"), filter()->getTargetImage().bits());
+}
+
+TQString TextureTool::getTexturePath(int texture)
+{
+ TQString pattern;
+
+ switch (texture)
+ {
+ case PaperTexture:
+ pattern = "paper-texture";
+ break;
+
+ case Paper2Texture:
+ pattern = "paper2-texture";
+ break;
+
+ case FabricTexture:
+ pattern = "fabric-texture";
+ break;
+
+ case BurlapTexture:
+ pattern = "burlap-texture";
+ break;
+
+ case BricksTexture:
+ pattern = "bricks-texture";
+ break;
+
+ case Bricks2Texture:
+ pattern = "bricks2-texture";
+ break;
+
+ case CanvasTexture:
+ pattern = "canvas-texture";
+ break;
+
+ case MarbleTexture:
+ pattern = "marble-texture";
+ break;
+
+ case Marble2Texture:
+ pattern = "marble2-texture";
+ break;
+
+ case BlueJeanTexture:
+ pattern = "bluejean-texture";
+ break;
+
+ case CellWoodTexture:
+ pattern = "cellwood-texture";
+ break;
+
+ case MetalWireTexture:
+ pattern = "metalwire-texture";
+ break;
+
+ case ModernTexture:
+ pattern = "modern-texture";
+ break;
+
+ case WallTexture:
+ pattern = "wall-texture";
+ break;
+
+ case MossTexture:
+ pattern = "moss-texture";
+ break;
+
+ case StoneTexture:
+ pattern = "stone-texture";
+ break;
+ }
+
+ TDEGlobal::dirs()->addResourceType(pattern.ascii(), TDEGlobal::dirs()->kde_default("data") + "digikam/data");
+ return (TDEGlobal::dirs()->findResourceDir(pattern.ascii(), pattern + ".png") + pattern + ".png" );
+}
+
+} // NameSpace DigikamTextureImagesPlugin
diff --git a/src/imageplugins/texture/texturetool.h b/src/imageplugins/texture/texturetool.h
new file mode 100644
index 00000000..1287bb3e
--- /dev/null
+++ b/src/imageplugins/texture/texturetool.h
@@ -0,0 +1,112 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2005-03-10
+ * Description : a plugin to apply texture over an image
+ *
+ * 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 TEXTURETOOL_H
+#define TEXTURETOOL_H
+
+// TQt includes.
+
+#include <tqstring.h>
+
+// Digikam includes.
+
+#include "editortool.h"
+
+namespace KDcrawIface
+{
+class RIntNumInput;
+class RComboBox;
+}
+
+namespace Digikam
+{
+class EditorToolSettings;
+class ImagePanelWidget;
+}
+
+namespace DigikamTextureImagesPlugin
+{
+
+class TextureTool : public Digikam::EditorToolThreaded
+{
+ TQ_OBJECT
+
+
+public:
+
+ TextureTool(TQObject* parent);
+ ~TextureTool();
+
+private:
+
+ TQString getTexturePath(int texture);
+
+private slots:
+
+ void slotResetSettings();
+
+private:
+
+ void readSettings();
+ void writeSettings();
+ void prepareEffect();
+ void prepareFinal();
+ void putPreviewData();
+ void putFinalData();
+ void renderingFinished();
+
+private:
+
+ enum TextureTypes
+ {
+ PaperTexture=0,
+ Paper2Texture,
+ FabricTexture,
+ BurlapTexture,
+ BricksTexture,
+ Bricks2Texture,
+ CanvasTexture,
+ MarbleTexture,
+ Marble2Texture,
+ BlueJeanTexture,
+ CellWoodTexture,
+ MetalWireTexture,
+ ModernTexture,
+ WallTexture,
+ MossTexture,
+ StoneTexture
+ };
+
+ KDcrawIface::RComboBox *m_textureType;
+
+ KDcrawIface::RIntNumInput *m_blendGain;
+
+ Digikam::ImagePanelWidget *m_previewWidget;
+
+ Digikam::EditorToolSettings *m_gboxSettings;
+};
+
+} // NameSpace DigikamTextureImagesPlugin
+
+#endif /* TEXTURETOOL_H */