Commit b2e93e4e authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove the old dropshadow plugin

This is to be replaced with the drop shadow layer style.
parent 1d026f71
......@@ -3,7 +3,6 @@ add_subdirectory( imagesplit )
add_subdirectory( clonesarray )
add_subdirectory( colorrange )
add_subdirectory( colorspaceconversion )
add_subdirectory( dropshadow )
add_subdirectory( histogram )
add_subdirectory( imagesize )
add_subdirectory( metadataeditor )
......
set(kritadropshadow_PART_SRCS kis_dropshadow.cc dlg_dropshadow.cc kis_dropshadow_plugin.cc )
kde4_add_ui_files(kritadropshadow_PART_SRCS wdg_dropshadow.ui )
kde4_add_plugin(kritadropshadow ${kritadropshadow_PART_SRCS})
target_link_libraries(kritadropshadow kritaui)
install(TARGETS kritadropshadow DESTINATION ${PLUGIN_INSTALL_DIR})
########### install files ###############
install( FILES dropshadow.rc DESTINATION ${DATA_INSTALL_DIR}/kritaplugins)
install( FILES kritadropshadow.desktop DESTINATION ${SERVICES_INSTALL_DIR}/calligra)
/*
* dlg_dropshadow.cc - part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2005 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* 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 of the License, 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "dlg_dropshadow.h"
#include <QRadioButton>
#include <QCheckBox>
#include <QLabel>
#include <QComboBox>
#include <QColor>
#include <kconfig.h>
#include <klocale.h>
#include <knuminput.h>
#include <kis_debug.h>
DlgDropshadow::DlgDropshadow(const QString & /*imageCS*/,
const QString & /*layerCS*/,
QWidget * parent,
const char * name)
: KDialog(parent)
{
setCaption(i18n("Drop Shadow"));
setButtons(Ok | Cancel);
setDefaultButton(Ok);
setObjectName(name);
m_page = new WdgDropshadow(this, "dropshadow");
Q_CHECK_PTR(m_page);
setMainWidget(m_page);
resize(m_page->sizeHint());
KConfigGroup cfg = KGlobal::config()->group("dropshadow");
m_page->xOffsetSpinBox->setValue(cfg.readEntry<int>("x", 8));
m_page->yOffsetSpinBox->setValue(cfg.readEntry<int>("y", 8));
m_page->blurRadiusSpinBox->setValue(cfg.readEntry<int>("blurRadius", 5));
QColor black(0, 0, 0);
m_page->shadowColorButton->setColor(cfg.readEntry<QColor>("color", Qt::black));
m_page->opacitySlider->setValue(cfg.readEntry<int>("opacity", 80));
m_page->opacitySpinBox->setValue(cfg.readEntry<int>("opacity", 80));
m_page->allowResizingCheckBox->setChecked(cfg.readEntry<bool>("resizing", true));
connect(this, SIGNAL(okClicked()),
this, SLOT(okClicked()));
}
DlgDropshadow::~DlgDropshadow()
{
delete m_page;
}
qint32 DlgDropshadow::getXOffset()
{
return m_page->xOffsetSpinBox->value();
}
qint32 DlgDropshadow::getYOffset()
{
return m_page->yOffsetSpinBox->value();
}
qint32 DlgDropshadow::getBlurRadius()
{
return m_page->blurRadiusSpinBox->value();
}
quint8 DlgDropshadow::getShadowOpacity()
{
double opacity = (double)m_page->opacitySpinBox->value();
//convert percent to a 8 bit opacity value
return (quint8)(opacity / 100 * 255);
}
QColor DlgDropshadow::getShadowColor()
{
return m_page->shadowColorButton->color();
}
bool DlgDropshadow::allowResizingChecked()
{
return m_page->allowResizingCheckBox->isChecked();
}
// SLOTS
void DlgDropshadow::okClicked()
{
KConfigGroup cfg = KGlobal::config()->group("dropshadow");
cfg.writeEntry("x", m_page->xOffsetSpinBox->value());
cfg.writeEntry("y", m_page->yOffsetSpinBox->value());
cfg.writeEntry("blurRadius", m_page->blurRadiusSpinBox->value());
cfg.writeEntry("color", m_page->shadowColorButton->color());
cfg.writeEntry("opacity", m_page->opacitySpinBox->value());
cfg.writeEntry("resizing", m_page->allowResizingCheckBox->isChecked());
accept();
}
#include "dlg_dropshadow.moc"
/*
* dlg_dropshadow.h -- part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2005 Michael Thaler <michael.thaler@physik.tu-muenchen.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 of the License, 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_DROPSHADOW
#define DLG_DROPSHADOW
#include <kdialog.h>
#include "kis_dropshadow.h"
#include "ui_wdg_dropshadow.h"
class QColor;
class WdgDropshadow : public QWidget, public Ui::WdgDropshadow
{
Q_OBJECT
public:
WdgDropshadow(QWidget *parent, const char *name) : QWidget(parent) {
setObjectName(name); setupUi(this);
}
};
/**
* This dialog allows the user to configure the decomposition of an image
* into layers: one layer for each color channel.
*/
class DlgDropshadow: public KDialog
{
Q_OBJECT
public:
DlgDropshadow(const QString & imageCS, const QString & layerCS, QWidget * parent = 0,
const char* name = 0);
~DlgDropshadow();
public:
qint32 getXOffset();
qint32 getYOffset();
qint32 getBlurRadius();
quint8 getShadowOpacity();
QColor getShadowColor();
bool allowResizingChecked();
private slots:
void okClicked();
private:
WdgDropshadow * m_page;
};
#endif // DLG_DROPSHADOW
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui library="kritadropshadow" version="6">
<MenuBar>
<Menu name="Layer"><text>La&amp;yer</text>
<Separator/>
<Menu name="layerEffects"><text>Layer Effects</text>
<Action name="dropshadow"/>
</Menu>
</Menu>
</MenuBar>
</kpartgui>
This diff is collapsed.
/*
* This file is part of the KDE project
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.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 of the License, 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_DROPSHADOW_H_
#define _KIS_DROPSHADOW_H_
#include <kis_paint_device.h>
typedef enum {
BLUR_IIR,
BLUR_RLE
} BlurMethod;
class QColor;
class KisView2;
class KoUpdater;
class KisDropshadow : public QObject
{
Q_OBJECT
public:
KisDropshadow(KisView2 * view);
virtual ~KisDropshadow() {}
void dropshadow(KoUpdater * progress, qint32 xoffset, qint32 yoffset, qint32 blurradius, const QColor & color, quint8 opacity, bool allowResize);
private:
void gaussianblur(KoUpdater * progress, KisPaintDeviceSP src, KisPaintDeviceSP dst,
QRect& rect, double horz, double vert,
BlurMethod method,
KoUpdater * progressDisplay);
//gaussian blur helper functions
void find_constants(double n_p[], double n_m[], double d_p[], double d_m[], double bd_p[], double bd_m[], double std_dev);
void transfer_pixels(double *src1, double *src2, quint8 *dest, qint32 bytes, qint32 width);
qint32* make_curve(double sigma, qint32 *length);
void run_length_encode(quint8 *src, qint32 *dest, qint32 bytes, qint32 width);
void multiply_alpha(quint8 *buf, qint32 width, qint32 bytes);
void separate_alpha(quint8 *buf, qint32 width, qint32 bytes);
private:
KisView2 * m_view;
};
#endif
/*
* This file is part of the KDE project
*
* Copyright (c) 2005 Michael Thaler <michael.thaler@physik.tu-muenchen.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 of the License, 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_dropshadow_plugin.h"
#include <klocale.h>
#include <kis_debug.h>
#include <kpluginfactory.h>
#include "kis_view2.h"
#include <kis_action.h>
#include "kis_types.h"
#include "kis_image.h"
#include "kis_layer.h"
#include <KoColorSpace.h>
#include <KoProgressUpdater.h>
#include <KoUpdater.h>
#include "kis_dropshadow.h"
#include "dlg_dropshadow.h"
K_PLUGIN_FACTORY(KisDropshadowPluginFactory, registerPlugin<KisDropshadowPlugin>();)
K_EXPORT_PLUGIN(KisDropshadowPluginFactory("krita"))
KisDropshadowPlugin::KisDropshadowPlugin(QObject *parent, const QVariantList &)
: KisViewPlugin(parent, "kritaplugins/dropshadow.rc")
{
KisAction *action = new KisAction(i18n("Add Drop Shadow..."), this);
action->setActivationFlags(KisAction::ACTIVE_LAYER);
addAction("dropshadow", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotDropshadow()));
}
KisDropshadowPlugin::~KisDropshadowPlugin()
{
}
void KisDropshadowPlugin::slotDropshadow()
{
KisImageWSP image = m_view->image();
if (!image) return;
KisLayerSP layer = m_view->activeLayer();
if (!layer) return;
DlgDropshadow * dlgDropshadow = new DlgDropshadow(layer->colorSpace()->name(),
image->colorSpace()->name(),
m_view, "Dropshadow");
Q_CHECK_PTR(dlgDropshadow);
dlgDropshadow->setCaption(i18n("Drop Shadow"));
if (dlgDropshadow->exec() == QDialog::Accepted) {
KisDropshadow dropshadow(m_view);
KoProgressUpdater* updater = m_view->createProgressUpdater();
updater->start(100, i18n("Drop Shadow"));
QPointer<KoUpdater> u = updater->startSubtask();
dropshadow.dropshadow(u,
dlgDropshadow->getXOffset(),
dlgDropshadow->getYOffset(),
dlgDropshadow->getBlurRadius(),
dlgDropshadow->getShadowColor(),
dlgDropshadow->getShadowOpacity(),
dlgDropshadow->allowResizingChecked());
updater->deleteLater();
}
delete dlgDropshadow;
}
#include "kis_dropshadow_plugin.moc"
/*
* This file is part of Krita
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.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 of the License, 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _KIS_DROPSHADOW_PLUGIN_H_
#define _KIS_DROPSHADOW_PLUGIN_H_
#include <QVariant>
#include <kis_view_plugin.h>
class KisDropshadowPlugin : public KisViewPlugin
{
Q_OBJECT
public:
KisDropshadowPlugin(QObject *parent, const QVariantList &);
virtual ~KisDropshadowPlugin();
private slots:
void slotDropshadow();
};
#endif
[Desktop Entry]
Name=Dropshadow
Name[bg]=Сянка
Name[bs]=Izbacivanje sjenke
Name[ca]=Gota d'ombra
Name[ca@valencia]=Gota d'ombra
Name[cs]=Vrhat stín
Name[da]=Faldskygge
Name[de]=Schattenwurf
Name[el]=Ρίψη σκιάς
Name[en_GB]=Dropshadow
Name[es]=Sombreado
Name[et]=Varju heitmine
Name[eu]=Itzal paraleloa
Name[fa]=سایه قطره
Name[fi]=DropShadow
Name[fr]=Jet d'ombre
Name[fy]=Skaad sette
Name[gl]=Sombreado
Name[hi]=ड्रॉपशेडो
Name[hne]=ड्रापसेडो
Name[hu]=Ejtett árnyék
Name[is]=Undirskuggi
Name[it]=Getta ombra
Name[ja]=影付け
Name[kk]=ҚөлеңкеТүсіру
Name[ko]=그림자
Name[nb]=Skygge
Name[nds]=Schaddeneffekt
Name[ne]=छायाँ छोड्नुहोस्
Name[nl]=Schaduw plaatsen
Name[pl]=Rzuć cień
Name[pt]=Sombreado
Name[pt_BR]=Sombreado
Name[ru]=Тень
Name[sk]=Tieň
Name[sl]=Senca
Name[sv]=Fallskugga
Name[tr]=Gölgelendir
Name[uk]=Тінь
Name[uz]=Soya tushirish
Name[uz@cyrillic]=Соя тушириш
Name[wa]=Ombion padzo
Name[x-test]=xxDropshadowxx
Name[zh_CN]=阴影
Name[zh_TW]=Dropshadow
X-KDE-ServiceTypes=Krita/ViewPlugin
Type=Service
X-KDE-Library=kritadropshadow
X-Krita-Version=28
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WdgDropshadow</class>
<widget class="QWidget" name="WdgDropshadow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>403</width>
<height>258</height>
</rect>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Offset X:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="textLabel1_2">
<property name="text">
<string>Offset Y:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="textLabel2">
<property name="text">
<string>Blur radius:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="textLabel3">
<property name="text">
<string>Color:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="textLabel4">
<property name="text">
<string>Opacity:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QSlider" name="opacitySlider">
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>80</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QSpinBox" name="opacitySpinBox">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>80</number>
</property>
</widget>
</item>
<item row="5" column="0" colspan="4">
<widget class="QCheckBox" name="allowResizingCheckBox">
<property name="text">
<string>Grow image to make drop shadow fit if needed</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="xOffsetSpinBox">
<property name="minimum">
<number>-99</number>
</property>
<property name="value">
<number>8</number>
</property>
</widget>
</item>
<item row="0" column="2" colspan="2">
<spacer name="spacer7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>200</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="yOffsetSpinBox">
<property name="minimum">
<number>-99</number>
</property>
<property name="value">
<number>8</number>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<spacer name="spacer8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>200</width>
<height>20</height>