Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_tool_ellipse.h
Go to the documentation of this file.
1/*
2 * kis_tool_ellipse.h - part of Krayon
3 *
4 * SPDX-FileCopyrightText: 2000 John Califf <jcaliff@compuzone.net>
5 * SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org>
6 * SPDX-FileCopyrightText: 2004 Clarence Dang <dang@kde.org>
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11#ifndef __KIS_TOOL_ELLIPSE_H__
12#define __KIS_TOOL_ELLIPSE_H__
13
14#include "kis_tool_shape.h"
15#include "kis_types.h"
19#include <kis_icon.h>
20
21#include <QVector>
22
23class KoCanvasBase;
24class QPainterPath;
25class QWidget;
26
28{
29 Q_OBJECT
30
31public:
33 ~KisToolEllipse() override;
34
35 bool supportsPaintingAssistants() const override;
36
37protected Q_SLOTS:
38 void resetCursorStyle() override;
39 void slotPlacementModeChanged(int mode, bool checked);
40
41protected:
46
48 void beginPrimaryAction(KoPointerEvent *event) override;
49 void continuePrimaryAction(KoPointerEvent *event) override;
50 void endPrimaryAction(KoPointerEvent *event) override;
51 void mouseMoveEvent(KoPointerEvent *event) override;
52 void paint(QPainter& gc, const KoViewConverter &converter) override;
54 void requestStrokeEnd() override;
55 void requestStrokeCancellation() override;
56 void deactivate() override;
57
58 void finishRect(const QRectF& rect, qreal roundCornersX, qreal roundCornersY) override;
59
60private:
61 bool isThreePointPlacement() const;
64 QPointF threePointPreviewPoint() const;
65 int threePointHandleAt(const QPointF &pos) const;
66 QCursor threePointConfirmCursor() const;
67 void updateThreePointPreview(const QPointF &pos);
68 void updateThreePointCursor(const QPointF &pos);
72 void paintThreePointEllipse(QPainter &gc);
73 void paintThreePointHandles(QPainter &gc);
74 bool threePointEllipsePath(const QPointF &thirdPoint, QPainterPath *path) const;
75 QRectF threePointUpdateRect() const;
76 void addThreePointEllipsePath(const QPainterPath &path);
77
78private:
86};
87
89{
90
91public:
93 : KisToolPaintFactoryBase("KritaShape/KisToolEllipse") {
94 setToolTip(i18n("Ellipse Tool"));
95 setToolName(i18n("Ellipse Tool"));
98 setIconName(koIconNameCStr("krita_tool_ellipse"));
99 setPriority(3);
100 }
101
103
105 return new KisToolEllipse(canvas);
106 }
107
108};
109
110
111#endif //__KIS_TOOL_ELLIPSE_H__
The PopupWidgetInterface abstract class defines the basic interface that will be used by all popup wi...
KoToolBase * createTool(KoCanvasBase *canvas) override
QVector< QPointF > m_threePointHandles
~KisToolEllipse() override
bool supportsPaintingAssistants() const override
bool threePointEllipsePath(const QPointF &thirdPoint, QPainterPath *path) const
KisToolEllipse(KoCanvasBase *canvas)
void finishRect(const QRectF &rect, qreal roundCornersX, qreal roundCornersY) override
void mouseMoveEvent(KoPointerEvent *event) override
void resetCursorStyle() override
void updateThreePointPreview(const QPointF &pos)
QPointF m_threePointHoverPoint
QPointF threePointPreviewPoint() const
bool canStartThreePointEllipse(KoPointerEvent *event)
PlacementMode m_placementMode
bool isThreePointPlacement() const
QRectF threePointUpdateRect() const
QList< QPointer< QWidget > > createOptionWidgets() override
bool m_threePointCommittedOnPress
bool hasCompleteThreePointEllipse() const
void endPrimaryAction(KoPointerEvent *event) override
QCursor threePointConfirmCursor() const
void paintThreePointHandles(QPainter &gc)
void beginPrimaryAction(KoPointerEvent *event) override
void addThreePointEllipsePath(const QPainterPath &path)
KisPopupWidgetInterface * popupWidget() override
void updateThreePointCursor(const QPointF &pos)
void deactivate() override
bool m_threePointCommitInProgress
void slotPlacementModeChanged(int mode, bool checked)
int threePointHandleAt(const QPointF &pos) const
void paintThreePointEllipse(QPainter &gc)
void requestStrokeEnd() override
void paint(QPainter &gc, const KoViewConverter &converter) override
void continuePrimaryAction(KoPointerEvent *event) override
void requestStrokeCancellation() override
void setSection(const QString &section)
void setActivationShapeId(const QString &activationShapeId)
void setToolName(const QString &toolName)
void setIconName(const char *iconName)
void setToolTip(const QString &tooltip)
void setPriority(int newPriority)
#define koIconNameCStr(name)
Definition kis_icon.h:28
static const QString KRITA_TOOL_ACTIVATION_ID
Definition kis_tool.h:37
static const QString Shape
Freehand and shapes like ellipses and lines.
virtual ToolMode mode() const
Definition kis_tool.cc:407
KisCanvas2 * canvas