diff options
Diffstat (limited to 'chalk/plugins/viewplugins/shearimage')
-rw-r--r-- | chalk/plugins/viewplugins/shearimage/Makefile.am | 25 | ||||
-rw-r--r-- | chalk/plugins/viewplugins/shearimage/chalkshearimage.desktop | 37 | ||||
-rw-r--r-- | chalk/plugins/viewplugins/shearimage/dlg_shearimage.cc | 96 | ||||
-rw-r--r-- | chalk/plugins/viewplugins/shearimage/dlg_shearimage.h | 55 | ||||
-rw-r--r-- | chalk/plugins/viewplugins/shearimage/shearimage.cc | 113 | ||||
-rw-r--r-- | chalk/plugins/viewplugins/shearimage/shearimage.h | 47 | ||||
-rw-r--r-- | chalk/plugins/viewplugins/shearimage/shearimage.rc | 13 | ||||
-rw-r--r-- | chalk/plugins/viewplugins/shearimage/wdg_shearimage.ui | 102 |
8 files changed, 488 insertions, 0 deletions
diff --git a/chalk/plugins/viewplugins/shearimage/Makefile.am b/chalk/plugins/viewplugins/shearimage/Makefile.am new file mode 100644 index 00000000..5f8efe55 --- /dev/null +++ b/chalk/plugins/viewplugins/shearimage/Makefile.am @@ -0,0 +1,25 @@ +chalkrcdir = $(kde_datadir)/chalkplugins +chalkrc_DATA = shearimage.rc + +EXTRA_DIST = $(chalkrc_DATA) + + +INCLUDES = -I$(srcdir)/../../../sdk \ + -I$(srcdir)/../../../core \ + -I$(srcdir)/../../../chalkcolor/ \ + -I$(srcdir)/../../../ui \ + $(KOFFICE_INCLUDES) \ + $(all_includes) + +kde_module_LTLIBRARIES = chalkshearimage.la + +kde_services_DATA = chalkshearimage.desktop + +chalkshearimage_la_SOURCES = wdg_shearimage.ui shearimage.cc dlg_shearimage.cc +noinst_HEADERS = wdg_shearimage.h dlg_shearimage.h shearimage.h + +chalkshearimage_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) chalkblurfilter_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -lkdecore -lkdeui -lkjs -lkdefx -lkio -lkparts -L../../../../chalk/chalkcolor/.libs -lchalkcolor -L../../../../chalk/core/.libs -lchalkimage \ + -L../../../../chalk/ui/.libs -lchalkui -L../../../../lib/kofficeui/.libs -lkofficeui +chalkshearimage_la_LIBADD = ../../../libchalkcommon.la + +chalkshearimage_la_METASOURCES = AUTO diff --git a/chalk/plugins/viewplugins/shearimage/chalkshearimage.desktop b/chalk/plugins/viewplugins/shearimage/chalkshearimage.desktop new file mode 100644 index 00000000..6f3ac5ae --- /dev/null +++ b/chalk/plugins/viewplugins/shearimage/chalkshearimage.desktop @@ -0,0 +1,37 @@ +[Desktop Entry] +Name=Shear Image Plugin +Name[bg]=Приставка за отрязване на изображение +Name[ca]=Connector de tall d'imatge +Name[da]=Plugin for skævvrid billede +Name[de]="Bild scheren"-Modul +Name[el]=Πρόσθετο στρέβλωσης εικόνας +Name[es]=Complemento para cortar la imagen +Name[et]=Pildinihke plugin +Name[fa]=اشتراک وصلۀ تصویر +Name[fr]=Module de rognage d'images +Name[fy]=Ofbylding skeanlûke plugin +Name[gl]=Plugin de Inclinación da Imaxe +Name[hu]=Képnyíró modul +Name[is]=Klippa mynd íforrit +Name[it]=Plugin di distorsione delle immagini +Name[ja]=画像剪断変形プラグイン +Name[km]=កម្មវិធីជំនួយដើម្បីកាត់រូបភាព +Name[nb]=Programtillegg for bildeskjæring +Name[nds]=Bildscheer-Moduul +Name[ne]=छवि प्लगइन अपूर्ण गर्नुहोस् +Name[nl]=Afbeelding schuintrekken +Name[pl]=Wtyczka obcinania obrazków +Name[pt]='Plugin' de Inclinação da Imagem +Name[pt_BR]=Plugin de Inclinação da Imagem +Name[ru]=Сдвиг +Name[sk]=Modul roztrhnutie obrázku +Name[sl]=Vstavek Ostriži sliko +Name[sr]=Прикључак за смицање слике +Name[sr@Latn]=Priključak za smicanje slike +Name[sv]=Insticksprogram för skjuva bild +Name[uk]=Втулок перекошення зображення +Name[zh_TW]=修剪圖片外掛程式 +ServiceTypes=Chalk/ViewPlugin +Type=Service +X-KDE-Library=chalkshearimage +X-Chalk-Version=2 diff --git a/chalk/plugins/viewplugins/shearimage/dlg_shearimage.cc b/chalk/plugins/viewplugins/shearimage/dlg_shearimage.cc new file mode 100644 index 00000000..ff6dadde --- /dev/null +++ b/chalk/plugins/viewplugins/shearimage/dlg_shearimage.cc @@ -0,0 +1,96 @@ +/* + * dlg_shearimage.cc - part of KimageShop^WKrayon^WChalk + * + * Copyright (c) 2004 Michael Thaler <[email protected]> + * + * 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 <config.h> + +#include <math.h> + +#include <iostream> + +using namespace std; + +#include <tqradiobutton.h> +#include <tqcheckbox.h> +#include <tqlabel.h> +#include <tqlayout.h> + +#include <klocale.h> +#include <knuminput.h> +#include <kdebug.h> + +#include "dlg_shearimage.h" +#include "wdg_shearimage.h" + + +DlgShearImage::DlgShearImage( TQWidget * tqparent, + const char * name) + : super (tqparent, name, true, i18n("Shear Image"), Ok | Cancel, Ok) +{ + m_lock = false; + + m_page = new WdgShearImage(this, "shear_image"); + m_page->tqlayout()->setMargin(0); + Q_CHECK_PTR(m_page); + + setMainWidget(m_page); + resize(m_page->tqsizeHint()); + + connect(this, TQT_SIGNAL(okClicked()), + this, TQT_SLOT(okClicked())); + +} + +DlgShearImage::~DlgShearImage() +{ + delete m_page; +} + +void DlgShearImage::setAngleX(TQ_UINT32 angle) +{ + m_page->shearAngleX->setValue(angle); + m_oldAngle = angle; + +} + +void DlgShearImage::setAngleY(TQ_UINT32 angle) +{ + m_page->shearAngleY->setValue(angle); + m_oldAngle = angle; + +} + +TQ_INT32 DlgShearImage::angleX() +{ + return (TQ_INT32)tqRound(m_page->shearAngleX->value()); +} + +TQ_INT32 DlgShearImage::angleY() +{ + return (TQ_INT32)tqRound(m_page->shearAngleY->value()); +} + +// SLOTS + +void DlgShearImage::okClicked() +{ + accept(); +} + +#include "dlg_shearimage.moc" diff --git a/chalk/plugins/viewplugins/shearimage/dlg_shearimage.h b/chalk/plugins/viewplugins/shearimage/dlg_shearimage.h new file mode 100644 index 00000000..5c82abc7 --- /dev/null +++ b/chalk/plugins/viewplugins/shearimage/dlg_shearimage.h @@ -0,0 +1,55 @@ +/* + * dlg_shearimage.h -- part of KimageShop^WKrayon^WChalk + * + * Copyright (c) 2004 Michael Thaler <[email protected]> + * + * 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_SHEARIMAGE +#define DLG_SHEARIMAGE + +#include <kdialogbase.h> + +class WdgShearImage; + +class DlgShearImage: public KDialogBase { + typedef KDialogBase super; + Q_OBJECT + TQ_OBJECT + +public: + + DlgShearImage(TQWidget * tqparent = 0, + const char* name = 0); + ~DlgShearImage(); + + void setAngleX(TQ_UINT32 w); + void setAngleY(TQ_UINT32 w); + TQ_INT32 angleX(); + TQ_INT32 angleY(); + +private slots: + + void okClicked(); + +private: + + WdgShearImage * m_page; + double m_oldAngle; + bool m_lock; + +}; + +#endif // DLG_SHEARIMAGE diff --git a/chalk/plugins/viewplugins/shearimage/shearimage.cc b/chalk/plugins/viewplugins/shearimage/shearimage.cc new file mode 100644 index 00000000..4e7e61d6 --- /dev/null +++ b/chalk/plugins/viewplugins/shearimage/shearimage.cc @@ -0,0 +1,113 @@ +/* + * shearimage.cc -- Part of Chalk + * + * Copyright (c) 2004 Michael Thaler + * + * 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 <math.h> + +#include <stdlib.h> + +#include <tqslider.h> +#include <tqpoint.h> + +#include <klocale.h> +#include <kiconloader.h> +#include <kinstance.h> +#include <kmessagebox.h> +#include <kstandarddirs.h> +#include <ktempfile.h> +#include <kdebug.h> +#include <kgenericfactory.h> + +#include <kis_doc.h> +#include <kis_config.h> +#include <kis_image.h> +#include <kis_layer.h> +#include <kis_global.h> +#include <kis_types.h> +#include <kis_view.h> +#include <kis_selection.h> + +#include "shearimage.h" +#include "dlg_shearimage.h" + +typedef KGenericFactory<ShearImage> ShearImageFactory; +K_EXPORT_COMPONENT_FACTORY( chalkshearimage, ShearImageFactory( "chalk" ) ) + +// XXX: this plugin could also provide layer scaling/resizing +ShearImage::ShearImage(TQObject *tqparent, const char *name, const TQStringList &) + : KParts::Plugin(tqparent, name) +{ + if ( tqparent->inherits("KisView") ) + { + setInstance(ShearImageFactory::instance()); + setXMLFile(locate("data","chalkplugins/shearimage.rc"), true); + + (void) new KAction(i18n("&Shear Image..."), 0, 0, this, TQT_SLOT(slotShearImage()), actionCollection(), "shearimage"); + (void) new KAction(i18n("&Shear Layer..."), 0, 0, this, TQT_SLOT(slotShearLayer()), actionCollection(), "shearlayer"); + + m_view = (KisView*) tqparent; + } +} + +ShearImage::~ShearImage() +{ + m_view = 0; +} + +void ShearImage::slotShearImage() +{ + KisImageSP image = m_view->canvasSubject()->currentImg(); + + if (!image) return; + + DlgShearImage * dlgShearImage = new DlgShearImage(m_view, "ShearImage"); + Q_CHECK_PTR(dlgShearImage); + + dlgShearImage->setCaption(i18n("Shear Image")); + + if (dlgShearImage->exec() == TQDialog::Accepted) { + TQ_INT32 angleX = dlgShearImage->angleX(); + TQ_INT32 angleY = dlgShearImage->angleY(); + m_view->shearCurrentImage(angleX, angleY); + } + delete dlgShearImage; +} + +void ShearImage::slotShearLayer() +{ + KisImageSP image = m_view->canvasSubject()->currentImg(); + + if (!image) return; + + DlgShearImage * dlgShearImage = new DlgShearImage(m_view, "ShearLayer"); + Q_CHECK_PTR(dlgShearImage); + + dlgShearImage->setCaption(i18n("Shear Layer")); + + if (dlgShearImage->exec() == TQDialog::Accepted) { + TQ_INT32 angleX = dlgShearImage->angleX(); + TQ_INT32 angleY = dlgShearImage->angleY(); + m_view->shearLayer(angleX, angleY); + + } + delete dlgShearImage; +} + +#include "shearimage.moc" diff --git a/chalk/plugins/viewplugins/shearimage/shearimage.h b/chalk/plugins/viewplugins/shearimage/shearimage.h new file mode 100644 index 00000000..c824fb51 --- /dev/null +++ b/chalk/plugins/viewplugins/shearimage/shearimage.h @@ -0,0 +1,47 @@ +/* + * shearimage.h -- Part of Chalk + * + * Copyright (c) 2004 Michael Thaler ([email protected]) + * + * 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 SHEARIMAGE_H +#define SHEARIMAGE_H + +#include <kparts/plugin.h> + +class KisView; + +class ShearImage : public KParts::Plugin +{ + Q_OBJECT + TQ_OBJECT +public: + ShearImage(TQObject *tqparent, const char *name, const TQStringList &); + virtual ~ShearImage(); + +private slots: + + void slotShearImage(); + void slotShearLayer(); + +private: + + KisView * m_view; + KisPainter * m_painter; + +}; + +#endif // SHEARIMAGE_H diff --git a/chalk/plugins/viewplugins/shearimage/shearimage.rc b/chalk/plugins/viewplugins/shearimage/shearimage.rc new file mode 100644 index 00000000..8b6cbf1a --- /dev/null +++ b/chalk/plugins/viewplugins/shearimage/shearimage.rc @@ -0,0 +1,13 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui library="chalkshearimage" version="6"> +<MenuBar> + <Menu name="Image"><text>&Image</text> + <Separator/> + <Action name="shearimage"/> + </Menu> + <Menu name="Layer"><text>La&yer</text> + <Separator/> + <Action name="shearlayer"/> + </Menu> +</MenuBar> +</kpartgui> diff --git a/chalk/plugins/viewplugins/shearimage/wdg_shearimage.ui b/chalk/plugins/viewplugins/shearimage/wdg_shearimage.ui new file mode 100644 index 00000000..d63b58f5 --- /dev/null +++ b/chalk/plugins/viewplugins/shearimage/wdg_shearimage.ui @@ -0,0 +1,102 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>WdgShearImage</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>WdgShearImage</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>323</width> + <height>114</height> + </rect> + </property> + <property name="caption"> + <string>Shear Image</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQButtonGroup" row="0" column="0"> + <property name="name"> + <cstring>grpPixelDimensions</cstring> + </property> + <property name="title"> + <string>&Shear Image</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KIntNumInput" row="0" column="1"> + <property name="name"> + <cstring>shearAngleX</cstring> + </property> + <property name="minValue"> + <number>-45</number> + </property> + <property name="maxValue"> + <number>45</number> + </property> + <property name="suffix"> + <string>°</string> + </property> + </widget> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>lblShearAngelY</cstring> + </property> + <property name="text"> + <string>Shear angle Y:</string> + </property> + </widget> + <widget class="KIntNumInput" row="1" column="1"> + <property name="name"> + <cstring>shearAngleY</cstring> + </property> + <property name="tqmaximumSize"> + <size> + <width>32767</width> + <height>100</height> + </size> + </property> + <property name="minValue"> + <number>-45</number> + </property> + <property name="maxValue"> + <number>45</number> + </property> + <property name="suffix"> + <string>°</string> + </property> + </widget> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>lblShearAngleX</cstring> + </property> + <property name="text"> + <string>Shear angle X:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>intWidth</cstring> + </property> + </widget> + </grid> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<tabstops> + <tabstop>shearAngleX</tabstop> +</tabstops> +<tqlayoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> +</includehints> +</UI> |