17 #include "selectionpainter.h"
21 #include "layermanager.h"
25 SelectionPainter::SelectionPainter()
29 void SelectionPainter::paint(
QPainter& painter,
35 Layer* layer =
object->getLayer(layerIndex);
37 if (layer ==
nullptr) {
return; }
39 if (layer->type() == Layer::BITMAP)
51 if (layer->type() == Layer::VECTOR)
55 painter.
drawPolygon(tParams.currentSelectionPolygonF);
58 if (layer->type() != Layer::VECTOR || tool->type() != SELECT)
63 int radius = width / 2;
65 const QRectF topLeftCorner =
QRectF(tParams.currentSelectionPolygonF[0].x() - radius,
66 tParams.currentSelectionPolygonF[0].y() - radius,
70 const QRectF topRightCorner =
QRectF(tParams.currentSelectionPolygonF[1].x() - radius,
71 tParams.currentSelectionPolygonF[1].y() - radius,
75 const QRectF bottomRightCorner =
QRectF(tParams.currentSelectionPolygonF[2].x() - radius,
76 tParams.currentSelectionPolygonF[2].y() - radius,
80 const QRectF bottomLeftCorner =
QRectF(tParams.currentSelectionPolygonF[3].x() - radius,
81 tParams.currentSelectionPolygonF[3].y() - radius,
QPolygon toPolygon() const const
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule)
void drawRect(const QRectF &rectangle)
void setPen(const QColor &color)
void setBrush(const QBrush &brush)