21#include <QApplication>
26#include <klocalizedstring.h>
87 dynamic_cast<
KisCanvas2*>(canvas)->coordinatesConverter(),
88 dynamic_cast<
KisCanvas2*>(canvas)->snapGuide(),
89 m_currentArgs, m_transaction))
92 dynamic_cast<
KisCanvas2*>(canvas)->coordinatesConverter(),
93 dynamic_cast<
KisCanvas2*>(canvas)->snapGuide(),
94 m_currentArgs, m_transaction))
97 dynamic_cast<
KisCanvas2*>(canvas)->coordinatesConverter(),
98 m_currentArgs, m_transaction, canvas->resourceManager()))
101 dynamic_cast<
KisCanvas2*>(canvas)->coordinatesConverter(),
102 dynamic_cast<
KisCanvas2*>(canvas)->snapGuide(),
103 m_currentArgs, m_transaction))
106 dynamic_cast<
KisCanvas2*>(canvas)->coordinatesConverter(),
107 dynamic_cast<
KisCanvas2*>(canvas)->snapGuide(),
108 m_currentArgs, m_transaction))
109 , m_perspectiveStrategy(
111 dynamic_cast<
KisCanvas2*>(canvas)->coordinatesConverter(),
112 dynamic_cast<
KisCanvas2*>(canvas)->snapGuide(),
113 m_currentArgs, m_transaction))
118 setObjectName(
"tool_transform");
205 KConfigGroup group = KSharedConfig::openConfig()->group(
toolId());
247 QPolygonF hullF = hull;
259 warnTools <<
"WARNING: KisToolTransform: calculated convex hull's bounds "
260 "differ from the bounding rect of the source clip. It shouldn't "
298 QPainterPath mappedOutline =
323 QRect canvasUpdateRect;
326 canvasUpdateRect =
m_canvas->coordinatesConverter()->
331 getCursorOutline().translated(imagePos);
339 if (!canvasUpdateRect.isEmpty()) {
341 canvasUpdateRect =
kisGrowRect(canvasUpdateRect, 2);
342 m_canvas->updateCanvas(canvasUpdateRect);
358 if (usePrimaryAction) {
381 if (usePrimaryAction) {
402 if (usePrimaryAction) {
521 QPointF mousePos =
m_canvas->coordinatesConverter()->documentToImage(event->
point);
751 QTransform thumbToImageTransform;
753 const int maxSize = 2000;
757 srcRect.getRect(&x, &y, &w, &h);
760 if (w > maxSize || h > maxSize) {
761 qreal scale = qreal(maxSize) / (w > h ? w : h);
762 QTransform scaleTransform = QTransform::fromScale(scale, scale);
767 createThumbnail(thumbRect.width(),
772 thumbToImageTransform = scaleTransform.inverted();
778 thumbToImageTransform = QTransform();
784 m_freeStrategy->setThumbnailImage(origImg, thumbToImageTransform);
786 m_warpStrategy->setThumbnailImage(origImg, thumbToImageTransform);
787 m_cageStrategy->setThumbnailImage(origImg, thumbToImageTransform);
789 m_meshStrategy->setThumbnailImage(origImg, thumbToImageTransform);
796 QSet<KoShape*> dummy;
921 i18nc(
"floating message in transformation tool",
922 "Layer type cannot use the transform tool"),
928 i18nc(
"floating message in transformation tool",
929 "Layer type cannot use the transform tool. Use transform mask instead."),
941 return node->inherits(
"KisTransformMask") && node->
visible(
true);
944 if (impossibleMask) {
948 i18nc(
"floating message in transformation tool",
949 "Layer has children with transform masks. Please disable them before doing transformation."),
962 i18nc(
"floating message in transformation tool",
963 "Selections are not used when editing transform masks "),
979 strategy = transformStrategy;
991 strategy = transformStrategy;
1046 showFloatingMessage(
1047 i18nc(
"floating message in transformation tool",
1048 "Cannot transform empty layer "),
1072 showFloatingMessage(
1073 i18nc(
"floating message in transformation tool",
1074 "Invisible sublayers will also be transformed. Lock layers if you do not want them to be transformed "),
1085 showFloatingMessage(
1086 i18nc(
"floating message in transformation tool",
1087 "Cannot transform empty layer "),
1141 specialSpacer->setObjectName(
"SpecialSpacer");
1142 specialSpacer->setFixedSize(0, 0);
1220 if (needsPreviewRecalculation) {
1264 if (transformDiffers &&
1445 actions << actionRegistry->
makeQAction(
"movetool-move-up",
this);
1446 actions << actionRegistry->
makeQAction(
"movetool-move-down",
this);
1447 actions << actionRegistry->
makeQAction(
"movetool-move-left",
this);
1448 actions << actionRegistry->
makeQAction(
"movetool-move-right",
this);
1449 actions << actionRegistry->
makeQAction(
"movetool-move-up-more",
this);
1450 actions << actionRegistry->
makeQAction(
"movetool-move-down-more",
this);
1451 actions << actionRegistry->
makeQAction(
"movetool-move-left-more",
this);
1452 actions << actionRegistry->
makeQAction(
"movetool-move-right-more",
this);
float value(const T *src, size_t ch)
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
QAction * makeQAction(const QString &name, QObject *parent=0)
static KisActionRegistry * instance()
void startUpdateStreamLowLevel()
void initUpdateStreamLowLevel(KisStrokesFacade *strokesFacade, KisStrokeId strokeId)
void cancelUpdateStream()
KisViewManager * viewManager() const
static KisConfigNotifier * instance()
static QCursor waitCursor()
static QCursor pointingHandCursor()
bool cancelStroke(KisStrokeId id) override
void addJob(KisStrokeId id, KisStrokeJobData *data) override
KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy) override
void endStroke(KisStrokeId id) override
QRect exactBounds() const
QImage convertToQImage(const KoColorProfile *dstProfile, qint32 x, qint32 y, qint32 w, qint32 h, KoColorConversionTransformation::Intent renderingIntent=KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::ConversionFlags conversionFlags=KoColorConversionTransformation::internalConversionFlags()) const
The KisResourcesSnapshot class takes a snapshot of the various resources like colors and settings use...
KisNodeList selectedNodes() const
KisSelectionSP activeSelection() const
void addConnection(Sender sender, Signal signal, Receiver receiver, Method method, Qt::ConnectionType type=Qt::AutoConnection)
bool isTouchEvent() const
QPointF point
The point in document coordinates.
#define KIS_SAFE_ASSERT_RECOVER(cond)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
#define KIS_ASSERT_RECOVER_RETURN(cond)
#define KIS_ASSERT_RECOVER_NOOP(cond)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
T kisGrowRect(const T &rect, U offset)
#define koIcon(name)
Use these macros for icons without any issues.
QSharedPointer< T > toQShared(T *ptr)
QList< KisNodeSP > KisNodeList
KisNodeSP recursiveFindNode(KisNodeSP node, std::function< bool(KisNodeSP)> func)
void filterMergeableNodes(KisNodeList &nodes, bool allowMasks)
bool isEditable(bool checkVisibility=true) const
virtual bool visible(bool recursive=false) const