Krita Source Code Documentation
Loading...
Searching...
No Matches
SvgMeshArray.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2020 Sharaf Zaman <sharafzaz121@gmail.com>
3
*
4
* SPDX-License-Identifier: GPL-2.0-or-later
5
*/
6
#ifndef SVGMESHARRAY_H
7
#define SVGMESHARRAY_H
8
9
#include <QVector>
10
11
#include "
SvgMeshPatch.h
"
12
13
struct
SvgMeshPosition
{
14
int
row
;
15
int
col
;
16
SvgMeshPatch::Type
segmentType
;
17
18
SvgMeshPosition
()
19
:
row
(-1)
20
,
col
(-1)
21
,
segmentType
(
SvgMeshPatch
::Size)
22
{
23
}
24
25
SvgMeshPosition
(
int
row
,
int
col
,
SvgMeshPatch::Type
type)
26
:
row
(
row
)
27
,
col
(
col
)
28
,
segmentType
(type)
29
{
30
}
31
32
bool
isValid
()
const
{
33
return
row
>= 0 &&
col
>= 0;
34
}
35
};
36
37
class
KRITAFLAKE_EXPORT
SvgMeshArray
38
{
39
public
:
40
SvgMeshArray
();
41
42
SvgMeshArray
(
const
SvgMeshArray
& other);
43
44
~SvgMeshArray
();
45
47
void
createDefaultMesh(
const
int
nrows,
const
int
ncols,
const
QColor color,
const
QSizeF size);
48
49
void
newRow();
50
51
bool
addPatch(
QList
<QPair<QString, QColor>> stops,
const
QPointF initialPoint);
52
54
SvgMeshStop
getStop(
const
SvgMeshPatch::Type
edge,
const
int
row,
const
int
col)
const
;
55
56
SvgMeshStop
getStop(
const
SvgMeshPosition
&pos)
const
;
57
59
std::array<QPointF, 4> getPath(
const
SvgMeshPatch::Type
edge,
const
int
row,
const
int
col)
const
;
60
61
// overload
62
SvgMeshPath
getPath(
const
SvgMeshPosition
&pos)
const
;
63
64
SvgMeshPatch
* getPatch(
const
int
row,
const
int
col)
const
;
65
66
int
numRows()
const
;
67
int
numColumns()
const
;
68
69
void
setTransform(
const
QTransform& matrix);
70
71
QRectF boundingRect()
const
;
72
74
QVector<SvgMeshPosition>
getConnectedPaths(
const
SvgMeshPosition
&position)
const
;
75
76
void
modifyHandle(
const
SvgMeshPosition
&position,
const
std::array<QPointF, 4> &newPath);
77
void
modifyCorner(
const
SvgMeshPosition
&position,
const
QPointF &newPos);
78
79
void
modifyColor(
const
SvgMeshPosition
&position,
const
QColor &color);
80
81
private
:
84
QVector<SvgMeshPosition>
getSharedPaths(
const
SvgMeshPosition
&position)
const
;
85
86
// get color of a stop
87
QColor getColor(
SvgMeshPatch::Type
edge,
int
row,
int
col)
const
;
88
89
private
:
91
QVector<QVector<SvgMeshPatch*>
>
m_array
;
92
};
93
94
#endif
// SVGMESHARRAY_H
SvgMeshPatch.h
SvgMeshPath
std::array< QPointF, 4 > SvgMeshPath
Definition
SvgMeshPatch.h:33
QList
Definition
KisQStringListFwd.h:16
SvgMeshArray
Definition
SvgMeshArray.h:38
SvgMeshArray::m_array
QVector< QVector< SvgMeshPatch * > > m_array
where each vector is a meshrow
Definition
SvgMeshArray.h:91
SvgMeshPatch
Definition
SvgMeshPatch.h:36
SvgMeshPatch::Type
Type
Position of stop in the patch.
Definition
SvgMeshPatch.h:39
SvgMeshPosition
Definition
SvgMeshArray.h:13
SvgMeshPosition::SvgMeshPosition
SvgMeshPosition(int row, int col, SvgMeshPatch::Type type)
Definition
SvgMeshArray.h:25
SvgMeshPosition::segmentType
SvgMeshPatch::Type segmentType
Definition
SvgMeshArray.h:16
SvgMeshPosition::SvgMeshPosition
SvgMeshPosition()
Definition
SvgMeshArray.h:18
SvgMeshPosition::isValid
bool isValid() const
Definition
SvgMeshArray.h:32
SvgMeshPosition::row
int row
Definition
SvgMeshArray.h:14
SvgMeshPosition::col
int col
Definition
SvgMeshArray.h:15
SvgMeshStop
Definition
SvgMeshPatch.h:19
libs
flake
svg
SvgMeshArray.h
Generated at
2025-11-04 02:30:02+01:00
from
Krita
branch
master
, commit
c9dde2e79561a8aea4a7e8d9ac99c98a7bac9e52