Krita Source Code Documentation
Loading...
Searching...
No Matches
KoPathPointMoveCommandPrivate Class Reference

Public Member Functions

void applyOffset (qreal factor)
 
 KoPathPointMoveCommandPrivate ()
 

Public Attributes

QSet< KoPathShape * > paths
 
QMap< KoPathPointData, QPointF > points
 

Detailed Description

Definition at line 15 of file KoPathPointMoveCommand.cpp.

Constructor & Destructor Documentation

◆ KoPathPointMoveCommandPrivate()

KoPathPointMoveCommandPrivate::KoPathPointMoveCommandPrivate ( )
inline

Definition at line 18 of file KoPathPointMoveCommand.cpp.

18{ }

Member Function Documentation

◆ applyOffset()

void KoPathPointMoveCommandPrivate::applyOffset ( qreal factor)

Definition at line 100 of file KoPathPointMoveCommand.cpp.

101{
102 QMap<KoShape*, QRectF> oldDirtyRects;
103
104 foreach (KoPathShape *path, paths) {
105 oldDirtyRects[path] = path->boundingRect();
106 }
107
108 QMap<KoPathPointData, QPointF>::iterator it(points.begin());
109 for (; it != points.end(); ++it) {
110 KoPathShape *path = it.key().pathShape;
111 // transform offset from document to shape coordinate system
112 QPointF shapeOffset = path->documentToShape(factor*it.value()) - path->documentToShape(QPointF());
113 QTransform matrix;
114 matrix.translate(shapeOffset.x(), shapeOffset.y());
115
116 KoPathPoint *p = path->pointByIndex(it.key().pointIndex);
117 if (p)
118 p->map(matrix);
119 }
120
121 foreach (KoPathShape *path, paths) {
122 path->normalize();
123 // repaint new bounding rect
124 path->updateAbsolute(oldDirtyRects[path] | path->boundingRect());
125 }
126}
const Params2D p
QMap< KoPathPointData, QPointF > points
A KoPathPoint represents a point in a path.
void map(const QTransform &matrix)
apply matrix on the point
The position of a path point within a path shape.
Definition KoPathShape.h:63
QPointF documentToShape(const QPointF &point) const
Transforms point from document coordinates to shape coordinates.
Definition KoShape.cpp:1211

References KoShape::documentToShape(), KoPathPoint::map(), p, paths, and points.

Member Data Documentation

◆ paths

QSet<KoPathShape*> KoPathPointMoveCommandPrivate::paths

Definition at line 22 of file KoPathPointMoveCommand.cpp.

◆ points

QMap<KoPathPointData, QPointF > KoPathPointMoveCommandPrivate::points

Definition at line 21 of file KoPathPointMoveCommand.cpp.


The documentation for this class was generated from the following file: