2
* tool_transform_commands.h - part of Krita
4
* Copyright (c) 2010 Marc Pegon <pe.marc@free.fr>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
#ifndef TOOL_TRANSFORM_COMMANDS_H_
22
#define TOOL_TRANSFORM_COMMANDS_H_
24
#include "kis_tool_transform.h"
25
#include <kis_transaction.h>
26
#include <KoToolManager.h>
29
* There are 2 command classes associated with the transform tool,
30
* because there are 2 different actions which should be committed
31
* to the Undo Stack : when the user changes the arguments of
32
* the transformation, i.e. the preview is modified (TransformCmd),
33
* and when the user applies the transformation, i.e. the paintDevice
34
* is modified (ApplyTransformCmd)
37
class ApplyTransformCmdData : public KisSelectedTransactionData
40
ApplyTransformCmdData(KisToolTransform *tool, ToolTransformArgs::TransfMode mode, KisNodeSP node);
41
virtual ~ApplyTransformCmdData();
46
ToolTransformArgs::TransfMode mode() const;
48
KisToolTransform *m_tool;
49
ToolTransformArgs::TransfMode m_mode;
53
class ApplyTransformCmd : public KisTransaction
56
ApplyTransformCmd(KisToolTransform *tool, ToolTransformArgs::TransfMode mode, KisNodeSP node);
59
class TransformCmd : public QUndoCommand
62
TransformCmd(KisToolTransform *tool, const ToolTransformArgs &args, KisSelectionSP origSel, QPoint startPos, QPoint endPos, QImage *origImg, QImage *origSelectionImg);
63
virtual ~TransformCmd();
68
void transformArgs(ToolTransformArgs &args) const;
69
KisSelectionSP origSelection(QPoint &startPos, QPoint &endPos) const;
70
void origPreviews(QImage *&origImg, QImage *&origSelectionImg) const;
72
ToolTransformArgs m_args;
73
KisToolTransform *m_tool;
74
KisSelectionSP m_origSelection;
75
QPoint m_originalTopLeft;
76
QPoint m_originalBottomRight;
77
QImage *m_origImg, *m_origSelectionImg;
80
#endif // TOOL_TRANSFORM_COMMANDS_H_