Commit e4eaa451 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove KisTransformationMask

Unused, dead code -- if we ever want to have proper transformation masks
we'll have to redo the work anyway, so remove the code from Krita to
prevent confusion.
parent a670c5cb
......@@ -171,7 +171,6 @@ set(kritaimage_LIB_SRCS
kis_transform_worker.cc
kis_perspectivetransform_worker.cpp
kis_warptransform_worker.cc
kis_transformation_mask.cpp
kis_transparency_mask.cc
kis_undo_adapter.cc
krita_utils.cpp
......
......@@ -145,9 +145,6 @@ public:
bool visit(KisTransparencyMask*) {
return true;
}
bool visit(KisTransformationMask*) {
return true;
}
bool visit(KisSelectionMask*) {
return true;
}
......
......@@ -97,9 +97,6 @@ public:
bool visit(KisTransparencyMask*) {
return true;
}
bool visit(KisTransformationMask*) {
return true;
}
bool visit(KisSelectionMask*) {
return true;
}
......
......@@ -57,9 +57,6 @@ public:
bool visit(KisTransparencyMask*) {
return true;
}
bool visit(KisTransformationMask*) {
return true;
}
bool visit(KisSelectionMask*) {
return true;
}
......
......@@ -34,7 +34,6 @@
#include "kis_filter_mask.h"
#include "kis_transparency_mask.h"
#include "kis_selection_mask.h"
#include "kis_transformation_mask.h"
#include "generator/kis_generator_layer.h"
/**
* The count visitor traverses the node stack for nodes that conform
......@@ -97,10 +96,6 @@ public:
}
bool visit(KisTransformationMask *mask) {
return check(mask);
}
bool visit(KisGeneratorLayer * layer) {
return check(layer);
}
......
......@@ -29,7 +29,6 @@
#include "kis_paint_layer.h"
#include "kis_adjustment_layer.h"
#include "kis_transformation_mask.h"
#include "kis_transparency_mask.h"
#include "kis_filter_mask.h"
#include "kis_selection_mask.h"
......@@ -105,9 +104,6 @@ public:
bool visit(KisTransparencyMask *mask) {
return cropPaintDeviceNode(mask);
}
bool visit(KisTransformationMask *mask) {
return cropPaintDeviceNode(mask);
}
bool visit(KisSelectionMask *mask) {
return cropPaintDeviceNode(mask);
}
......
......@@ -29,7 +29,6 @@ class KisExternalLayer;
class KisCloneLayer;
class KisFilterMask;
class KisTransparencyMask;
class KisTransformationMask;
class KisSelectionMask;
class KRITAIMAGE_EXPORT KisNodeVisitor
......@@ -57,8 +56,6 @@ public:
virtual bool visit(KisTransparencyMask *mask) = 0;
virtual bool visit(KisTransformationMask *mask) = 0;
virtual bool visit(KisSelectionMask *mask) = 0;
protected:
......
......@@ -115,9 +115,6 @@ public:
bool visit(KisTransparencyMask*) {
return true;
}
bool visit(KisTransformationMask*) {
return true;
}
bool visit(KisSelectionMask*) {
return true;
}
......
......@@ -43,7 +43,6 @@
#include "kis_pixel_selection.h"
#include "kis_transparency_mask.h"
#include "kis_selection_mask.h"
#include "kis_transformation_mask.h"
#include "kis_clone_layer.h"
#include "kis_filter_mask.h"
......@@ -136,10 +135,6 @@ public:
transformMask(mask);
return true;
}
bool visit(KisTransformationMask* mask) {
transformMask(mask);
return true;
}
bool visit(KisSelectionMask* mask) {
transformMask(mask);
return true;
......
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* 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_transformation_mask.h"
#include "kis_selection.h"
#include "kis_paint_device.h"
#include "kis_transform_worker.h"
#include "kis_node_visitor.h"
#include "kis_filter_strategy.h"
#include "QRect"
KisTransformationMask::KisTransformationMask()
: KisEffectMask()
, m_xscale(1.0)
, m_yscale(1.0)
, m_xshear(0)
, m_yshear(0)
, m_rotation(0)
, m_xtranslate(0)
, m_ytranslate(0)
{
Q_ASSERT(KisFilterStrategyRegistry::instance()->keys().count() > 0);
m_filter = KisFilterStrategyRegistry::instance()->get(KisFilterStrategyRegistry::instance()->keys()[0]);
}
KisTransformationMask::~KisTransformationMask()
{
}
bool KisTransformationMask::allowAsChild(KisNodeSP node) const
{
Q_UNUSED(node);
return false;
}
KisTransformationMask::KisTransformationMask(const KisTransformationMask& rhs)
: KisEffectMask(rhs)
{
m_xscale = rhs.m_xscale;
m_yscale = rhs.m_yscale;
m_xshear = rhs.m_xshear;
m_yshear = rhs.m_yshear;
m_rotation = rhs.m_rotation;
m_xtranslate = rhs.m_xtranslate;
m_ytranslate = rhs.m_ytranslate;
m_filter = rhs.m_filter;
}
void KisTransformationMask::apply(KisPaintDeviceSP projection, const QRect & rc) const
{
Q_UNUSED(rc);
/**
* FIXME: What about current selection of the mask?
*/
// Transform
KisTransformWorker worker(projection, m_xscale, m_yscale, m_xshear, m_yshear, 0.0, 0.0, m_rotation, m_xtranslate, m_ytranslate, 0, m_filter);
worker.run();
}
QRect KisTransformationMask::changeRect(const QRect &rect, PositionToFilthy pos) const
{
Q_UNUSED(pos);
//FIXME: selections?
return rect;
}
QRect KisTransformationMask::needRect(const QRect &rect, PositionToFilthy pos) const
{
Q_UNUSED(pos);
//FIXME: selections?
return rect;
}
KisTransformationSettingsCommand::KisTransformationSettingsCommand(KisTransformationMaskSP mask,
const QString & old_name,
double old_xscale,
double old_yscale,
double old_xshear,
double old_yshear,
double old_rotation,
qint32 old_xtranslate,
qint32 old_ytranslate,
KisFilterStrategy * old_filter,
const QString & new_name,
double new_xscale,
double new_yscale,
double new_xshear,
double new_yshear,
double new_rotation,
qint32 new_xtranslate,
qint32 new_ytranslate,
KisFilterStrategy * new_filter)
: KUndo2Command(i18nc("(qtundo-format)", "Transformation Mask Settings"))
, m_mask(mask)
, m_old_name(old_name)
, m_old_xscale(old_xscale)
, m_old_yscale(old_yscale)
, m_old_xshear(old_xshear)
, m_old_yshear(old_yshear)
, m_old_rotation(old_rotation)
, m_old_xtranslate(old_xtranslate)
, m_old_ytranslate(old_ytranslate)
, m_old_filter(old_filter)
, m_new_name(new_name)
, m_new_xscale(new_xscale)
, m_new_yscale(new_yscale)
, m_new_xshear(new_xshear)
, m_new_yshear(new_yshear)
, m_new_rotation(new_rotation)
, m_new_xtranslate(new_xtranslate)
, m_new_ytranslate(new_ytranslate)
, m_new_filter(new_filter)
{
}
void KisTransformationSettingsCommand::redo()
{
m_mask->setName(m_new_name);
m_mask->setXScale(m_new_xscale);
m_mask->setYScale(m_new_yscale);
m_mask->setXShear(m_new_xshear);
m_mask->setYShear(m_new_yshear);
m_mask->setRotation(m_new_rotation);
m_mask->setXTranslation(m_new_xtranslate);
m_mask->setYTranslation(m_new_ytranslate);
m_mask->setFilterStrategy(m_new_filter);
}
void KisTransformationSettingsCommand::undo()
{
m_mask->setName(m_old_name);
m_mask->setXScale(m_old_xscale);
m_mask->setYScale(m_old_yscale);
m_mask->setXShear(m_old_xshear);
m_mask->setYShear(m_old_yshear);
m_mask->setRotation(m_old_rotation);
m_mask->setXTranslation(m_old_xtranslate);
m_mask->setYTranslation(m_old_ytranslate);
m_mask->setFilterStrategy(m_old_filter);
}
bool KisTransformationMask::accept(KisNodeVisitor &v)
{
return v.visit(this);
}
#include "kis_transformation_mask.moc"
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* 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_TRANSFORMATION_MASK_
#define _KIS_TRANSFORMATION_MASK_
#include <kundo2command.h>
#include <klocale.h>
#include "kis_types.h"
#include "kis_effect_mask.h"
#include <kis_filter_strategy.h>
#include <widgets/kis_cmb_idlist.h>
class KisFilterStrategy;
/**
* A transformation mask applies a particular transformation to the
* pixels of a paint device that are selected by the mask paint
* device.
*/
class KRITAIMAGE_EXPORT KisTransformationMask : public KisEffectMask
{
Q_OBJECT
public:
/**
* Create an empty filter mask.
*/
KisTransformationMask();
virtual ~KisTransformationMask();
KisNodeSP clone() const {
return KisNodeSP(new KisTransformationMask(*this));
}
KisTransformationMask(const KisTransformationMask& rhs);
bool allowAsChild(KisNodeSP) const;
void setXScale(double xscale) {
m_xscale = xscale;
}
double xScale() {
return m_xscale;
}
void setYScale(double yscale) {
m_yscale = yscale;
}
double yScale() {
return m_yscale;
}
void setXShear(double xshear) {
m_xshear = xshear;
}
double xShear() {
return m_xshear;
}
void setYShear(double yshear) {
m_yshear = yshear;
}
double yShear() {
return m_yshear;
}
void setRotation(double rotation) {
m_rotation = rotation;
}
double rotation() {
return m_rotation;
}
void setXTranslation(qint32 xtranslate) {
m_xtranslate = xtranslate;
}
qint32 xTranslate() {
return m_xtranslate;
}
void setYTranslation(qint32 ytranslate) {
m_ytranslate = ytranslate;
}
qint32 yTranslate() {
return m_ytranslate;
}
void setFilterStrategy(KisFilterStrategy * filter) {
m_filter = filter;
}
KisFilterStrategy * filterStrategy() {
return m_filter;
}
/**
* Apply the effect the projection using the mask as a selection.
*/
virtual void apply(KisPaintDeviceSP projection, const QRect & rc) const;
QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const;
QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const;
bool accept(KisNodeVisitor &v);
private:
double m_xscale, m_yscale;
double m_xshear, m_yshear;
double m_rotation;
qint32 m_xtranslate, m_ytranslate;
KisFilterStrategy * m_filter;
};
class KRITAIMAGE_EXPORT KisTransformationSettingsCommand : public KUndo2Command
{
public:
/**
*
*/
KisTransformationSettingsCommand(KisTransformationMaskSP mask,
const QString & old_name,
double old_xscale,
double old_yscale,
double old_xshear,
double old_yshear,
double old_rotation,
qint32 old_xtranslate,
qint32 old_ytranslate,
KisFilterStrategy * old_filter,
const QString & new_name,
double new_xscale,
double new_yscale,
double new_xshear,
double new_yshear,
double new_rotation,
qint32 new_xtranslate,
qint32 new_ytranslate,
KisFilterStrategy * new_filter);
virtual void redo();
virtual void undo();
private:
KisTransformationMaskSP m_mask;
QString m_old_name;
double m_old_xscale, m_old_yscale;
double m_old_xshear, m_old_yshear;
double m_old_rotation;
qint32 m_old_xtranslate, m_old_ytranslate;
KisFilterStrategy * m_old_filter;
QString m_new_name;
double m_new_xscale, m_new_yscale;
double m_new_xshear, m_new_yshear;
double m_new_rotation;
qint32 m_new_xtranslate, m_new_ytranslate;
KisFilterStrategy * m_new_filter;
};
#endif //_KIS_TRANSFORMATION_MASK_
......@@ -90,14 +90,6 @@ typedef KisSharedPtrVector<KisTransparencyMask> vKisTransparencyMaskSP;
typedef vKisTransparencyMaskSP::iterator vKisTransparencyMaskSP_it;
typedef vKisTransparencyMaskSP::const_iterator vKisTransparencyMaskSP_cit;
class KisTransformationMask;
typedef KisSharedPtr<KisTransformationMask> KisTransformationMaskSP;
typedef KisWeakSharedPtr<KisTransformationMask> KisTransformationMaskWSP;
typedef KisSharedPtrVector<KisTransformationMask> vKisTransformationMaskSP;
typedef vKisTransformationMaskSP::iterator vKisTransformationMaskSP_it;
typedef vKisTransformationMaskSP::const_iterator vKisTransformationMaskSP_cit;
class KisLayer;
typedef KisSharedPtr<KisLayer> KisLayerSP;
typedef KisWeakSharedPtr<KisLayer> KisLayerWSP;
......
......@@ -47,9 +47,6 @@ public:
bool visit(KisTransparencyMask*) {
return true;
}
bool visit(KisTransformationMask*) {
return true;
}
bool visit(KisSelectionMask*) {
return true;
}
......
......@@ -466,12 +466,6 @@ target_link_libraries(KisShearVisitorTest ${KDE4_KDEUI_LIBS} kritaimage ${QT_QT
########### next target ###############
set(kis_transformation_mask_test_SRCS kis_transformation_mask_test.cpp )
kde4_add_unit_test(KisTransformationMaskTest TESTNAME krita-image-KisTransformationMaskTest ${kis_transformation_mask_test_SRCS})
target_link_libraries(KisTransformationMaskTest ${KDE4_KDEUI_LIBS} kritaimage ${QT_QTTEST_LIBRARY})
########### next target ###############
set(kis_transform_visitor_test_SRCS kis_transform_visitor_test.cpp )
kde4_add_unit_test(KisTransformVisitorTest TESTNAME krita-image-KisTransformVisitorTest ${kis_transform_visitor_test_SRCS})
target_link_libraries(KisTransformVisitorTest ${KDE4_KDEUI_LIBS} kritaimage ${QT_QTTEST_LIBRARY})
......
......@@ -65,10 +65,6 @@ public:
return true;
}
bool visit(KisTransformationMask */*mask*/) {
return true;
}
bool visit(KisSelectionMask */*mask*/) {
return true;
}
......
/*
* Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org
*
* 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_transformation_mask_test.h"
#include <qtest_kde.h>
#include "kis_transformation_mask.h"
void KisTransformationMaskTest::testCreation()
{
KisTransformationMask test;
}
QTEST_KDEMAIN(KisTransformationMaskTest, GUI)
#include "kis_transformation_mask_test.moc"
/*
* Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org
*
* 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_TRANSFORMATION_MASK_TEST_H
#define KIS_TRANSFORMATION_MASK_TEST_H
#include <QtTest/QtTest>
class KisTransformationMaskTest : public QObject
{
Q_OBJECT
private slots:
void testCreation();
};
#endif
......@@ -58,9 +58,6 @@ public:
bool visit(KisTransparencyMask*) {
return true;
}
bool visit(KisTransformationMask*) {
return true;
}
bool visit(KisSelectionMask*) {
return true;
}
......
......@@ -38,7 +38,6 @@ set(kritaui_LIB_SRCS
dialogs/kis_dlg_image_properties.cc
dialogs/kis_dlg_layer_properties.cc
dialogs/kis_dlg_preferences.cc
dialogs/kis_dlg_transformation_effect.cpp
flake/kis_layer_container_shape.cc
flake/kis_node_shape.cpp
flake/kis_shape_controller.cpp
......@@ -215,7 +214,6 @@ kde4_add_ui_files(kritaui_LIB_SRCS
forms/wdgshapeoptions.ui
forms/wdgnewimage.ui
forms/wdgimageproperties.ui
forms/wdgtransformationeffect.ui
forms/wdgmaskfromselection.ui
forms/wdgmasksource.ui
forms/wdgfilterdialog.ui
......