23#include <klocalizedstring.h>
24#include <ksharedconfig.h>
93#define DECORATION_COUNT 5
99 setObjectName(
"tool_crop");
296 const QRect initialRect = QRect(
m_dragStart, QSize(initialWidth, initialHeight));
323 if ((lastCommand =
image()->undoAdapter()->presentCommand()) &&
326 bool cropImageConsistent =
331 bool cropLayerConsistent =
337 if (cropImageConsistent || cropLayerConsistent) {
357 const bool haveValidRect =
406#define BORDER_LINE_WIDTH 0
407#define HALF_BORDER_LINE_WIDTH 0
408#define HANDLE_BORDER_LINE_WIDTH 1
420#define OUTSIDE_CROP_ALPHA 200
432 path.addRect(wholeImageRect);
433 path.addRect(borderRect);
434 gc.setPen(Qt::NoPen);
439 QPen pen(Qt::SolidLine);
441 pen.setColor(Qt::black);
442 pen.setCosmetic(
true);
447 gc.setClipRect(borderRect, Qt::IntersectClip);
742 specialSpacer->setObjectName(
"SpecialSpacer");
743 specialSpacer->setFixedSize(0, 0);
766 connect(
applyCrop, SIGNAL(triggered(
bool)),
this, SLOT(
crop()));
854 }
else if (
leftHandleRect(borderRect).contains(currentViewPoint)) {
858 }
else if (borderRect.contains(currentViewPoint)) {
909 QPointF start =
rect.topLeft();
910 QPointF end =
rect.topLeft();
911 qreal small = qMin(
rect.width(),
rect.height());
912 qreal large = qMax(
rect.width(),
rect.height());
916 start.setX(start.x() + decorLine->
start.x() *
rect.width());
919 start.setX(start.x() + decorLine->
start.x() *
rect.height());
922 start.setX(start.x() + decorLine->
start.x() * small);
925 start.setX(start.x() + decorLine->
start.x() * large);
931 start.setY(start.y() + decorLine->
start.y() *
rect.width());
934 start.setY(start.y() + decorLine->
start.y() *
rect.height());
937 start.setY(start.y() + decorLine->
start.y() * small);
940 start.setY(start.y() + decorLine->
start.y() * large);
946 end.setX(end.x() + decorLine->
end.x() *
rect.width());
949 end.setX(end.x() + decorLine->
end.x() *
rect.height());
952 end.setX(end.x() + decorLine->
end.x() * small);
955 end.setX(end.x() + decorLine->
end.x() * large);
961 end.setY(end.y() + decorLine->
end.y() *
rect.width());
964 end.setY(end.y() + decorLine->
end.y() *
rect.height());
967 end.setY(end.y() + decorLine->
end.y() * small);
970 end.setY(end.y() + decorLine->
end.y() * large);
974 p->drawLine(start, end);
float value(const T *src, size_t ch)
KUndo2CommandExtraData * extraData() const
KisViewManager * viewManager() const
void setHeight(int value)
void setRatio(qreal value)
void moveHandle(HandleType handle, const QPoint &offset, const QRect &oldRect)
bool heightLocked() const
void setRectInitial(const QRect &rect)
QPointF handleSnapPoint(HandleType handle, const QPointF &cursorPos)
void setCropRect(const QRect &cropRect)
void setCentered(bool value)
void setCanGrow(bool value)
void setOffset(const QPoint &offset)
void setHeightLocked(bool value)
void setRatioLocked(bool value)
void setWidthLocked(bool value)
static QCursor sizeBDiagCursor()
static QCursor sizeAllCursor()
static QCursor sizeHorCursor()
static QCursor sizeFDiagCursor()
static QCursor arrowCursor()
static QCursor sizeVerCursor()
void resizeImage(const QRect &newRect)
start asynchronous operation on resizing the image
KisUndoAdapter * undoAdapter() const
void cropNode(KisNodeSP node, const QRect &newRect, const bool activeFrameOnly=false)
start asynchronous operation on cropping a subtree of nodes starting at node
QPointF pixelToDocument(const QPointF &pixelCoord) const
void cropImage(const QRect &newRect)
start asynchronous operation on cropping the image
QRect bounds() const override
The KisResourcesSnapshot class takes a snapshot of the various resources like colors and settings use...
KisNodeSP currentNode() const
KisSelectionSP activeSelection() const
virtual void undoLastCommand()=0
virtual const KUndo2Command * presentCommand()=0
void showFloatingMessage(const QString &message, const QIcon &icon, int timeout=4500, KisFloatingMessage::Priority priority=KisFloatingMessage::Medium, int alignment=Qt::AlignCenter|Qt::TextWordWrap)
shows a floating message in the top right corner of the canvas
#define KIS_ASSERT_RECOVER_RETURN(cond)
virtual KisPaintDeviceSP paintDevice() const =0
QRect selectedExactRect() const
Slow, but exact way of determining the rectangle that encloses the selection.