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);
737 specialSpacer->setObjectName(
"SpecialSpacer");
738 specialSpacer->setFixedSize(0, 0);
849 }
else if (
leftHandleRect(borderRect).contains(currentViewPoint)) {
853 }
else if (borderRect.contains(currentViewPoint)) {
904 QPointF start =
rect.topLeft();
905 QPointF end =
rect.topLeft();
906 qreal small = qMin(
rect.width(),
rect.height());
907 qreal large = qMax(
rect.width(),
rect.height());
911 start.setX(start.x() + decorLine->
start.x() *
rect.width());
914 start.setX(start.x() + decorLine->
start.x() *
rect.height());
917 start.setX(start.x() + decorLine->
start.x() * small);
920 start.setX(start.x() + decorLine->
start.x() * large);
926 start.setY(start.y() + decorLine->
start.y() *
rect.width());
929 start.setY(start.y() + decorLine->
start.y() *
rect.height());
932 start.setY(start.y() + decorLine->
start.y() * small);
935 start.setY(start.y() + decorLine->
start.y() * large);
941 end.setX(end.x() + decorLine->
end.x() *
rect.width());
944 end.setX(end.x() + decorLine->
end.x() *
rect.height());
947 end.setX(end.x() + decorLine->
end.x() * small);
950 end.setX(end.x() + decorLine->
end.x() * large);
956 end.setY(end.y() + decorLine->
end.y() *
rect.width());
959 end.setY(end.y() + decorLine->
end.y() *
rect.height());
962 end.setY(end.y() + decorLine->
end.y() * small);
965 end.setY(end.y() + decorLine->
end.y() * large);
969 p->drawLine(start, end);
float value(const T *src, size_t ch)
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
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.