16 : m_fillVariant(fillVariant)
26 if (!g)
return result;
30 for (
int irow = 0; irow < mesharray->
numRows(); ++irow) {
31 for (
int icol = 0; icol < mesharray->
numColumns(); ++icol) {
37 if (irow == mesharray->
numRows() - 1) {
56 for (
auto &handle: result) {
57 handle.pos = t.map(handle.pos);
71 handle.
pos = t.map(handle.
pos);
77 const QPointF &newPos)
81 SvgMeshArray *mesharray = newGradient->getMeshArray().data();
88 path[handle.
index] = t.map(newPos);
100 QPainterPath painterPath;
108 g->setTransform(gradientToUser);
113 for (
int i = 0; i < mesharray->
numRows(); ++i) {
114 for (
int j = 0; j < mesharray->
numColumns(); ++j) {
133 QPainterPath painterPath;
137 std::transform(path.begin(), path.end(), path.begin(), [&t](QPointF &point) { return t.map(point); });
138 painterPath.moveTo(path[0]);
139 painterPath.cubicTo(path[1], path[2], path[3]);
140 result << painterPath;
143 for (
const auto &position: positions) {
145 std::transform(path.begin(), path.end(), path.begin(), [&t](QPointF &point) { return t.map(point); });
146 painterPath = QPainterPath();
147 painterPath.moveTo(path[0]);
148 painterPath.cubicTo(path[1], path[2], path[3]);
149 result << painterPath;
166 return t.map(path[bezierHandle.
index - 1]);
168 return t.map(path[bezierHandle.
index + 1]);
184 std::array<QPointF, 4> path = mesharray->
getPath(type, row, col);
198 std::array<QPointF, 4> path = mesharray->
getPath(type, row, col);
std::array< QPointF, 4 > SvgMeshPath
const SvgMeshGradient * meshgradient() const
KUndo2Command * setMeshGradient(const SvgMeshGradient *gradient, const QTransform &transform)
QVector< Handle > getHandles(const SvgMeshArray *mesharray, SvgMeshPatch::Type type, int row, int col) const
get handles including the corner
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
const SvgMeshGradient * gradient() const
KUndo2Command * moveGradientHandle(const Handle &handle, const QPointF &newPos)
KoFlake::FillVariant m_fillVariant
KoShapeMeshGradientHandles(KoFlake::FillVariant fillVariant, KoShape *shape)
QTransform absoluteTransformation(KoFlake::CoordinateSystem system) const
QVector< Handle > getBezierHandles(const SvgMeshArray *mesharray, SvgMeshPatch::Type type, int row, int col) const
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
QTransform absoluteTransformation() const
QVector< SvgMeshPosition > getConnectedPaths(const SvgMeshPosition &position) const
Return the paths connected to the corner. Can be thought of as edges connected to a vertex.
void modifyCorner(const SvgMeshPosition &position, const QPointF &newPos)
void modifyHandle(const SvgMeshPosition &position, const std::array< QPointF, 4 > &newPath)
std::array< QPointF, 4 > getPath(const SvgMeshPatch::Type edge, const int row, const int col) const
Get the Path Points for a segment of the meshpatch.
SvgMeshPatch * getPatch(const int row, const int col) const
const QScopedPointer< SvgMeshArray > & getMeshArray() const
KoFlake::CoordinateSystem gradientUnits() const
QPainterPath getPath() const
Get full (closed) meshpath.
Type
Position of stop in the patch.
std::array< QPointF, 4 > getSegment(Type type) const
Get a segment of the path in the meshpatch.
QTransform mapToRect(const QRectF &rect)
SvgMeshPosition getPosition() const
SvgMeshPatch::Type segmentType
SvgMeshPatch::Type segmentType