11#include <QPainterPath>
32#define HANDLE_DISTANCE 10
37 , m_decorationThickness(1)
38 , m_showFillGradientHandles(false)
39 , m_showStrokeFillGradientHandles(false)
40 , m_forceShapeOutlines(false)
87 if (selectedShapes.isEmpty())
return;
89 const bool haveOnlyOneEditableShape =
91 selectedShapes.size() == 1;
93 bool editable =
false;
94 bool forceBoundingRubberLine =
false;
108 if (polys.size() == 1) {
109 const QPolygonF poly1 = polys[0];
110 const QPolygonF poly2 = QPolygonF(polys[0].boundingRect());
111 const QPolygonF nonoverlap = poly2.subtracted(poly1);
113 forceBoundingRubberLine |= !nonoverlap.isEmpty();
116 Q_FOREACH (
const QPolygonF &poly, polys) {
130 if (selectedShapes.size() > 1 || forceBoundingRubberLine) {
145 QPolygonF outline = handleArea;
152 helper.
drawHandleRect(0.5 * (outline.value(0) + outline.value(1)));
153 helper.
drawHandleRect(0.5 * (outline.value(1) + outline.value(2)));
154 helper.
drawHandleRect(0.5 * (outline.value(2) + outline.value(3)));
155 helper.
drawHandleRect(0.5 * (outline.value(3) + outline.value(0)));
163 if (haveOnlyOneEditableShape) {
164 KoShape *shape = selectedShapes.first();
190 if (gradientHandles.
type() == QGradient::LinearGradient) {
193 if (handles.size() == 2) {
226 for (
const auto& corner: cornerHandles) {
227 const QPointF point = t.map(corner.pos);
246 for (
const auto &path: paths) {
float value(const T *src, size_t ch)
The KisHandlePainterHelper class is a special helper for painting handles around objects....
void drawHandleSmallCircle(const QPointF ¢er)
void drawPath(const QPainterPath &path)
void drawGradientCrossHandle(const QPointF ¢er, qreal radius)
void drawHandleRect(const QPointF ¢er, qreal radius)
void drawConnectionLine(const QLineF &line)
void setHandleStyle(const KisHandleStyle &style)
void drawGradientHandle(const QPointF ¢er, qreal radius)
void drawGradientArrow(const QPointF &start, const QPointF &end, qreal radius)
void drawRubberLine(const QPolygonF &poly)
void drawHandleCircle(const QPointF ¢er, qreal radius)
static KisHandleStyle & gradientHandles()
static KisHandleStyle & highlightedPrimaryHandlesWithSolidOutline()
static KisHandleStyle & highlightedPrimaryHandles()
static KisHandleStyle & gradientArrows()
static KisHandleStyle & secondarySelection()
static KisHandleStyle & primarySelection()
QVariant resource(int key) const
const QList< KoShape * > selectedVisibleShapes() const
QRectF outlineRect() const override
const QList< KoShape * > selectedEditableShapes() const
QGradient::Type type() const
QVector< Handle > handles() const
QPainterPath path() const
QVector< QPainterPath > getConnectedPath(const Handle &handle) const
Handle getHandle(SvgMeshPosition position) const
convenience method to get a handle by its position in the mesharray
QPointF getAttachedCorner(const Handle &bezierHandle) const
get the attached corner node of the bezierHandle
QVector< Handle > handles() const
get all nodes in the mesh, don't use this for drawing the path but use path()
virtual QRectF outlineRect() const
virtual QPainterPath outline() const
virtual bool isShapeEditable(bool recursive=true) const
checks recursively if the shape or one of its parents is not visible or locked
QTransform absoluteTransformation() const
static KisHandlePainterHelper createHandlePainterHelperView(QPainter *painter, KoShape *shape, const KoViewConverter &converter, qreal handleRadius=0.0, int decorationThickness=1)
static QList< KoShape * > linearizeSubtree(const QList< KoShape * > &shapes)
void setDecorationThickness(int thickness)
bool m_showFillGradientHandles
void paintGradientHandles(KoShape *shape, KoFlake::FillVariant fillVariant, QPainter &painter, const KoViewConverter &converter)
void setCurrentMeshGradientHandles(const KoShapeMeshGradientHandles::Handle &selectedHandle, const KoShapeMeshGradientHandles::Handle &hoveredHandle)
SelectionDecorator(KoCanvasResourceProvider *resourceManager)
int m_decorationThickness
void paint(QPainter &painter, const KoViewConverter &converter)
void setSelection(KoSelection *selection)
KoFlake::AnchorPosition m_hotPosition
void paintMeshGradientHandles(KoShape *shape, KoFlake::FillVariant fillVariant, QPainter &painter, const KoViewConverter &converter)
void setShowFillMeshGradientHandles(bool value)
bool m_showStrokeFillGradientHandles
bool m_showFillMeshGradientHandles
void setForceShapeOutlines(bool value)
KoSelection * m_selection
void setShowStrokeFillGradientHandles(bool value)
bool m_forceShapeOutlines
void setHandleRadius(int radius)
KoShapeMeshGradientHandles::Handle m_selectedMeshHandle
KoShapeMeshGradientHandles::Handle m_currentHoveredMeshHandle
void setShowFillGradientHandles(bool value)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
KRITAFLAKE_EXPORT QPointF anchorToPoint(AnchorPosition anchor, const QRectF rect, bool *valid=0)
SvgMeshPosition getPosition() const