22 , m_radii(100.0, 100.0)
35 m_kindAngle(rhs.m_kindAngle),
36 m_center(rhs.m_center),
39 m_clockwise(rhs.m_clockwise)
70 matrix.translate(-offset.x(), -offset.y());
87 angle = (diff.y() < 0 ? 270 : 90) *
M_PI / 180.0;
90 angle = atan(diff.y() / diff.x());
102 m_handles[handleId] =
p;
107 m_handles[handleId] =
p;
113 kindHandlePositions.push_back(
m_center);
114 kindHandlePositions.push_back((m_handles[0] + m_handles[1]) / 2.0);
118 for (
int i = 0; i < kindHandlePositions.size(); ++i) {
119 QPointF pointDiff(
p - kindHandlePositions[i]);
120 if (i == 0 || qAbs(pointDiff.x()) + qAbs(pointDiff.y()) < qAbs(diff.x()) + qAbs(diff.y())) {
125 m_handles[handleId] = kindHandlePositions[handlePos];
138 QPointF startpoint(m_handles[0]);
140 QPointF curvePoints[12];
146 m_points[cp]->unsetProperty(KoPathPoint::HasControlPoint1);
147 for (
int i = 0; i < pointCnt; i += 3) {
148 m_points[cp]->setControlPoint2(curvePoints[i]);
149 m_points[++cp]->setControlPoint1(curvePoints[i + 1]);
150 m_points[cp]->setPoint(curvePoints[i + 2]);
151 m_points[cp]->unsetProperty(KoPathPoint::HasControlPoint2);
155 m_points[cp]->unsetProperty(KoPathPoint::HasControlPoint1);
156 m_points[cp]->unsetProperty(KoPathPoint::HasControlPoint2);
157 }
else if (
m_type ==
Line && m_startAngle == m_endAngle) {
163 d->m_subpaths[0]->clear();
164 for (
int i = 0; i <= cp; ++i) {
165 if (i < cp || (
m_type ==
Line && m_startAngle != m_endAngle)) {
170 d->m_subpaths[0]->push_back(
m_points[i]);
182 qreal adv_ang = (
m_clockwise ? -1.0 : 1.0) * M_PI_2;
184 qreal m_radius =
m_radii.x() / 2.0;
187 QPointF oldP(center.x(), (
m_clockwise ? -1.0 : 1.0) * m_radius + center.y());
189 QPointF newCenter(center);
191 uint m_segments = 10;
194 for (
uint i = 0; i < m_segments; ++i) {
195 newP.setX(r * cos(adv_ang * (i + 2)) + newCenter.x());
196 newP.setY(r * sin(adv_ang * (i + 2)) + newCenter.y());
199 qreal rx = qAbs(oldP.x() - newP.x());
200 qreal ry = qAbs(oldP.y() - newP.y());
202 arcTo(rx, ry, ((i + 1) % 4) * 90, 90);
204 arcTo(rx, ry, 360 - ((i + 1) % 4) * 90, -90);
210 newCenter += (newP - newCenter) * (1.0 -
m_fade);
QSharedDataPointer< Private > d
QPointF normalize() override
Normalizes the path data.
void setSize(const QSizeF &size) override
reimplemented from KoShape
A KoPathPoint represents a point in a path.
@ CloseSubpath
it closes a subpath (only applicable on StartSubpath and StopSubpath)
const KoSubpathList & subpaths() const
QTransform resizeMatrix(const QSizeF &newSize) const
KoPathPoint * lineTo(const QPointF &p)
Adds a new line segment.
QSizeF size() const override
reimplemented
void notifyPointsChanged()
KoPathPoint * moveTo(const QPointF &p)
Starts a new Subpath.
int arcToCurve(qreal rx, qreal ry, qreal startAngle, qreal sweepAngle, const QPointF &offset, QPointF *curvePoints) const
Add an arc.
KoPathPoint * arcTo(qreal rx, qreal ry, qreal startAngle, qreal sweepAngle)
Add an arc.
void clear()
Removes all subpaths and their points from the path.
void updatePath(const QSizeF &size) override
Update the path of the parameter shape.
void setSize(const QSizeF &newSize) override
reimplemented from KoShape
SpiralType
the possible spiral types
@ Curve
spiral uses curves
KoShape * cloneShape() const override
creates a deep copy of the shape or shape's subtree
QPointF normalize() override
Normalizes the path data.
void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers=Qt::NoModifier) override
Updates the internal state of a KoParameterShape.
void setType(SpiralType type)
QString pathShapeId() const override
reimplemented
void setClockWise(bool clockwise)
qreal fade() const
Returns the actual fade parameter.
void updateAngleHandles()
SpiralType type() const
Returns the actual spiral type.
void createPath(const QSizeF &size)
#define KIS_ASSERT_RECOVER(cond)