[krita/krita-grids-kazakov] /: Removed the perspective grid tool. Use Perspective assistant instead.

Boudewijn Rempt boud at valdyas.org
Thu Mar 3 16:29:51 UTC 2016


On Wed, 2 Mar 2016, Dmitry Kazakov wrote:

> Git commit 4083489bc4e645830f7b0b75cdc3aa995db5c122 by Dmitry Kazakov.
> Committed on 02/03/2016 at 08:46.
> Pushed by dkazakov into branch 'krita-grids-kazakov'.
>
> Removed the perspective grid tool. Use Perspective assistant instead.
>
> There is still an undecided part. Should we keep the Perspective
> Correction feature of the Clone Brush? It is the only thing that
> depended from the old tool, and I'm not sure if it was used by someone.

Yes, we should, or put it on a todo to really rewrite perspective cloning in a really usable way. It's an important feature for matte artists, but because our implementation was so proof-of-concept, I doubt it got used a lot.

> Porting of it might take up to 4 hours of work, should I do it or I
> should better spend this time on Grids snapping?

Not right now, I'd say.

>
> CC:kimageshop at kde.org
>
> M  +0    -1    libs/image/CMakeLists.txt
> M  +0    -7    libs/image/kis_image.cc
> M  +0    -6    libs/image/kis_image.h
> D  +0    -321  libs/image/kis_perspective_grid.cpp
> D  +0    -138  libs/image/kis_perspective_grid.h
> M  +0    -6    libs/image/tests/CMakeLists.txt
> D  +0    -30   libs/image/tests/kis_perspective_grid_test.cpp
> D  +0    -33   libs/image/tests/kis_perspective_grid_test.h
> M  +0    -2    libs/ui/CMakeLists.txt
> M  +0    -12   libs/ui/KisViewManager.cpp
> M  +0    -2    libs/ui/KisViewManager.h
> D  +0    -255  libs/ui/canvas/kis_perspective_grid_decoration.cpp
> D  +0    -54   libs/ui/canvas/kis_perspective_grid_decoration.h
> D  +0    -127  libs/ui/canvas/kis_perspective_grid_manager.cpp
> D  +0    -72   libs/ui/canvas/kis_perspective_grid_manager.h
> M  +0    -1    libs/ui/canvas/kis_qpainter_canvas.cpp
> M  +29   -29   plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.cpp
> M  +1    -2    plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_option.cpp
> M  +1    -1    plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.cpp
> M  +0    -1    plugins/tools/CMakeLists.txt
> D  +0    -14   plugins/tools/tool_perspectivegrid/CMakeLists.txt
> D  +0    -6    plugins/tools/tool_perspectivegrid/KisToolPerspectiveGrid.action
> D  +0    -393  plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.cc
> D  +0    -113  plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.h
> D  +0    -9    plugins/tools/tool_perspectivegrid/kritatoolperspectivegrid.json
> D  +0    -51   plugins/tools/tool_perspectivegrid/tool_perspectivegrid.cc
> D  +0    -36   plugins/tools/tool_perspectivegrid/tool_perspectivegrid.h
> D  +0    -6    plugins/tools/tool_perspectivegrid/tool_perspectivegrid.qrc
> D  +-    --    plugins/tools/tool_perspectivegrid/tool_perspectivegrid_cursor.png
>
> http://commits.kde.org/krita/4083489bc4e645830f7b0b75cdc3aa995db5c122
>
> diff --git a/libs/image/CMakeLists.txt b/libs/image/CMakeLists.txt
> index a224d7e..d4309e0 100644
> --- a/libs/image/CMakeLists.txt
> +++ b/libs/image/CMakeLists.txt
> @@ -207,7 +207,6 @@ set(kritaimage_LIB_SRCS
>    kis_paint_device_debug_utils.cpp
>    kis_fixed_paint_device.cpp
>    kis_paint_layer.cc
> -   kis_perspective_grid.cpp
>    kis_perspective_math.cpp
>    kis_pixel_selection.cpp
>    kis_processing_information.cpp
> diff --git a/libs/image/kis_image.cc b/libs/image/kis_image.cc
> index 0fdc341..8d93d87 100644
> --- a/libs/image/kis_image.cc
> +++ b/libs/image/kis_image.cc
> @@ -53,7 +53,6 @@
> #include "kis_name_server.h"
> #include "kis_paint_layer.h"
> #include "kis_painter.h"
> -#include "kis_perspective_grid.h"
> #include "kis_selection.h"
> #include "kis_transaction.h"
> #include "kis_meta_data_merge_strategy.h"
> @@ -136,7 +135,6 @@ public:
>     KisImage *q;
>
>     quint32 lockCount = 0;
> -    KisPerspectiveGrid perspectiveGrid;
>
>     qint32 width;
>     qint32 height;
> @@ -1119,11 +1117,6 @@ void KisImage::notifyAboutToBeDeleted()
>     emit sigAboutToBeDeleted();
> }
>
> -KisPerspectiveGrid* KisImage::perspectiveGrid()
> -{
> -    return &m_d->perspectiveGrid;
> -}
> -
> KisImageSignalRouter* KisImage::signalRouter()
> {
>     return &m_d->signalRouter;
> diff --git a/libs/image/kis_image.h b/libs/image/kis_image.h
> index 8e55ba5..141019d 100644
> --- a/libs/image/kis_image.h
> +++ b/libs/image/kis_image.h
> @@ -49,7 +49,6 @@ class KisImageSignalRouter;
> class KisPostExecutionUndoAdapter;
> class KisFilterStrategy;
> class KoColorProfile;
> -class KisPerspectiveGrid;
> class KisLayerComposition;
> class KisSpontaneousJob;
> class KisImageAnimationInterface;
> @@ -154,11 +153,6 @@ public:
>     void rollBackLayerName();
>
>     /**
> -     * @return the perspective grid associated to this image
> -     */
> -    KisPerspectiveGrid* perspectiveGrid();
> -
> -    /**
>      * Resize the image to the specified rect. The resize
>      * method handles the creating on an undo step itself.
>      *
> diff --git a/libs/image/kis_perspective_grid.cpp b/libs/image/kis_perspective_grid.cpp
> deleted file mode 100644
> index 6a7b803..0000000
> --- a/libs/image/kis_perspective_grid.cpp
> +++ /dev/null
> @@ -1,321 +0,0 @@
> -/*
> - * This file is part of Krita
> - *
> - *  Copyright (c) 2006,2008 Cyrille Berger <cberger at 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 "kis_perspective_grid.h"
> -#include <kis_debug.h>
> -
> -//--------------------------------------------//
> -//---------- KisPerspectiveGridNode ----------//
> -//--------------------------------------------//
> -
> -struct Q_DECL_HIDDEN KisPerspectiveGridNode::Private {
> -    QList<KisSubPerspectiveGrid*> subGrids;
> -};
> -
> -KisPerspectiveGridNode::KisPerspectiveGridNode(double x, double y) : QPointF(x, y), d(new Private)
> -{
> -}
> -KisPerspectiveGridNode::KisPerspectiveGridNode(QPointF p) : QPointF(p), d(new Private)
> -{
> -}
> -
> -KisPerspectiveGridNode::KisPerspectiveGridNode(const KisPerspectiveGridNode& rhs)
> -    : QPointF(rhs)
> -    , KisShared()
> -    , d(new Private())
> -{
> -}
> -
> -KisPerspectiveGridNode::~KisPerspectiveGridNode()
> -{
> -    Q_ASSERT(d->subGrids.empty());
> -    delete d;
> -}
> -
> -void KisPerspectiveGridNode::registerSubPerspectiveGrid(KisSubPerspectiveGrid* grid)
> -{
> -    Q_ASSERT(!d->subGrids.contains(grid));
> -    d->subGrids.append(grid);
> -}
> -
> -void KisPerspectiveGridNode::unRegisterSubPerspectiveGrid(KisSubPerspectiveGrid* grid)
> -{
> -    d->subGrids.removeAll(grid);
> -}
> -
> -bool KisPerspectiveGridNode::containsSubPerspectiveGrid(KisSubPerspectiveGrid* grid)
> -{
> -    return d->subGrids.contains(grid);
> -}
> -
> -void KisPerspectiveGridNode::mergeWith(KisPerspectiveGridNodeSP node)
> -{
> -    if(node==0) return;
> -
> -    Q_FOREACH (KisSubPerspectiveGrid* grid, node->d->subGrids) {
> -        if (grid->topLeft() == node) {
> -            grid->setTopLeft(this);
> -        }
> -        if (grid->topRight() == node) {
> -            grid->setTopRight(this);
> -        }
> -        if (grid->bottomLeft() == node) {
> -            grid->setBottomLeft(this);
> -        }
> -        if (grid->bottomRight() == node) {
> -            grid->setBottomRight(this);
> -        }
> -    }
> -}
> -
> -//-------------------------------------------//
> -//---------- KisSubPerspectiveGrid ----------//
> -//-------------------------------------------//
> -
> -struct KisSubPerspectiveGrid::Private {
> -    KisPerspectiveGridNodeSP topLeft, topRight, bottomLeft, bottomRight;
> -    int subdivisions;
> -    int index;
> -    static int s_lastIndex;
> -};
> -
> -int KisSubPerspectiveGrid::Private::s_lastIndex = 0;
> -
> -KisSubPerspectiveGrid::KisSubPerspectiveGrid(KisPerspectiveGridNodeSP topLeft, KisPerspectiveGridNodeSP topRight, KisPerspectiveGridNodeSP bottomRight, KisPerspectiveGridNodeSP bottomLeft)
> -        : d(new Private)
> -{
> -    setTopLeft(topLeft);
> -    setTopRight(topRight);
> -    setBottomLeft(bottomLeft);
> -    setBottomRight(bottomRight);
> -    Q_ASSERT(d->topLeft == topLeft);
> -    Q_ASSERT(d->topRight == topRight);
> -    Q_ASSERT(d->bottomLeft == bottomLeft);
> -    Q_ASSERT(d->bottomRight == bottomRight);
> -    d->subdivisions = 5;
> -    d->index = ++Private::s_lastIndex;
> -}
> -
> -KisSubPerspectiveGrid::~KisSubPerspectiveGrid()
> -{
> -    d->topLeft->unRegisterSubPerspectiveGrid(this);
> -    d->topRight->unRegisterSubPerspectiveGrid(this);
> -    d->bottomLeft->unRegisterSubPerspectiveGrid(this);
> -    d->bottomRight->unRegisterSubPerspectiveGrid(this);
> -    delete d;
> -}
> -
> -QPointF KisSubPerspectiveGrid::computeVanishingPoint(KisPerspectiveGridNodeSP p11, KisPerspectiveGridNodeSP p12, KisPerspectiveGridNodeSP p21, KisPerspectiveGridNodeSP p22)
> -{
> -    return toQPointF(LineEquation::Through(toKisVector2D(*p11), toKisVector2D(*p12))
> -                     .intersection(LineEquation::Through(toKisVector2D(*p21), toKisVector2D(*p22))));
> -}
> -
> -bool KisSubPerspectiveGrid::contains(const QPointF p) const
> -{
> -    Q_UNUSED(p);
> -    return true;
> -#if 0
> -    KisPerspectiveMath::LineEquation d1 = KisPerspectiveMath::computeLineEquation(topLeft().data(), topRight().data());
> -//     dbgImage << p.y() <<"" << (p.x() * d1.a + d1.b);
> -    if (p.y() >= p.x() * d1.a + d1.b) {
> -        d1 = KisPerspectiveMath::computeLineEquation(topRight().data(), bottomRight().data());
> -//         dbgImage << p.y() <<"" << (p.x() * d1.a + d1.b);
> -        if (p.y() >= p.x() * d1.a + d1.b) {
> -            d1 = KisPerspectiveMath::computeLineEquation(bottomRight().data(), bottomLeft().data());
> -//             dbgImage << p.y() <<"" << (p.x() * d1.a + d1.b);
> -            if (p.y() <= p.x() * d1.a + d1.b) {
> -                d1 = KisPerspectiveMath::computeLineEquation(bottomLeft().data(), topLeft().data());
> -//                 dbgImage << p.y() <<"" << (p.x() * d1.a + d1.b);
> -                if (p.y() <= p.x() * d1.a + d1.b) {
> -                    return true;
> -                }
> -            }
> -        }
> -    }
> -    return false;
> -#endif
> -}
> -
> -QPointF KisSubPerspectiveGrid::center() const
> -{
> -    return 0.25 *(*d->topLeft + *d->topRight + *d->bottomLeft + *d->bottomRight);
> -}
> -
> -int KisSubPerspectiveGrid::index() const
> -{
> -    return d->index;
> -}
> -
> -QPointF KisSubPerspectiveGrid::topBottomVanishingPoint()
> -{
> -    return computeVanishingPoint(topLeft(), topRight(), bottomLeft(), bottomRight());
> -}
> -
> -QPointF KisSubPerspectiveGrid::leftRightVanishingPoint()
> -{
> -    return computeVanishingPoint(topLeft(), bottomLeft(), topRight(), bottomRight());
> -}
> -
> -const KisPerspectiveGridNodeSP KisSubPerspectiveGrid::topLeft() const
> -{
> -    return d->topLeft;
> -}
> -
> -KisPerspectiveGridNodeSP KisSubPerspectiveGrid::topLeft()
> -{
> -    return d->topLeft;
> -}
> -
> -void KisSubPerspectiveGrid::setTopLeft(KisPerspectiveGridNodeSP node)
> -{
> -    if (node->containsSubPerspectiveGrid(this)) return;
> -    if (d->topLeft) d->topLeft->unRegisterSubPerspectiveGrid(this);
> -    d->topLeft = node;
> -    d->topLeft->registerSubPerspectiveGrid(this);
> -}
> -
> -const KisPerspectiveGridNodeSP KisSubPerspectiveGrid::topRight() const
> -{
> -    return d->topRight;
> -}
> -
> -KisPerspectiveGridNodeSP KisSubPerspectiveGrid::topRight()
> -{
> -    return d->topRight;
> -}
> -
> -void KisSubPerspectiveGrid::setTopRight(KisPerspectiveGridNodeSP node)
> -{
> -    if (node->containsSubPerspectiveGrid(this)) return;
> -    if (d->topRight) d->topRight->unRegisterSubPerspectiveGrid(this);
> -    d->topRight = node;
> -    d->topRight->registerSubPerspectiveGrid(this);
> -}
> -
> -const KisPerspectiveGridNodeSP KisSubPerspectiveGrid::bottomLeft() const
> -{
> -    return d->bottomLeft;
> -}
> -
> -KisPerspectiveGridNodeSP KisSubPerspectiveGrid::bottomLeft()
> -{
> -    return d->bottomLeft;
> -}
> -
> -void KisSubPerspectiveGrid::setBottomLeft(KisPerspectiveGridNodeSP node)
> -{
> -    if (node->containsSubPerspectiveGrid(this)) return;
> -    if (d->bottomLeft) d->bottomLeft->unRegisterSubPerspectiveGrid(this);
> -    d->bottomLeft = node;
> -    d->bottomLeft->registerSubPerspectiveGrid(this);
> -}
> -
> -const KisPerspectiveGridNodeSP KisSubPerspectiveGrid::bottomRight() const
> -{
> -    return d->bottomRight;
> -}
> -
> -KisPerspectiveGridNodeSP KisSubPerspectiveGrid::bottomRight()
> -{
> -    return d->bottomRight;
> -}
> -
> -void KisSubPerspectiveGrid::setBottomRight(KisPerspectiveGridNodeSP node)
> -{
> -    if (node->containsSubPerspectiveGrid(this)) return;
> -    if (d->bottomRight) d->bottomRight->unRegisterSubPerspectiveGrid(this);
> -    d->bottomRight = node;
> -    d->bottomRight->registerSubPerspectiveGrid(this);
> -}
> -
> -int KisSubPerspectiveGrid::subdivisions() const
> -{
> -    return d->subdivisions;
> -}
> -
> -//------------------------------------------//
> -//----------- KisPerspectiveGrid -----------//
> -//------------------------------------------//
> -
> -struct Q_DECL_HIDDEN KisPerspectiveGrid::Private {
> -    QList<KisSubPerspectiveGrid*> subGrids;
> -};
> -
> -KisPerspectiveGrid::KisPerspectiveGrid() : d(new Private)
> -{
> -}
> -
> -
> -KisPerspectiveGrid::~KisPerspectiveGrid()
> -{
> -    clearSubGrids();
> -    delete d;
> -}
> -
> -bool KisPerspectiveGrid::addNewSubGrid(KisSubPerspectiveGrid* ng)
> -{
> -    d->subGrids.push_back(ng);
> -    return true;
> -}
> -
> -void KisPerspectiveGrid::deleteSubGrid(KisSubPerspectiveGrid* grid)
> -{
> -    d->subGrids.removeAll(grid);
> -    delete grid;
> -}
> -
> -void KisPerspectiveGrid::clearSubGrids()
> -{
> -    for (QList<KisSubPerspectiveGrid*>::const_iterator it = begin(); it != end(); ++it) {
> -        delete *it;
> -    }
> -    d->subGrids.clear();
> -}
> -
> -KisSubPerspectiveGrid* KisPerspectiveGrid::gridAt(QPointF p)
> -{
> -    for (QList<KisSubPerspectiveGrid*>::const_iterator it = begin(); it != end(); ++it) {
> -        if ((*it)->contains(p)) {
> -            return *it;
> -        }
> -    }
> -    return 0;
> -}
> -
> -QList<KisSubPerspectiveGrid*>::const_iterator KisPerspectiveGrid::begin() const
> -{
> -    return d->subGrids.constBegin();
> -}
> -
> -QList<KisSubPerspectiveGrid*>::const_iterator KisPerspectiveGrid::end() const
> -{
> -    return d->subGrids.constEnd();
> -}
> -
> -bool KisPerspectiveGrid::hasSubGrids() const
> -{
> -    return !d->subGrids.isEmpty();
> -}
> -
> -int KisPerspectiveGrid::countSubGrids() const
> -{
> -    return d->subGrids.size();
> -}
> diff --git a/libs/image/kis_perspective_grid.h b/libs/image/kis_perspective_grid.h
> deleted file mode 100644
> index 91a1840..0000000
> --- a/libs/image/kis_perspective_grid.h
> +++ /dev/null
> @@ -1,138 +0,0 @@
> -/*
> - * This file is part of Krita
> - *
> - *  Copyright (c) 2006 Cyrille Berger <cberger at 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.
> - */
> -
> -#ifndef KIS_PERSPECTIVE_GRID_H
> -#define KIS_PERSPECTIVE_GRID_H
> -
> -#include <QList>
> -#include <QPointF>
> -
> -#include <kis_perspective_math.h>
> -#include <kis_shared.h>
> -#include <kis_shared_ptr.h>
> -#include <kritaimage_export.h>
> -
> -class KisPerspectiveGridNode;
> -typedef KisSharedPtr<KisPerspectiveGridNode> KisPerspectiveGridNodeSP;
> -class KisSubPerspectiveGrid;
> -
> -/**
> - * This class is the corner of sub perspective grid, it can be shared between various grid.
> - */
> -class KRITAIMAGE_EXPORT KisPerspectiveGridNode : public QPointF, public KisShared
> -{
> -    friend class KisSubPerspectiveGrid;
> -public:
> -    KisPerspectiveGridNode(double x, double y);
> -    KisPerspectiveGridNode(QPointF p);
> -    KisPerspectiveGridNode(const KisPerspectiveGridNode&);
> -    ~KisPerspectiveGridNode();
> -    void mergeWith(KisPerspectiveGridNodeSP);
> -private:
> -    void registerSubPerspectiveGrid(KisSubPerspectiveGrid*);
> -    void unRegisterSubPerspectiveGrid(KisSubPerspectiveGrid*);
> -    bool containsSubPerspectiveGrid(KisSubPerspectiveGrid*);
> -private:
> -    struct Private;
> -    Private* const d;
> -};
> -
> -/**
> - * This class contains the information of a sub perspective grid.
> - */
> -class KRITAIMAGE_EXPORT KisSubPerspectiveGrid
> -{
> -public:
> -    KisSubPerspectiveGrid(KisPerspectiveGridNodeSP topLeft, KisPerspectiveGridNodeSP topRight, KisPerspectiveGridNodeSP bottomRight, KisPerspectiveGridNodeSP bottomLeft);
> -    ~KisSubPerspectiveGrid();
> -
> -    QPointF topBottomVanishingPoint();
> -    QPointF leftRightVanishingPoint();
> -
> -    /**
> -     * @return the top left corner of the grid
> -     */
> -    const KisPerspectiveGridNodeSP topLeft() const;
> -    KisPerspectiveGridNodeSP topLeft();
> -    void setTopLeft(KisPerspectiveGridNodeSP);
> -    const KisPerspectiveGridNodeSP topRight() const;
> -    KisPerspectiveGridNodeSP topRight();
> -    void setTopRight(KisPerspectiveGridNodeSP);
> -    const KisPerspectiveGridNodeSP bottomLeft() const;
> -    KisPerspectiveGridNodeSP bottomLeft();
> -    void setBottomLeft(KisPerspectiveGridNodeSP);
> -    const KisPerspectiveGridNodeSP bottomRight() const;
> -    KisPerspectiveGridNodeSP bottomRight();
> -    void setBottomRight(KisPerspectiveGridNodeSP);
> -    int subdivisions() const;
> -
> -    /**
> -     * @return the center of the sub perspective grid
> -     */
> -    QPointF center() const;
> -
> -    /**
> -     * Return the index of the subgrid, the value is automatically set when the KisSubPerspectiveGrid, it is useful for
> -     * drawing the perspective grid, to avoid drawing twice the same border, or points
> -     */
> -    int index() const;
> -
> -    /**
> -     * @return true if the point p is contain by the grid
> -     */
> -    bool contains(const QPointF p) const;
> -private:
> -    inline QPointF computeVanishingPoint(KisPerspectiveGridNodeSP p11, KisPerspectiveGridNodeSP p12, KisPerspectiveGridNodeSP p21, KisPerspectiveGridNodeSP p22);
> -private:
> -    struct Private;
> -    Private* const d;
> -};
> -
> -/**
> - * This class contains the list of sub perspective grid
> - */
> -class KRITAIMAGE_EXPORT KisPerspectiveGrid
> -{
> -public:
> -    KisPerspectiveGrid();
> -    ~KisPerspectiveGrid();
> -    /**
> -     * @return false if the grid wasn't added, note that subgrids must be attached to an other grid, except if it's the first grid
> -     */
> -    bool addNewSubGrid(KisSubPerspectiveGrid* ng);
> -    QList<KisSubPerspectiveGrid*>::const_iterator begin() const;
> -    QList<KisSubPerspectiveGrid*>::const_iterator end() const;
> -    bool hasSubGrids() const;
> -    void clearSubGrids();
> -    int countSubGrids() const;
> -    /**
> -     * Delete the grid given as argument and remove it from the list of grids.
> -     */
> -    void deleteSubGrid(KisSubPerspectiveGrid* grid);
> -    /**
> -     * @return the first grid hit by the point p
> -     */
> -    KisSubPerspectiveGrid* gridAt(QPointF p);
> -private:
> -    struct Private;
> -    Private* const d;
> -};
> -
> -#endif
> diff --git a/libs/image/tests/CMakeLists.txt b/libs/image/tests/CMakeLists.txt
> index e38bdce..c5b31bd 100644
> --- a/libs/image/tests/CMakeLists.txt
> +++ b/libs/image/tests/CMakeLists.txt
> @@ -439,12 +439,6 @@ kde4_add_unit_test(KoPatternTest TESTNAME krita-image-KoPatternTest ${kis_patter
> target_link_libraries(KoPatternTest   kritaimage Qt5::Test)
>
> ########### next target ###############
> -# commented out because it depends on ui???
> -#set(kis_perspective_grid_test_SRCS kis_perspective_grid_test.cpp )
> -#kde4_add_unit_test(KisPerspectiveGridTest TESTNAME krita-image-KisPerspectiveGridTest ${kis_perspective_grid_test_SRCS})
> -#target_link_libraries(KisPerspectiveGridTest   kritaimage Qt5::Test)
> -
> -########### next target ###############
>
> set(kis_recorded_action_factory_registry_test_SRCS kis_recorded_action_factory_registry_test.cpp )
> kde4_add_unit_test(KisRecordedActionFactoryRegistryTest TESTNAME krita-image-KisRecordedActionFactoryRegistryTest ${kis_recorded_action_factory_registry_test_SRCS})
> diff --git a/libs/image/tests/kis_perspective_grid_test.cpp b/libs/image/tests/kis_perspective_grid_test.cpp
> deleted file mode 100644
> index db6e56d..0000000
> --- a/libs/image/tests/kis_perspective_grid_test.cpp
> +++ /dev/null
> @@ -1,30 +0,0 @@
> -/*
> - *  Copyright (c) 2007 Boudewijn Rempt boud at 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_perspective_grid_test.h"
> -
> -#include <QTest>
> -#include "kis_perspective_grid.h"
> -
> -void KisPerspectiveGridTest::testCreation()
> -{
> -    KisPerspectiveGrid test;
> -}
> -
> -
> -QTEST_MAIN(KisPerspectiveGridTest)
> diff --git a/libs/image/tests/kis_perspective_grid_test.h b/libs/image/tests/kis_perspective_grid_test.h
> deleted file mode 100644
> index 53ecc50..0000000
> --- a/libs/image/tests/kis_perspective_grid_test.h
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -/*
> - *  Copyright (c) 2007 Boudewijn Rempt boud at 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_PERSPECTIVE_GRID_TEST_H
> -#define KIS_PERSPECTIVE_GRID_TEST_H
> -
> -#include <QtTest>
> -
> -class KisPerspectiveGridTest : public QObject
> -{
> -    Q_OBJECT
> -private Q_SLOTS:
> -
> -    void testCreation();
> -
> -};
> -
> -#endif
> diff --git a/libs/ui/CMakeLists.txt b/libs/ui/CMakeLists.txt
> index 3c97968..f2acb09 100644
> --- a/libs/ui/CMakeLists.txt
> +++ b/libs/ui/CMakeLists.txt
> @@ -56,8 +56,6 @@ set(kritaui_LIB_SRCS
>     canvas/kis_grid_manager.cpp
>     canvas/kis_grid_decoration.cpp
>     canvas/kis_grid_config.cpp
> -    canvas/kis_perspective_grid_manager.cpp
> -    canvas/kis_perspective_grid_decoration.cpp
>     canvas/kis_prescaled_projection.cpp
>     canvas/kis_qpainter_canvas.cpp
>     canvas/kis_projection_backend.cpp
> diff --git a/libs/ui/KisViewManager.cpp b/libs/ui/KisViewManager.cpp
> index 854ce33..ad42daf 100644
> --- a/libs/ui/KisViewManager.cpp
> +++ b/libs/ui/KisViewManager.cpp
> @@ -75,7 +75,6 @@
> #include "canvas/kis_canvas2.h"
> #include "canvas/kis_canvas_controller.h"
> #include "canvas/kis_grid_manager.h"
> -#include "canvas/kis_perspective_grid_manager.h"
> #include "dialogs/kis_dlg_blacklist_cleanup.h"
> #include "input/kis_input_profile_manager.h"
> #include "kis_action_manager.h"
> @@ -172,7 +171,6 @@ public:
>         , imageManager(_q)
>         , gridManager(_q)
>         , canvasControlsManager(_q)
> -        , perspectiveGridManager(_q)
>         , paintingAssistantsManager(_q)
>         , actionManager(_q)
>         , mainWindow(0)
> @@ -213,7 +211,6 @@ public:
>     KisImageManager imageManager;
>     KisGridManager gridManager;
>     KisCanvasControlsManager canvasControlsManager;
> -    KisPerspectiveGridManager  perspectiveGridManager;
>     KisPaintingAssistantsManager paintingAssistantsManager;
>     BlockingUserInputEventFilter blockingEventFilter;
>     KisActionManager actionManager;
> @@ -375,7 +372,6 @@ void KisViewManager::setCurrentView(KisView *view)
>     d->gridManager.setView(imageView);
>     d->statusBar.setView(imageView);
>     d->paintingAssistantsManager.setView(imageView);
> -    d->perspectiveGridManager.setView(imageView);
>     d->mirrorManager.setView(imageView);
>
>     if (d->currentImageView) {
> @@ -649,8 +645,6 @@ void KisViewManager::setupManagers()
>
>     d->gridManager.setup(actionManager());
>
> -    d->perspectiveGridManager.setup(actionCollection());
> -
>     d->paintingAssistantsManager.setup(actionManager());
>
>     d->canvasControlsManager.setup(actionManager());
> @@ -680,11 +674,6 @@ KisActionManager* KisViewManager::actionManager() const
>     return &d->actionManager;
> }
>
> -KisPerspectiveGridManager* KisViewManager::perspectiveGridManager() const
> -{
> -    return &d->perspectiveGridManager;
> -}
> -
> KisGridManager * KisViewManager::gridManager() const
> {
>     return &d->gridManager;
> @@ -1131,7 +1120,6 @@ void KisViewManager::guiUpdateTimeout()
>         zoomManager()->updateGUI();
>     }
>     d->gridManager.updateGUI();
> -    d->perspectiveGridManager.updateGUI();
>     d->actionManager.updateGUI();
> }
>
> diff --git a/libs/ui/KisViewManager.h b/libs/ui/KisViewManager.h
> index d80af4b..0b3a431 100644
> --- a/libs/ui/KisViewManager.h
> +++ b/libs/ui/KisViewManager.h
> @@ -44,7 +44,6 @@ class KisImageManager;
> class KisNodeManager;
> class KisPaintingAssistantsManager;
> class KisPaintopBox;
> -class KisPerspectiveGridManager;
> class KisSelectionManager;
> class KisStatusBar;
> class KisUndoAdapter;
> @@ -168,7 +167,6 @@ public:  // Krita specific interfaces
> public:
>
>     KisGridManager * gridManager() const;
> -    KisPerspectiveGridManager* perspectiveGridManager() const;
>     KisPaintingAssistantsManager* paintingAssistantsManager() const;
>
>     /// disable and enable toolbar controls. used for disabling them during painting.
> diff --git a/libs/ui/canvas/kis_perspective_grid_decoration.cpp b/libs/ui/canvas/kis_perspective_grid_decoration.cpp
> deleted file mode 100644
> index 34da5bb3..0000000
> --- a/libs/ui/canvas/kis_perspective_grid_decoration.cpp
> +++ /dev/null
> @@ -1,255 +0,0 @@
> -/*
> - * This file is part of Krita
> - *
> - *  Copyright (c) 2006,2008 Cyrille Berger <cberger at cberger.net>
> - *  Copyright (c) 2014 Sven Langkamp <sven.langkamp at gmail.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 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_perspective_grid_decoration.h"
> -
> -#include <QPainter>
> -
> -#include <klocalizedstring.h>
> -#include "kis_perspective_grid.h"
> -#include "KisView.h"
> -#include "kis_grid_config.h"
> -
> -/***************************************************************/
> -/*                 Auxiliary line structures                   */
> -/***************************************************************/
> -
> -class KisPerspectiveGridDecoration::LineWrapper {
> -public:
> -    LineWrapper(const QPointF &p0, const QPointF &p1) {
> -        init(toKisVector2D(p0), toKisVector2D(p1));
> -    }
> -
> -    LineWrapper(const KisVector2D &p0, const KisVector2D &p1) {
> -        init(p0, p1);
> -    }
> -
> -    QPointF intersects(const LineWrapper &other)/* const */{
> -        KisVector2D n0 = m_lineEquation.normal();
> -        KisVector2D n1 = other.m_lineEquation.normal();
> -
> -        // Ensure vectors have the same direction
> -        if((n0(0) > 0) != (n1(0) > 0)) {
> -            n1 = -n1;
> -        }
> -
> -        if(qFuzzyCompare(n0(0), n1(0)) &&
> -           qFuzzyCompare(n0(1), n1(1))) {
> -
> -            const KisVector2D nearPoint(0,0);
> -            const KisVector2D farPoint(1e10,1e10);
> -
> -            KisVector2D otherPt = other.m_lineEquation.projection(nearPoint);
> -            KisVector2D otherPtProj = m_lineEquation.projection(otherPt);
> -
> -            KisVector2D newOffset = otherPt + 0.5 * (otherPtProj - otherPt);
> -            LineEquation tempLine(n0, newOffset);
> -            // Just throw it somewhere towards infinity...
> -            return toQPointF(tempLine.projection(farPoint));
> -        }
> -
> -        return toQPointF(m_lineEquation.intersection(other.m_lineEquation));
> -    }
> -
> -    qreal distance(const QPointF &pt) const {
> -        return m_lineEquation.absDistance(toKisVector2D(pt));
> -    }
> -
> -    QPointF p0() const {
> -        return m_p0;
> -    }
> -
> -    QPointF p1() const {
> -        return m_p1;
> -    }
> -
> -    bool contains(const QPointF &pt) const {
> -        bool coincide = pt == m_p0 || pt == m_p1;
> -        bool verticalSide = (pt.x() > m_p0.x()) == (pt.x() > m_p1.x());
> -        bool horizontalSide = (pt.y() > m_p0.y()) ==  (pt.y() > m_p1.y());
> -
> -        return coincide || !(verticalSide && horizontalSide);
> -    }
> -
> -    bool isNull(qreal precision) {
> -        qreal dx = m_p1.x() - m_p0.x();
> -        qreal dy = m_p1.y() - m_p0.y();
> -        return dx * dx + dy * dy <= precision * precision;
> -    }
> -
> -private:
> -    void init(const KisVector2D &p0, const KisVector2D &p1) {
> -        m_lineEquation =
> -            LineEquation::Through(p0, p1);
> -
> -        m_p0 = toQPointF(p0);
> -        m_p1 = toQPointF(p1);
> -    }
> -
> -private:
> -    LineEquation m_lineEquation;
> -    QPointF m_p0;
> -    QPointF m_p1;
> -};
> -
> -struct KisPerspectiveGridDecoration::SubdivisionLinesInfo {
> -    QPointF startPoint;
> -    QPointF shift;
> -
> -    QPointF intersection;
> -    const LineWrapper *clipLine;
> -
> -    int numSubdivisions;
> -};
> -
> -KisPerspectiveGridDecoration::KisPerspectiveGridDecoration(QPointer<KisView> parent)
> -    : KisCanvasDecoration("perspectiveGrid", parent)
> -{
> -}
> -
> -KisPerspectiveGridDecoration::~KisPerspectiveGridDecoration()
> -{
> -}
> -
> -KisPerspectiveGridDecoration::SubdivisionLinesInfo
> -KisPerspectiveGridDecoration::getSubdivisionsInfo(const LineWrapper &l0,
> -                                               const LineWrapper &l1,
> -                                               const QPointF &focusPoint,
> -                                               int numSubdivisions)
> -{
> -    const LineWrapper *nearest;
> -    const LineWrapper *farthest;
> -
> -    if(l0.distance(focusPoint) < l1.distance(focusPoint)) {
> -        nearest = &l0;
> -        farthest = &l1;
> -    } else {
> -        nearest = &l1;
> -        farthest = &l0;
> -    }
> -
> -    SubdivisionLinesInfo info;
> -    info.startPoint = farthest->p0();
> -    info.shift = (farthest->p1() - farthest->p0()) / numSubdivisions;
> -    info.intersection = focusPoint;
> -    info.clipLine = nearest;
> -    info.numSubdivisions = numSubdivisions;
> -
> -    return info;
> -}
> -
> -void KisPerspectiveGridDecoration::drawSubdivisions(QPainter& gc, const SubdivisionLinesInfo &info)
> -{
> -    dbgKrita << " subdivs " << info.numSubdivisions;
> -    for(int i = info.numSubdivisions - 1; i > 0; i--) {
> -        QPointF start = info.startPoint + i*info.shift;
> -        QPointF end =
> -            LineWrapper(start, info.intersection).intersects(*info.clipLine);
> -        gc.drawLine(start, end);
> -    }
> -}
> -
> -#define SMALLEST_LINE 1e-10
> -
> -void KisPerspectiveGridDecoration::drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter* converter, KisCanvas2* canvas)
> -{
> -    Q_UNUSED(updateArea);
> -    Q_UNUSED(canvas);
> -
> -    if (!view()) return;
> -
> -    KisImageWSP image = view()->image();
> -    if (!image) return;
> -
> -    KisPerspectiveGrid* pGrid = image->perspectiveGrid();
> -
> -    KisGridConfig config;
> -
> -    QPen mainPen = config.penMain();
> -    QPen subdivisionPen = config.penSubdivision();
> -    QPen errorPen = mainPen;
> -    errorPen.setColor(Qt::red);
> -
> -
> -    QTransform transform = converter->imageToWidgetTransform();
> -    gc.save();
> -    gc.setTransform(transform);
> -
> -    for (QList<KisSubPerspectiveGrid*>::const_iterator it = pGrid->begin(); it != pGrid->end(); ++it) {
> -        const KisSubPerspectiveGrid* grid = *it;
> -
> -        /**
> -         * Note that the notion of top-bottom-right-left
> -         * is purely theorical
> -         */
> -        LineWrapper lineTop(*grid->topLeft(), *grid->topRight());
> -        LineWrapper lineRight(*grid->topRight(), *grid->bottomRight());
> -        LineWrapper lineBottom(*grid->bottomRight(), *grid->bottomLeft());
> -        LineWrapper lineLeft(*grid->bottomLeft(), *grid->topLeft());
> -
> -        QPointF horizIntersection;
> -        QPointF vertIntersection;
> -
> -        bool linesNotNull = true;
> -        bool polygonIsConvex = true;
> -
> -        if(lineTop.isNull(SMALLEST_LINE) ||
> -           lineBottom.isNull(SMALLEST_LINE) ||
> -           lineLeft.isNull(SMALLEST_LINE) ||
> -           lineRight.isNull(SMALLEST_LINE)) {
> -
> -            linesNotNull = false;
> -        }
> -
> -        if(linesNotNull) {
> -            horizIntersection = lineTop.intersects(lineBottom);
> -            vertIntersection = lineLeft.intersects(lineRight);
> -
> -            if(lineTop.contains(horizIntersection) ||
> -               lineBottom.contains(horizIntersection) ||
> -               lineLeft.contains(vertIntersection) ||
> -               lineRight.contains(vertIntersection)) {
> -
> -                polygonIsConvex = false;
> -            }
> -        }
> -
> -        if(polygonIsConvex && linesNotNull) {
> -            gc.setPen(subdivisionPen);
> -
> -            SubdivisionLinesInfo info;
> -            info = getSubdivisionsInfo(lineTop, lineBottom, vertIntersection,
> -                                       grid->subdivisions());
> -             drawSubdivisions(gc, info);
> -
> -            info = getSubdivisionsInfo(lineLeft, lineRight, horizIntersection,
> -                                       grid->subdivisions());
> -            drawSubdivisions(gc, info);
> -        }
> -
> -        gc.setPen(polygonIsConvex && linesNotNull ? mainPen : errorPen);
> -        gc.drawLine(*grid->topLeft(), *grid->topRight());
> -        gc.drawLine(*grid->topRight(), *grid->bottomRight());
> -        gc.drawLine(*grid->bottomRight(), *grid->bottomLeft());
> -        gc.drawLine(*grid->bottomLeft(), *grid->topLeft());
> -    }
> -    gc.restore();
> -}
> diff --git a/libs/ui/canvas/kis_perspective_grid_decoration.h b/libs/ui/canvas/kis_perspective_grid_decoration.h
> deleted file mode 100644
> index ebe47d6..0000000
> --- a/libs/ui/canvas/kis_perspective_grid_decoration.h
> +++ /dev/null
> @@ -1,54 +0,0 @@
> -/*
> - * This file is part of Krita
> - *
> - *  Copyright (c) 2006,2008 Cyrille Berger <cberger at cberger.net>
> - *  Copyright (c) 2014 Sven Langkamp <sven.langkamp at gmail.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 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_PERSPECTIVE_GRID_DECORATION_H
> -#define KIS_PERSPECTIVE_GRID_DECORATION_H
> -
> -#include "kis_canvas_decoration.h"
> -#include <kritaui_export.h>
> -
> -class KisView;
> -
> -class KRITAUI_EXPORT KisPerspectiveGridDecoration : public KisCanvasDecoration
> -{
> -    Q_OBJECT
> -
> -public:
> -    KisPerspectiveGridDecoration(QPointer<KisView> parent);
> -    virtual ~KisPerspectiveGridDecoration();
> -
> -protected:
> -    virtual void drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter* converter, KisCanvas2* canvas);
> -
> -private:
> -    class LineWrapper;
> -    struct SubdivisionLinesInfo;
> -
> -    void drawSubdivisions(QPainter& gc, const SubdivisionLinesInfo &info);
> -
> -    SubdivisionLinesInfo getSubdivisionsInfo(const LineWrapper &l0,
> -                                             const LineWrapper &l1,
> -                                             const QPointF &focusPoint,
> -                                             int numSubdivisions);
> -};
> -
> -#endif // KIS_PERSPECTIVE_GRID_DECORATION_H
> diff --git a/libs/ui/canvas/kis_perspective_grid_manager.cpp b/libs/ui/canvas/kis_perspective_grid_manager.cpp
> deleted file mode 100644
> index ba4c90d..0000000
> --- a/libs/ui/canvas/kis_perspective_grid_manager.cpp
> +++ /dev/null
> @@ -1,127 +0,0 @@
> -/*
> - * This file is part of Krita
> - *
> - *  Copyright (c) 2006,2008 Cyrille Berger <cberger at cberger.net>
> - *  Copyright (c) 2010 Dmitry Kazakov <dimula73 at gmail.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 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 "canvas/kis_perspective_grid_manager.h"
> -
> -
> -#include <klocalizedstring.h>
> -#include <ktoggleaction.h>
> -#include <kactioncollection.h>
> -#include <kguiitem.h>
> -
> -#include "canvas/kis_canvas2.h"
> -#include "kis_config.h"
> -#include "kis_image.h"
> -#include "kis_perspective_grid.h"
> -#include "KisViewManager.h"
> -#include "kis_perspective_grid_decoration.h"
> -#include "KisView.h"
> -
> -
> -/***************************************************************/
> -/*                 KisPerspectiveGridManager                   */
> -/***************************************************************/
> -
> -KisPerspectiveGridManager::KisPerspectiveGridManager(KisViewManager * parent) : QObject(parent)
> -    , m_imageView(0)
> -{
> -}
> -
> -
> -KisPerspectiveGridManager::~KisPerspectiveGridManager()
> -{
> -}
> -
> -void KisPerspectiveGridManager::updateGUI()
> -{
> -    if (m_imageView) {
> -        KisImageWSP image = m_imageView->image();
> -
> -        if (image) {
> -            KisPerspectiveGrid* pGrid = image->perspectiveGrid();
> -            m_toggleGrid->setEnabled(pGrid->hasSubGrids());
> -            m_toggleGrid->setChecked(decoration()->visible());
> -            m_gridClear->setEnabled(pGrid->hasSubGrids());
> -        }
> -    } else {
> -        m_toggleGrid->setEnabled(false);
> -        m_gridClear->setEnabled(false);
> -    }
> -}
> -
> -void KisPerspectiveGridManager::setup(KActionCollection * collection)
> -{
> -    m_toggleGrid  = new KToggleAction(i18n("Show Perspective Grid"), this);
> -    collection->addAction("view_toggle_perspective_grid", m_toggleGrid);
> -
> -    m_toggleGrid->setCheckedState(KGuiItem(i18n("Hide Perspective Grid")));
> -    m_toggleGrid->setChecked(false);
> -    m_gridClear  = new QAction(i18n("Clear Perspective Grid"), this);
> -    collection->addAction("view_clear_perspective_grid", m_gridClear);
> -    connect(m_gridClear, SIGNAL(triggered()), this, SLOT(clearPerspectiveGrid()));
> -    updateGUI();
> -}
> -
> -void KisPerspectiveGridManager::clearPerspectiveGrid()
> -{
> -    if (m_imageView) {
> -        KisImageWSP image = m_imageView->image();
> -        if (image) {
> -            image->perspectiveGrid()->clearSubGrids();
> -            m_imageView->canvasBase()->canvasWidget()->update();
> -            updateGUI();
> -        }
> -    }
> -}
> -
> -void KisPerspectiveGridManager::startEdition()
> -{
> -    m_toggleGrid->setEnabled(false);
> -}
> -
> -void KisPerspectiveGridManager::stopEdition()
> -{
> -    updateGUI();
> -}
> -
> -void KisPerspectiveGridManager::setView(QPointer<KisView> imageView)
> -{
> -    m_toggleGrid->disconnect();
> -
> -    m_imageView = imageView;
> -    if (m_imageView && !decoration()) {
> -        KisPerspectiveGridDecoration* newDecoration = new KisPerspectiveGridDecoration(m_imageView);
> -        newDecoration->setVisible(true);
> -        m_imageView->canvasBase()->addDecoration(newDecoration);
> -    }
> -    connect(m_toggleGrid, SIGNAL(triggered()), decoration(), SLOT(toggleVisibility()));
> -    updateGUI();
> -}
> -
> -KisPerspectiveGridDecoration* KisPerspectiveGridManager::decoration()
> -{
> -    if (m_imageView && m_imageView->canvasBase()) {
> -        return qobject_cast<KisPerspectiveGridDecoration*>(m_imageView->canvasBase()->decoration("perspectiveGrid"));
> -    }
> -    return 0;
> -}
> -
> -
> diff --git a/libs/ui/canvas/kis_perspective_grid_manager.h b/libs/ui/canvas/kis_perspective_grid_manager.h
> deleted file mode 100644
> index e7f599a..0000000
> --- a/libs/ui/canvas/kis_perspective_grid_manager.h
> +++ /dev/null
> @@ -1,72 +0,0 @@
> -/*
> - * This file is part of Krita
> - *
> - *  Copyright (c) 2006,2008 Cyrille Berger <cberger at 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.
> - */
> -
> -#ifndef KIS_PERSPECTIVE_GRID_MANAGER_H
> -#define KIS_PERSPECTIVE_GRID_MANAGER_H
> -
> -#include <QPainter>
> -#include <QPointer>
> -#include "KisView.h"
> -
> -#include <kritaui_export.h>
> -
> -class KisPerspectiveGridDecoration;
> -class QAction;
> -class KActionCollection;
> -class KToggleAction;
> -class KisViewManager;
> -
> -class KRITAUI_EXPORT KisPerspectiveGridManager : public QObject
> -{
> -    Q_OBJECT
> -public:
> -    /** Create a perspective manager for this view
> -     */
> -    KisPerspectiveGridManager(KisViewManager * parent);
> -    ~KisPerspectiveGridManager();
> -    void setup(KActionCollection * collection);
> -    /**
> -     * Call this function to start editing the grid, to disable display
> -     */
> -    void startEdition();
> -    /**
> -     * Call this function when the edition of the grid is finished. Trigger a redisplay of the perspective
> -     * grid if necesserary
> -     */
> -    void stopEdition();
> -
> -    void setView(QPointer<KisView> imageView);
> -public Q_SLOTS:
> -    void updateGUI();
> -    /**
> -     * Call this to remove all the perspective subgrids.
> -     */
> -    void clearPerspectiveGrid();
> -
> -private:
> -    KisPerspectiveGridDecoration* decoration();
> -
> -
> -    QPointer<KisView> m_imageView;
> -    KToggleAction* m_toggleGrid;
> -    QAction * m_gridClear;
> -};
> -
> -#endif
> diff --git a/libs/ui/canvas/kis_qpainter_canvas.cpp b/libs/ui/canvas/kis_qpainter_canvas.cpp
> index 2c170dd..9ad9f0d 100644
> --- a/libs/ui/canvas/kis_qpainter_canvas.cpp
> +++ b/libs/ui/canvas/kis_qpainter_canvas.cpp
> @@ -52,7 +52,6 @@
> #include "KisDocument.h"
> #include "kis_selection_manager.h"
> #include "kis_selection.h"
> -#include "kis_perspective_grid_manager.h"
> #include "kis_canvas_updates_compressor.h"
> #include "kis_config_notifier.h"
> #include "kis_group_layer.h"
> diff --git a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.cpp b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.cpp
> index fbe276d..2caf838 100644
> --- a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.cpp
> +++ b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.cpp
> @@ -56,7 +56,6 @@
> #include <kis_pressure_darken_option.h>
> #include <kis_pressure_opacity_option.h>
> #include <kis_paint_action_type_option.h>
> -#include <kis_perspective_grid.h>
> #include <kis_random_sub_accessor.h>
> #include <kis_fixed_paint_device.h>
> #include <kis_iterator_ng.h>
> @@ -157,42 +156,43 @@ KisSpacingInformation KisDuplicateOp::paintAt(const KisPaintInformation& info)
>     // Perspective correction ?
>
>
> -    if (m_perspectiveCorrection && m_image && m_image->perspectiveGrid()->countSubGrids() == 1) {
> -        Matrix3qreal startM = Matrix3qreal::Identity();
> -        Matrix3qreal endM = Matrix3qreal::Identity();
> +    // if (m_perspectiveCorrection && m_image && m_image->perspectiveGrid()->countSubGrids() == 1) {
> +    //     Matrix3qreal startM = Matrix3qreal::Identity();
> +    //     Matrix3qreal endM = Matrix3qreal::Identity();
>
> -        // First look for the grid corresponding to the start point
> -        KisSubPerspectiveGrid* subGridStart = *m_image->perspectiveGrid()->begin();
> -        QRect r = QRect(0, 0, m_image->width(), m_image->height());
> +    //     // First look for the grid corresponding to the start point
> +    //     KisSubPerspectiveGrid* subGridStart = *m_image->perspectiveGrid()->begin();
> +    //     QRect r = QRect(0, 0, m_image->width(), m_image->height());
>
> -        if (subGridStart) {
> -            startM = KisPerspectiveMath::computeMatrixTransfoFromPerspective(r, *subGridStart->topLeft(), *subGridStart->topRight(), *subGridStart->bottomLeft(), *subGridStart->bottomRight());
> -        }
> +    //     if (subGridStart) {
> +    //         startM = KisPerspectiveMath::computeMatrixTransfoFromPerspective(r, *subGridStart->topLeft(), *subGridStart->topRight(), *subGridStart->bottomLeft(), *subGridStart->bottomRight());
> +    //     }
>
> -        // Second look for the grid corresponding to the end point
> -        KisSubPerspectiveGrid* subGridEnd = *m_image->perspectiveGrid()->begin();
> -        if (subGridEnd) {
> -            endM = KisPerspectiveMath::computeMatrixTransfoToPerspective(*subGridEnd->topLeft(), *subGridEnd->topRight(), *subGridEnd->bottomLeft(), *subGridEnd->bottomRight(), r);
> -        }
> +    //     // Second look for the grid corresponding to the end point
> +    //     KisSubPerspectiveGrid* subGridEnd = *m_image->perspectiveGrid()->begin();
> +    //     if (subGridEnd) {
> +    //         endM = KisPerspectiveMath::computeMatrixTransfoToPerspective(*subGridEnd->topLeft(), *subGridEnd->topRight(), *subGridEnd->bottomLeft(), *subGridEnd->bottomRight(), r);
> +    //     }
>
> -        // Compute the translation in the perspective transformation space:
> -        QPointF positionStartPaintingT = KisPerspectiveMath::matProd(endM, QPointF(m_duplicateStart));
> -        QPointF duplicateStartPositionT = KisPerspectiveMath::matProd(endM, QPointF(m_duplicateStart) - QPointF(m_settings->offset()));
> -        QPointF translat = duplicateStartPositionT - positionStartPaintingT;
> +    //     // Compute the translation in the perspective transformation space:
> +    //     QPointF positionStartPaintingT = KisPerspectiveMath::matProd(endM, QPointF(m_duplicateStart));
> +    //     QPointF duplicateStartPositionT = KisPerspectiveMath::matProd(endM, QPointF(m_duplicateStart) - QPointF(m_settings->offset()));
> +    //     QPointF translat = duplicateStartPositionT - positionStartPaintingT;
>
> -        KisSequentialIterator dstIt(m_srcdev, QRect(0, 0, sw, sh));
> -        KisRandomSubAccessorSP srcAcc = realSourceDevice->createRandomSubAccessor();
> +    //     KisSequentialIterator dstIt(m_srcdev, QRect(0, 0, sw, sh));
> +    //     KisRandomSubAccessorSP srcAcc = realSourceDevice->createRandomSubAccessor();
>
> -        //Action
> -        do {
> -            QPointF p =  KisPerspectiveMath::matProd(startM, KisPerspectiveMath::matProd(endM, QPointF(dstIt.x() + dstRect.x(), dstIt.y() + dstRect.y())) + translat);
> -            srcAcc->moveTo(p);
> -            srcAcc->sampledOldRawData(dstIt.rawData());
> -        } while (dstIt.nextPixel());
> +    //     //Action
> +    //     do {
> +    //         QPointF p =  KisPerspectiveMath::matProd(startM, KisPerspectiveMath::matProd(endM, QPointF(dstIt.x() + dstRect.x(), dstIt.y() + dstRect.y())) + translat);
> +    //         srcAcc->moveTo(p);
> +    //         srcAcc->sampledOldRawData(dstIt.rawData());
> +    //     } while (dstIt.nextPixel());
>
>
> -    }
> -    else {
> +    // }
> +    // else
> +    {
>         KisPainter copyPainter(m_srcdev);
>         copyPainter.setCompositeOp(COMPOSITE_COPY);
>         copyPainter.bitBltOldData(0, 0, realSourceDevice, srcPoint.x(), srcPoint.y(), sw, sh);
> diff --git a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_option.cpp b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_option.cpp
> index 61f2d41..2d1728c 100644
> --- a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_option.cpp
> +++ b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_option.cpp
> @@ -23,7 +23,6 @@
>
> #include "ui_wdgduplicateop.h"
> #include <kis_image.h>
> -#include <kis_perspective_grid.h>
>
> class KisDuplicateOpOptionsWidget: public QWidget, public Ui::DuplicateOpOptionsWidget
> {
> @@ -36,7 +35,7 @@ public:
> protected:
>     void showEvent(QShowEvent* event) {
>         QWidget::showEvent(event);
> -        cbPerspective->setEnabled(m_image && m_image->perspectiveGrid() && m_image->perspectiveGrid()->countSubGrids() == 1);
> +        //cbPerspective->setEnabled(m_image && m_image->perspectiveGrid() && m_image->perspectiveGrid()->countSubGrids() == 1);
>     }
> };
>
> diff --git a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.cpp b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.cpp
> index 695e640..ac9aa5d 100644
> --- a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.cpp
> +++ b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.cpp
> @@ -37,7 +37,7 @@
> #include <kis_pressure_opacity_option.h>
> #include <kis_pressure_size_option.h>
> #include <kis_paint_action_type_option.h>
> -#include <kis_perspective_grid.h>
> +
>
> KisDuplicateOpSettings::KisDuplicateOpSettings()
>     : m_isOffsetNotUptodate(false)
> diff --git a/plugins/tools/CMakeLists.txt b/plugins/tools/CMakeLists.txt
> index 106dfcf..d390b87 100644
> --- a/plugins/tools/CMakeLists.txt
> +++ b/plugins/tools/CMakeLists.txt
> @@ -5,7 +5,6 @@ add_subdirectory( tool_crop )
> add_subdirectory( tool_polygon )
> add_subdirectory( tool_polyline )
> add_subdirectory( tool_transform2 )
> -add_subdirectory( tool_perspectivegrid )
> add_subdirectory( tool_dyna )
> add_subdirectory( tool_text )
> add_subdirectory( karbonplugins )
> diff --git a/plugins/tools/tool_perspectivegrid/CMakeLists.txt b/plugins/tools/tool_perspectivegrid/CMakeLists.txt
> deleted file mode 100644
> index c0e18b0..0000000
> --- a/plugins/tools/tool_perspectivegrid/CMakeLists.txt
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -set(kritatoolperspectivegrid_SOURCES
> -    tool_perspectivegrid.cc
> -    kis_tool_perspectivegrid.cc
> -    )
> -qt5_add_resources(kritatoolperspectivegrid_SOURCES tool_perspectivegrid.qrc)
> -add_library(kritatoolperspectivegrid MODULE ${kritatoolperspectivegrid_SOURCES})
> -
> -target_link_libraries(kritatoolperspectivegrid kritaui)
> -
> -install(TARGETS kritatoolperspectivegrid  DESTINATION ${CALLIGRA_PLUGIN_INSTALL_DIR})
> -
> -install( FILES
> -    KisToolPerspectiveGrid.action
> -DESTINATION  ${DATA_INSTALL_DIR}/krita/actions)
> diff --git a/plugins/tools/tool_perspectivegrid/KisToolPerspectiveGrid.action b/plugins/tools/tool_perspectivegrid/KisToolPerspectiveGrid.action
> deleted file mode 100644
> index 0d8ae08..0000000
> --- a/plugins/tools/tool_perspectivegrid/KisToolPerspectiveGrid.action
> +++ /dev/null
> @@ -1,6 +0,0 @@
> -<?xml version="1.0" encoding="UTF-8"?>
> -<ActionCollection version="2" name="Tools">
> -  <Actions category="Perspective Grid Tool">
> -    <text>Perspective Grid Tool</text>
> -  </Actions>
> -</ActionCollection>
> diff --git a/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.cc b/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.cc
> deleted file mode 100644
> index 2bed504..0000000
> --- a/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.cc
> +++ /dev/null
> @@ -1,393 +0,0 @@
> -/*
> - *  kis_tool_perspectivegrid.cc - part of Krita
> - *
> - *  Copyright (c) 2006,2008 Cyrille Berger <cberger at cberger.net>
> - *
> - *  This library is free software; you can redistribute it and/or modify
> - *  it under the terms of the GNU Lesser General Public License as published by
> - *  the Free Software Foundation; version 2.1 of the License.
> - *
> - *  This library 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 Lesser General Public License for more details.
> - *
> - *  You should have received a copy of the GNU Lesser 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_tool_perspectivegrid.h"
> -
> -#include <QApplication>
> -#include <QPainter>
> -#include <QWidget>
> -#include <QLayout>
> -
> -#include <kis_debug.h>
> -#include <klocalizedstring.h>
> -
> -#include <kis_icon.h>
> -#include <KoCanvasController.h>
> -
> -#include <kis_config.h>
> -#include <kis_cursor.h>
> -#include <kis_image.h>
> -#include <KoPointerEvent.h>
> -#include <KoViewConverter.h>
> -#include <canvas/kis_perspective_grid_manager.h>
> -#include <kis_canvas_resource_provider.h>
> -#include <kis_painter.h>
> -#include <brushengine/kis_paintop_registry.h>
> -#include <KisViewManager.h>
> -
> -#include <canvas/kis_canvas2.h>
> -#include <kis_perspective_grid_decoration.h>
> -
> -KisToolPerspectiveGrid::KisToolPerspectiveGrid(KoCanvasBase * canvas)
> -        : KisTool(canvas, KisCursor::load("tool_perspectivegrid_cursor.png", 6, 6)),
> -          m_handleSize(13), m_handleHalfSize(6), m_canvas(dynamic_cast<KisCanvas2*>(canvas))
> -{
> -    Q_ASSERT(m_canvas);
> -    setObjectName("tool_perspectivegrid");
> -}
> -
> -KisToolPerspectiveGrid::~KisToolPerspectiveGrid()
> -{
> -}
> -
> -void KisToolPerspectiveGrid::activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes)
> -{
> -    KisTool::activate(toolActivation, shapes);
> -
> -    m_canvas->viewManager()->perspectiveGridManager()->startEdition();
> -    if (! m_canvas->viewManager()->resourceProvider()->currentImage()->perspectiveGrid()->hasSubGrids()) {
> -        m_internalMode = MODE_CREATION;
> -        m_points.clear();
> -    } else {
> -        m_internalMode = MODE_EDITING;
> -        useCursor(KisCursor::arrowCursor());
> -
> -        decoration()->setVisible(true);
> -        m_canvas->updateCanvas(); // TODO only the correct rect
> -    }
> -}
> -
> -void KisToolPerspectiveGrid::deactivate()
> -{
> -    m_canvas->viewManager()->perspectiveGridManager()->stopEdition();
> -    if (m_internalMode == MODE_CREATION) {
> -        m_points.clear();
> -    }
> -    m_canvas->updateCanvas();
> -
> -    KisTool::deactivate();
> -}
> -
> -bool KisToolPerspectiveGrid::mouseNear(const QPointF& mousep, const QPointF& point)
> -{
> -    QRectF handlerect((point.x() - m_handleHalfSize), (point.y() - m_handleHalfSize), m_handleSize, m_handleSize);
> -    return handlerect.contains(mousep);
> -}
> -
> -KisPerspectiveGridNodeSP KisToolPerspectiveGrid::nodeNearPoint(KisSubPerspectiveGrid* grid, QPointF point)
> -{
> -    if (mouseNear(point, pixelToView(*grid->topLeft()))) {
> -        dbgPlugins << " NEAR TOPLEFT HANDLE";
> -        return grid->topLeft();
> -    } else if (mouseNear(point, pixelToView(*grid->topRight()))) {
> -        dbgPlugins << " NEAR TOPRIGHT HANDLE";
> -        return grid->topRight();
> -    } else if (mouseNear(point, pixelToView(*grid->bottomLeft()))) {
> -        dbgPlugins << " NEAR BOTTOMLEFT HANDLE";
> -        return grid->bottomLeft();
> -    } else if (mouseNear(point, pixelToView(*grid->bottomRight()))) {
> -        dbgPlugins << " NEAR BOTTOMRIGHT HANDLE";
> -        return grid->bottomRight();
> -    }
> -    return 0;
> -}
> -
> -KisPerspectiveGridDecoration* KisToolPerspectiveGrid::decoration()
> -{
> -    return qobject_cast<KisPerspectiveGridDecoration*>(m_canvas->decoration("perspectiveGrid"));
> -}
> -
> -void KisToolPerspectiveGrid::beginPrimaryAction(KoPointerEvent *event)
> -{
> -    setMode(KisTool::PAINT_MODE);
> -
> -    KisPerspectiveGrid* pGrid = m_canvas->viewManager()->resourceProvider()->currentImage()->perspectiveGrid();
> -    if (!pGrid->hasSubGrids() && m_internalMode != MODE_CREATION) { // it's possible that the perspectiv grid was cleared
> -        m_internalMode = MODE_CREATION;
> -        m_points.clear();
> -    }
> -    if (m_internalMode == MODE_CREATION) {
> -        m_currentPt = event->point;
> -
> -        if (m_points.isEmpty()) {
> -            m_points.append(m_currentPt);
> -            m_isFirstPoint = true;
> -        }
> -        else {
> -            m_isFirstPoint = false;
> -        }
> -        m_canvas->updateCanvas(); // TODO update only the relevant part of the canvas
> -    }
> -    else if (m_internalMode == MODE_EDITING) {
> -        // Look for the handle which was pressed
> -        QPointF mousep = m_canvas->viewConverter()->documentToView(event->point);
> -
> -        for (QList<KisSubPerspectiveGrid*>::const_iterator it = pGrid->begin(); it != pGrid->end(); ++it) {
> -            KisSubPerspectiveGrid* grid = *it;
> -            QPointF gridCenter = grid->center();
> -            dbgKrita << "click at " << event->point << " top left at " << *grid->topLeft();
> -
> -            m_selectedNode1 = nodeNearPoint(grid, mousep);
> -
> -            if (m_selectedNode1 != 0) {
> -                m_internalMode = MODE_DRAGGING_NODE;
> -                break;
> -            }
> -            else if (mouseNear(mousep, ((pixelToView(*grid->topLeft()) + pixelToView(*grid->bottomLeft()))*0.5))) {
> -                dbgPlugins << " PRESS LEFT HANDLE";
> -                m_internalMode = MODE_DRAGGING_TRANSLATING_TWONODES;
> -                m_selectedNode1 = new KisPerspectiveGridNode(*grid->topLeft());
> -                m_selectedNode2 = new KisPerspectiveGridNode(*grid->bottomLeft());
> -                KisSubPerspectiveGrid* newsubgrid = new KisSubPerspectiveGrid(m_selectedNode1, grid->topLeft() , grid->bottomLeft(), m_selectedNode2);
> -                m_dragEnd = convertToPixelCoord(event->point);
> -                pGrid->addNewSubGrid(newsubgrid);
> -                m_canvas->updateCanvas(); // TODO update only the relevant part of the canvas
> -                break;
> -            }
> -            else if (mouseNear(mousep, ((pixelToView(*grid->topRight()) + pixelToView(*grid->bottomRight()))*0.5))) {
> -                dbgPlugins << " PRESS RIGHT HANDLE";
> -                m_internalMode = MODE_DRAGGING_TRANSLATING_TWONODES;
> -                m_selectedNode1 = new KisPerspectiveGridNode(*grid->topRight());
> -                m_selectedNode2 = new KisPerspectiveGridNode(*grid->bottomRight());
> -                KisSubPerspectiveGrid* newsubgrid = new KisSubPerspectiveGrid(grid->topRight(), m_selectedNode1, m_selectedNode2, grid->bottomRight());
> -                m_dragEnd = convertToPixelCoord(event->point);
> -                pGrid->addNewSubGrid(newsubgrid);
> -                m_canvas->updateCanvas(); // TODO update only the relevant part of the canvas
> -                break;
> -            }
> -            else if (mouseNear(mousep, ((pixelToView(*grid->topLeft()) + pixelToView(*grid->topRight()))*0.5))) {
> -                dbgPlugins << " PRESS TOP HANDLE";
> -                m_internalMode = MODE_DRAGGING_TRANSLATING_TWONODES;
> -                m_selectedNode1 = new KisPerspectiveGridNode(*grid->topLeft());
> -                m_selectedNode2 = new KisPerspectiveGridNode(*grid->topRight());
> -                KisSubPerspectiveGrid* newsubgrid = new KisSubPerspectiveGrid(m_selectedNode1, m_selectedNode2,  grid->topRight(), grid->topLeft());
> -                m_dragEnd = convertToPixelCoord(event->point);
> -                pGrid->addNewSubGrid(newsubgrid);
> -                m_canvas->updateCanvas(); // TODO update only the relevant part of the canvas
> -                break;
> -            }
> -            else if (mouseNear(mousep, ((pixelToView(*grid->bottomLeft()) + pixelToView(*grid->bottomRight()))*0.5))) {
> -                dbgPlugins << " PRESS BOTTOM HANDLE";
> -                m_internalMode = MODE_DRAGGING_TRANSLATING_TWONODES;
> -                m_selectedNode1 = new KisPerspectiveGridNode(*grid->bottomLeft());
> -                m_selectedNode2 = new KisPerspectiveGridNode(*grid->bottomRight());
> -                KisSubPerspectiveGrid* newsubgrid = new KisSubPerspectiveGrid(grid->bottomLeft(), grid->bottomRight(), m_selectedNode2, m_selectedNode1);
> -                m_dragEnd = convertToPixelCoord(event->point);
> -                pGrid->addNewSubGrid(newsubgrid);
> -                m_canvas->updateCanvas(); // TODO update only the relevant part of the canvas
> -                break;
> -            }
> -            else if (pixelToView(QRectF((gridCenter.x() - 16), (gridCenter.y() - 16), 32, 32)).contains(mousep)) {
> -                dbgPlugins << " PRESS DELETE ICON";
> -                pGrid->deleteSubGrid(grid);
> -                m_canvas->updateCanvas(); // TODO update only the relevant part of the canvas
> -                if (!pGrid->hasSubGrids()) {
> -                    m_internalMode = MODE_CREATION;
> -                    useCursor(KisCursor::load("tool_perspectivegrid_cursor.png", 6, 6));
> -                    m_points.clear();
> -                }
> -                break;
> -            }
> -        }
> -    }
> -}
> -
> -void KisToolPerspectiveGrid::continuePrimaryAction(KoPointerEvent *event)
> -{
> -    if (m_internalMode == MODE_CREATION) {
> -        if (!m_points.isEmpty()) {
> -            // get current mouse position
> -            m_currentPt = event->point;
> -            // draw new lines on canvas
> -            m_canvas->updateCanvas(); // TODO update only the relevant part of the canvas
> -        }
> -    } else {
> -        if (m_selectedNode1 && m_internalMode == MODE_DRAGGING_NODE) {
> -            QPointF pos = convertToPixelCoord(event);
> -            m_selectedNode1->setX(pos.x());
> -            m_selectedNode1->setY(pos.y());
> -            m_canvas->updateCanvas(); // TODO update only the relevant part of the canvas
> -        }
> -        if (m_selectedNode1 && m_selectedNode2 && m_internalMode == MODE_DRAGGING_TRANSLATING_TWONODES) {
> -            QPointF translate = convertToPixelCoord(event->point) - m_dragEnd;
> -            m_dragEnd = convertToPixelCoord(event->point);
> -            *m_selectedNode1 += translate;;
> -            *m_selectedNode2 += translate;;
> -            m_canvas->updateCanvas(); // TODO update only the relevant part of the canvas
> -        }
> -    }
> -    bool wasHiglightedNode = m_higlightedNode != 0;
> -    QPointF mousep = m_canvas->viewConverter()->documentToView(event->point);
> -    KisPerspectiveGrid* pGrid = m_canvas->viewManager()->resourceProvider()->currentImage()->perspectiveGrid();
> -    for (QList<KisSubPerspectiveGrid*>::const_iterator it = pGrid->begin(); it != pGrid->end(); ++it) {
> -        KisSubPerspectiveGrid* grid = *it;
> -        if ((m_higlightedNode = nodeNearPoint(grid, mousep))) {
> -            if (m_higlightedNode == m_selectedNode1 || m_higlightedNode == m_selectedNode2) {
> -                m_higlightedNode = 0;
> -            } else {
> -                m_canvas->updateCanvas(); // TODO update only the relevant part of the canvas
> -                break;
> -            }
> -        }
> -    }
> -    if (wasHiglightedNode && !m_higlightedNode) {
> -        m_canvas->updateCanvas(); // TODO update only the relevant part of the canvas
> -    }
> -}
> -
> -void KisToolPerspectiveGrid::endPrimaryAction(KoPointerEvent *event)
> -{
> -    Q_UNUSED(event);
> -    setMode(KisTool::HOVER_MODE);
> -
> -    if (m_internalMode == MODE_CREATION) {
> -        if (!m_isFirstPoint)  {
> -            m_points.append(m_currentPt);
> -            if (m_points.size() == 4) { // wow we have a grid, isn't that cool ?
> -                m_canvas->viewManager()->resourceProvider()->currentImage()->perspectiveGrid()->addNewSubGrid(
> -                    new KisSubPerspectiveGrid(
> -                        new KisPerspectiveGridNode(convertToPixelCoord(m_points[0])),
> -                        new KisPerspectiveGridNode(convertToPixelCoord(m_points[1])),
> -                        new KisPerspectiveGridNode(convertToPixelCoord(m_points[2])),
> -                        new KisPerspectiveGridNode(convertToPixelCoord(m_points[3]))));
> -                decoration()->setVisible(true);
> -                m_internalMode = MODE_EDITING;
> -                useCursor(KisCursor::arrowCursor());
> -            }
> -        }
> -        m_canvas->updateCanvas(); // TODO update only the relevant part of the canvas
> -    } else {
> -        m_internalMode = MODE_EDITING;
> -        // Check if there is a need for merging two nodes
> -        if (m_higlightedNode && m_selectedNode2 == 0) {
> -            m_higlightedNode->mergeWith(m_selectedNode1);
> -            m_canvas->updateCanvas(); // TODO update only the relevant part of the canvas
> -        }
> -        m_selectedNode1 = 0;
> -        m_selectedNode2 = 0;
> -    }
> -}
> -
> -void KisToolPerspectiveGrid::paint(QPainter& gc, const KoViewConverter &converter)
> -{
> -    Q_UNUSED(converter);
> -    if (m_internalMode == MODE_CREATION) {
> -        drawGridCreation(gc);
> -    } else {
> -        drawGrid(gc);
> -    }
> -}
> -
> -void KisToolPerspectiveGrid::drawGridCreation(QPainter& gc)
> -{
> -    dbgPlugins << "drawGridCreation";
> -
> -    KisConfig cfg;
> -    QPen pen = QPen(cfg.getGridMainColor(), 1, Qt::SolidLine);
> -
> -    gc.setPen(pen);
> -    gc.setRenderHint(QPainter::Antialiasing);
> -
> -    for (QPointFVector::iterator iter = m_points.begin(); iter != m_points.end(); iter++) {
> -        if (iter + 1 == m_points.end())
> -            break;
> -        else
> -            gc.drawLine(m_canvas->viewConverter()->documentToView(*iter).toPoint(), m_canvas->viewConverter()->documentToView(*(iter + 1)).toPoint());
> -    }
> -    if (!m_points.isEmpty()) {
> -        gc.drawLine(m_canvas->viewConverter()->documentToView(*(m_points.end() - 1)).toPoint(), m_canvas->viewConverter()->documentToView(m_currentPt).toPoint());
> -        gc.drawLine(m_canvas->viewConverter()->documentToView(m_currentPt).toPoint(), m_canvas->viewConverter()->documentToView(*m_points.begin()).toPoint());
> -    }
> -}
> -
> -void KisToolPerspectiveGrid::drawSmallRectangle(QPainter& gc, const QPointF& p)
> -{
> -    gc.drawRect(p.x() - m_handleHalfSize, p.y() - m_handleHalfSize, m_handleSize, m_handleSize);
> -}
> -
> -void KisToolPerspectiveGrid::drawGrid(QPainter& gc)
> -{
> -    dbgPlugins << "drawGrid";
> -
> -    KisConfig cfg;
> -    QPen pen = QPen(cfg.getGridMainColor(), 1, Qt::SolidLine);
> -
> -    QPointF startPos;
> -    QPointF endPos;
> -
> -    gc.setPen(pen);
> -    gc.setRenderHint(QPainter::Antialiasing);
> -//     gc.setRasterOp(Qt::XorROP);
> -    KisPerspectiveGrid* pGrid = m_canvas->viewManager()->resourceProvider()->currentImage()->perspectiveGrid();
> -
> -    for (QList<KisSubPerspectiveGrid*>::const_iterator it = pGrid->begin(); it != pGrid->end(); ++it) {
> -        KisSubPerspectiveGrid* grid = *it;
> -
> -        { // Draw top
> -            startPos = pixelToView(*grid->topLeft());
> -            endPos = pixelToView(*grid->topRight());
> -            gc.drawLine(startPos, endPos);
> -            drawSmallRectangle(gc, (endPos + startPos) / 2.); // Draw top-middle handle
> -            drawSmallRectangle(gc, startPos); // draw top-left handle
> -            drawSmallRectangle(gc, endPos); // draw top-right handle
> -        }
> -        { // Draw Right
> -            startPos = pixelToView(*grid->topRight());
> -            endPos = pixelToView(*grid->bottomRight());
> -            gc.drawLine(startPos, endPos);
> -            drawSmallRectangle(gc, (endPos + startPos) / 2.); // Draw right-middle handle
> -        }
> -        { // Draw bottoom
> -            startPos = pixelToView(*grid->bottomRight());
> -            endPos = pixelToView(*grid->bottomLeft());
> -            gc.drawLine(startPos, endPos);
> -            drawSmallRectangle(gc, (endPos + startPos) / 2.); // Draw bottom-middle handle
> -            drawSmallRectangle(gc, endPos); // Draw bottom-left handle
> -            drawSmallRectangle(gc, startPos); // Draw bottom-right handle
> -        }
> -        { // Draw Left
> -            startPos = pixelToView(*grid->bottomLeft());
> -            endPos = pixelToView(*grid->topLeft());
> -            gc.drawLine(startPos, endPos);
> -            drawSmallRectangle(gc, (endPos + startPos) / 2.); // Draw left-middle handle
> -        }
> -        // Draw delete icon
> -        QPointF iconDeletePos = pixelToView(grid->center());
> -        gc.drawPixmap(iconDeletePos - QPointF(16, 16), KisIconUtils::loadIcon("edit-delete").pixmap(32, 32));
> -        // Draw Vanishing point
> -        QPointF tbVpf = grid->topBottomVanishingPoint();
> -        if (fabs(tbVpf.x()) < 30000000. && fabs(tbVpf.y()) < 30000000.) {
> -            QPointF tbVp = pixelToView(tbVpf);
> -            gc.drawLine(tbVp.x() - m_handleHalfSize, tbVp.y() - m_handleHalfSize, tbVp.x() + m_handleHalfSize, tbVp.y() + m_handleHalfSize);
> -            gc.drawLine(tbVp.x() - m_handleHalfSize, tbVp.y() + m_handleHalfSize, tbVp.x() + m_handleHalfSize, tbVp.y() - m_handleHalfSize);
> -        }
> -        // Draw Vanishing Point
> -        QPointF lrVpf = grid->leftRightVanishingPoint();
> -        if (fabs(lrVpf.x()) < 30000000. && fabs(lrVpf.y()) < 30000000.) { // Don't display it, if it is too far, or you get funny results
> -            QPointF lrVp = pixelToView(lrVpf);
> -            gc.drawLine(lrVp.x() - m_handleHalfSize, lrVp.y() - m_handleHalfSize, lrVp.x() + m_handleHalfSize, lrVp.y() + m_handleHalfSize);
> -            gc.drawLine(lrVp.x() - m_handleHalfSize, lrVp.y() + m_handleHalfSize, lrVp.x() + m_handleHalfSize, lrVp.y() - m_handleHalfSize);
> -        }
> -    }
> -    if (m_higlightedNode) {
> -        gc.setBrush(cfg.getGridMainColor());
> -        drawSmallRectangle(gc, pixelToView(*m_higlightedNode));
> -    }
> -}
> -
> diff --git a/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.h b/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.h
> deleted file mode 100644
> index 82c344c..0000000
> --- a/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.h
> +++ /dev/null
> @@ -1,113 +0,0 @@
> -/*
> - *  kis_tool_perspectivegrid.h - part of Krita
> - *
> - *  Copyright (c) 2006 Cyrille Berger <cberger at cberger.net>
> - *
> - *  This library is free software; you can redistribute it and/or modify
> - *  it under the terms of the GNU Lesser General Public License as published by
> - *  the Free Software Foundation; version 2.1 of the License.
> - *
> - *  This library 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 Lesser General Public License for more details.
> - *
> - *  You should have received a copy of the GNU Lesser 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_TOOL_PERSPECTIVE_GRID_H_
> -#define _KIS_TOOL_PERSPECTIVE_GRID_H_
> -
> -#include <kis_perspective_grid.h>
> -#include <kis_tool.h>
> -#include <KoToolFactoryBase.h>
> -#include <kis_icon.h>
> -
> -class KisPerspectiveGridDecoration;
> -class KisCanvas2;
> -
> -class KisToolPerspectiveGrid : public KisTool
> -{
> -    Q_OBJECT
> -    enum PerspectiveGridEditionMode {
> -        MODE_CREATION, // This is the mode when there is not yet a perspective grid
> -        MODE_EDITING, // This is the mode when the grid has been created, and we are waiting for the user to click on a control box
> -        MODE_DRAGGING_NODE, // In this mode one node is translated
> -        MODE_DRAGGING_TRANSLATING_TWONODES // This mode is used when creating a new sub perspective grid
> -    };
> -
> -public:
> -    KisToolPerspectiveGrid(KoCanvasBase * canvas);
> -    virtual ~KisToolPerspectiveGrid();
> -
> -    //
> -    // KisToolPaint interface
> -    //
> -
> -    virtual quint32 priority() {
> -        return 3;
> -    }
> -
> -    void beginPrimaryAction(KoPointerEvent *event);
> -    void continuePrimaryAction(KoPointerEvent *event);
> -    void endPrimaryAction(KoPointerEvent *event);
> -
> -public Q_SLOTS:
> -    virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
> -    void deactivate();
> -
> -protected:
> -
> -    virtual void paint(QPainter& gc, const KoViewConverter &converter);
> -    void drawGridCreation(QPainter& gc);
> -    void drawGrid(QPainter& gc);
> -
> -private:
> -    void drawSmallRectangle(QPainter& gc, const QPointF& p);
> -    bool mouseNear(const QPointF& mousep, const QPointF& point);
> -    KisPerspectiveGridNodeSP nodeNearPoint(KisSubPerspectiveGrid* grid, QPointF point);
> -
> -    KisPerspectiveGridDecoration* decoration();
> -protected:
> -    QPointF m_dragEnd;
> -
> -    bool m_isFirstPoint;
> -    QPointF m_currentPt;
> -private:
> -    typedef QVector<QPointF> QPointFVector;
> -
> -    QPointFVector m_points;
> -    PerspectiveGridEditionMode m_internalMode;
> -    qint32 m_handleSize, m_handleHalfSize;
> -    KisPerspectiveGridNodeSP m_selectedNode1, m_selectedNode2, m_higlightedNode;
> -    KisCanvas2* m_canvas;
> -};
> -
> -
> -class KisToolPerspectiveGridFactory : public KoToolFactoryBase
> -{
> -
> -public:
> -    KisToolPerspectiveGridFactory()
> -            : KoToolFactoryBase("KisToolPerspectiveGrid") {
> -        setToolTip(i18n("Perspective Grid Tool"));
> -        setToolType(TOOL_TYPE_VIEW);
> -        setIconName(koIconNameCStr("tool_perspectivegrid"));
> -        setPriority(16);
> -        setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
> -    };
> -
> -
> -    virtual ~KisToolPerspectiveGridFactory() {}
> -
> -    virtual KoToolBase * createTool(KoCanvasBase * canvas) {
> -        return new KisToolPerspectiveGrid(canvas);
> -    }
> -
> -};
> -
> -
> -#endif
> -
> diff --git a/plugins/tools/tool_perspectivegrid/kritatoolperspectivegrid.json b/plugins/tools/tool_perspectivegrid/kritatoolperspectivegrid.json
> deleted file mode 100644
> index e163b03..0000000
> --- a/plugins/tools/tool_perspectivegrid/kritatoolperspectivegrid.json
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -{
> -    "Id": "Perspective Grid Tool",
> -    "Type": "Service",
> -    "X-KDE-Library": "kritatoolperspectivegrid",
> -    "X-KDE-ServiceTypes": [
> -        "Krita/Tool"
> -    ],
> -    "X-Krita-Version": "28"
> -}
> diff --git a/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.cc b/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.cc
> deleted file mode 100644
> index 49ab206..0000000
> --- a/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.cc
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -/*
> - * tool_perspectivegrid.cc -- Part of Krita
> - *
> - *  Copyright (c) 2006 Cyrille Berger <cberger at cberger.net>
> - *
> - *  This library is free software; you can redistribute it and/or modify
> - *  it under the terms of the GNU Lesser General Public License as published by
> - *  the Free Software Foundation; version 2.1 of the License.
> - *
> - *  This library 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 Lesser General Public License for more details.
> - *
> - *  You should have received a copy of the GNU Lesser 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 "tool_perspectivegrid.h"
> -#include <stdlib.h>
> -#include <vector>
> -
> -#include <QPoint>
> -
> -#include <klocalizedstring.h>
> -
> -#include <kis_debug.h>
> -#include <kpluginfactory.h>
> -
> -#include <kis_global.h>
> -#include <kis_types.h>
> -#include <KoToolRegistry.h>
> -
> -
> -#include "kis_tool_perspectivegrid.h"
> -
> -K_PLUGIN_FACTORY_WITH_JSON(ToolPerspectiveGridFactory, "kritatoolperspectivegrid.json", registerPlugin<ToolPerspectiveGrid>();)
> -
> -
> -ToolPerspectiveGrid::ToolPerspectiveGrid(QObject *parent, const QVariantList &)
> -        : QObject(parent)
> -{
> -    KoToolRegistry::instance()->add(new KisToolPerspectiveGridFactory());
> -}
> -
> -ToolPerspectiveGrid::~ToolPerspectiveGrid()
> -{
> -}
> -
> -#include "tool_perspectivegrid.moc"
> diff --git a/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.h b/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.h
> deleted file mode 100644
> index fa8b6a2..0000000
> --- a/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.h
> +++ /dev/null
> @@ -1,36 +0,0 @@
> -/*
> - *  Copyright (c) 2006 Cyrille Berger <cberger at cberger.net>
> - *
> - *  This library is free software; you can redistribute it and/or modify
> - *  it under the terms of the GNU Lesser General Public License as published by
> - *  the Free Software Foundation; version 2.1 of the License.
> - *
> - *  This library 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 Lesser General Public License for more details.
> - *
> - *  You should have received a copy of the GNU Lesser 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 TOOL_PERSPECTIVE_GRID_H_
> -#define TOOL_PERSPECTIVE_GRID_H_
> -
> -#include <QObject>
> -#include <QVariant>
> -
> -/**
> - * A module that provides a tool for editing the perspective grid.
> - */
> -class ToolPerspectiveGrid : public QObject
> -{
> -    Q_OBJECT
> -public:
> -    ToolPerspectiveGrid(QObject *parent, const QVariantList &);
> -    virtual ~ToolPerspectiveGrid();
> -
> -};
> -
> -#endif // TOOL_PERSPECTIVE_GRID_H_
> diff --git a/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.qrc b/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.qrc
> deleted file mode 100644
> index c8e8765..0000000
> --- a/plugins/tools/tool_perspectivegrid/tool_perspectivegrid.qrc
> +++ /dev/null
> @@ -1,6 +0,0 @@
> -<!DOCTYPE RCC>
> -<RCC version="1.0">
> -    <qresource>
> -        <file>tool_perspectivegrid_cursor.png</file>
> -    </qresource>
> -</RCC>
> diff --git a/plugins/tools/tool_perspectivegrid/tool_perspectivegrid_cursor.png b/plugins/tools/tool_perspectivegrid/tool_perspectivegrid_cursor.png
> deleted file mode 100644
> index 9a61178..0000000
> Binary files a/plugins/tools/tool_perspectivegrid/tool_perspectivegrid_cursor.png and /dev/null differ
>

-- 
Boudewijn Rempt | http://www.krita.org, http://www.valdyas.org


More information about the kimageshop mailing list