Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeMeshGradientHandles.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Dmitry Kazakov <dimula73@gmail.com>
3 * SPDX-FileCopyrightText: 2020 Sharaf Zaman <sharafzaz121@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8#ifndef __KOSHAPEMESHGRADIENTHANDLES_H_
9#define __KOSHAPEMESHGRADIENTHANDLES_H_
10
11#include <QPointF>
12#include <KoFlake.h>
13
14#include <SvgMeshGradient.h>
15
16class KUndo2Command;
17
19public:
20 struct Handle {
26
27 enum Index {
28 First = 1,
29 Second
30 };
31
33 Handle(Type t, const QPointF &p, int row, int col, SvgMeshPatch::Type segmentType, Index index = First)
34 : type(t) , pos(p)
35 , row(row) , col(col)
37 , index(index)
38 {
39 }
40
44
46 QPointF pos;
47 int row {0};
48 int col {0};
50 Index index { First }; // first or the second bezier handle
51 };
52
53public:
55
58
60 Handle getHandle(SvgMeshPosition position) const;
61
62 KUndo2Command* moveGradientHandle(const Handle &handle, const QPointF &newPos);
63
64 QPainterPath path() const;
65 QVector<QPainterPath> getConnectedPath(const Handle &handle) const;
66
68 QPointF getAttachedCorner(const Handle &bezierHandle) const;
69
70private:
71 const SvgMeshGradient* gradient() const;
72
76 int row,
77 int col) const;
78
79 // get only bezier handles
82 int row,
83 int col) const;
84
86
87private:
90};
91
92#endif // __KOSHAPEMESHGRADIENTHANDLES_H_
const Params2D p
QVector< Handle > getHandles(const SvgMeshArray *mesharray, SvgMeshPatch::Type type, int row, int col) const
get handles including the corner
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)
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()
Type
Position of stop in the patch.
FillVariant
Definition KoFlake.h:28
@ Fill
Definition KoFlake.h:29
Handle(Type t, const QPointF &p, int row, int col, SvgMeshPatch::Type segmentType, Index index=First)