#include <kis_shape_tool_helper.h>
KisShapeToolHelper provides shapes and fallback shapes for shape based tools
Definition at line 18 of file kis_shape_tool_helper.h.
◆ createEllipseShape()
| KoShape * KisShapeToolHelper::createEllipseShape |
( |
const QRectF & | rect | ) |
|
|
static |
Definition at line 47 of file kis_shape_tool_helper.cpp.
48{
51 if (rectFactory) {
55 } else {
56
59
60 QPointF rightMiddle = QPointF(rect.left() + rect.width(), rect.top() + rect.height() / 2);
61 path->moveTo(rightMiddle);
62 path->arcTo(rect.width() / 2, rect.height() / 2, 0, 360.0);
63 path->close();
64 path->normalize();
65 shape = path;
66 }
67 return shape;
68}
const T value(const QString &id) const
The position of a path point within a path shape.
virtual KoShape * createDefaultShape(KoDocumentResourceManager *documentResources=0) const
static KoShapeRegistry * instance()
virtual void setPosition(const QPointF &position)
Set the position of the shape in pt.
virtual void setSize(const QSizeF &size)
Resize the shape.
References KoShapeFactoryBase::createDefaultShape(), KoShapeRegistry::instance(), KoPathShapeId, KoShape::setPosition(), KoShape::setSize(), and KoGenericRegistry< T >::value().
◆ createRectangleShape()
| KoShape * KisShapeToolHelper::createRectangleShape |
( |
const QRectF & | rect, |
|
|
qreal | roundCornersX, |
|
|
qreal | roundCornersY ) |
|
static |
Definition at line 17 of file kis_shape_tool_helper.cpp.
18{
20
22 if (rectFactory) {
28 props.
setProperty(
"rx", 2 * 100.0 * roundCornersX / rect.width());
29 props.
setProperty(
"ry", 2 * 100.0 * roundCornersY / rect.height());
30
32 } else {
33
34 QPainterPath path;
35 if (roundCornersX > 0 || roundCornersY > 0) {
36 path.addRoundedRect(rect, roundCornersX, roundCornersY);
37 } else {
38 path.addRect(rect);
39 }
42 shape = pathShape;
43 }
44 return shape;
45}
virtual QPointF normalize()
Normalizes the path data.
static KoPathShape * createShapeFromPainterPath(const QPainterPath &path)
Creates path shape from given QPainterPath.
void setProperty(const QString &name, const QVariant &value)
virtual KoShape * createShape(const KoProperties *params, KoDocumentResourceManager *documentResources=0) const
References KoShapeFactoryBase::createShape(), KoPathShape::createShapeFromPainterPath(), KoShapeRegistry::instance(), KoPathShape::normalize(), KoProperties::setProperty(), and KoGenericRegistry< T >::value().
The documentation for this class was generated from the following files: