Kage Studio 0.7.240121
A Simple Free and Open Source 2D Animation Software
Loading...
Searching...
No Matches
vectordata.h
Go to the documentation of this file.
1/*
2 * Kage Studio - a simple free and open source vector-based 2D animation software
3 * Copyright (C) 2011~2024 Mj Mendoza IV
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA. Or, see <https://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef GTKMM_KAGE_DATA_VECTOR_H
23 #define GTKMM_KAGE_DATA_VECTOR_H
24
25 #include <vector>
26 #include "color.h"
27 #include "point.h"
28 #include "strokecolor.h"
29
30 class VectorData {
31 public:
32 enum type {
33 TYPE_INIT, //holds initial fill/stroke; no vectors to use
34 TYPE_FILL, //holds fillColor; no vectors to use
35 TYPE_CLOSE_PATH, //no vectors to use
36 TYPE_ENDFILL, //holds transparent fillColor; no vectors to use
37 TYPE_STROKE, //holds strokeColor
38 TYPE_MOVE, //moves p0 to p1; p1 is to be stored
39 TYPE_LINE, //draws a line from p0 to p1
40 TYPE_CURVE_QUADRATIC, //draws a curve from p0 with kink to p1 before ending at p2 then; p1 and p2 is to be stored
41 TYPE_CURVE_CUBIC, //draws a curve from p0 with kink to p1 before ending at p2 and another from p2 with kink to p3 then ends at p4
42 TYPE_TEXT, //TODO: handle string content
43 TYPE_IMAGE, //holds 5coords for ID and bufferIndex, x/y, width/height, scaleX/scaleY, rotate/alpha
44 TYPE_KSF //TODO: 5coords for ID and bufferIndex, x/y, width/height, scaleX/scaleY, rotate/alpha
45 };
46
47 VectorData();
48 VectorData(type p_type);
49 virtual ~VectorData();
50
51 void setType(type p_type);
52 type getType() const;
53 void setPoints(std::vector<PointData> p_points);
54 std::vector<PointData> getPoints();
58 unsigned int count;
59
61 std::vector<PointData> points;
62
64 protected:
65
66 long lImg; //index reference to array of typeImage
67 };
68#endif //GTKMM_KAGE_DATA_VECTOR_H
Definition color.h:28
Definition strokecolor.h:27
void setType(type p_type)
Definition vectordata.cpp:37
VectorData()
Definition vectordata.cpp:25
virtual ~VectorData()
Definition vectordata.cpp:33
void setPoints(std::vector< PointData > p_points)
Definition vectordata.cpp:47
type getType() const
Definition vectordata.cpp:43
ColorData fillColor
Definition vectordata.h:56
std::string fillColorGradientID
Definition vectordata.h:57
VectorData clone()
Definition vectordata.cpp:56
std::vector< PointData > getPoints()
Definition vectordata.cpp:52
unsigned int count
Definition vectordata.h:58
type
Definition vectordata.h:32
@ TYPE_TEXT
Definition vectordata.h:42
@ TYPE_CURVE_CUBIC
Definition vectordata.h:41
@ TYPE_FILL
Definition vectordata.h:34
@ TYPE_CURVE_QUADRATIC
Definition vectordata.h:40
@ TYPE_IMAGE
Definition vectordata.h:43
@ TYPE_CLOSE_PATH
Definition vectordata.h:35
@ TYPE_INIT
Definition vectordata.h:33
@ TYPE_MOVE
Definition vectordata.h:38
@ TYPE_ENDFILL
Definition vectordata.h:36
@ TYPE_STROKE
Definition vectordata.h:37
@ TYPE_LINE
Definition vectordata.h:39
@ TYPE_KSF
Definition vectordata.h:44
long lImg
Definition vectordata.h:66
StrokeColorData stroke
Definition vectordata.h:55
std::vector< PointData > points
Definition vectordata.h:61
type vectorType
Definition vectordata.h:60