This repository has been archived by the owner on Feb 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathvector_graphics_path.h
104 lines (77 loc) · 2.97 KB
/
vector_graphics_path.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*************************************************************************/
/* vg_path.h */
/*************************************************************************/
#ifndef VG_PATH_H
#define VG_PATH_H
#include "utils.h"
#include "scene/2d/mesh_instance_2d.h"
#include "vector_graphics_paint.h"
#include "vector_graphics_renderer.h"
class VGPath : public Node2D {
GDCLASS(VGPath, Node2D);
Transform2D vg_transform;
tove::PathRef tove_path;
Ref<ArrayMesh> mesh;
Ref<Texture> texture;
mutable tove::GraphicsRef subtree_graphics;
bool dirty;
Ref<VGPaint> fill_color;
Ref<VGPaint> line_color;
Ref<VGRenderer> renderer;
static void set_inherited_dirty(Node *p_node);
static void compose_graphics(const tove::GraphicsRef &p_tove_graphics,
const Transform2D &p_transform, const Node *p_node);
static void _transform_changed(Node *p_node);
bool inherits_renderer() const;
tove::GraphicsRef create_tove_graphics() const;
void add_tove_path(const tove::GraphicsRef &p_tove_graphics) const;
void update_mesh_representation();
void update_tove_fill_color();
void update_tove_line_color();
void create_fill_color();
void create_line_color();
protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
void _renderer_changed();
void _bubble_change();
void _notification(int p_what);
static void _bind_methods();
public:
virtual Rect2 _edit_get_rect() const;
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
virtual void _edit_set_position(const Point2 &p_position);
virtual void _edit_set_scale(const Size2 &p_scale);
virtual void _changed_callback(Object *p_changed, const char *p_prop);
VGPath *get_root_path();
Ref<VGRenderer> get_inherited_renderer() const;
Ref<VGRenderer> get_renderer();
void set_renderer(const Ref<VGRenderer> &p_renderer);
Ref<VGPaint> get_fill_color() const;
void set_fill_color(const Ref<VGPaint> &p_paint);
Ref<VGPaint> get_line_color() const;
void set_line_color(const Ref<VGPaint> &p_paint);
float get_line_width() const;
void set_line_width(const float p_line_width);
void set_points(int p_subpath, Array p_points);
void insert_curve(int p_subpath, float p_t);
void remove_curve(int p_subpath, int p_curve);
bool is_inside(const Point2 &p_point) const;
VGPath *find_clicked_child(const Point2 &p_point);
bool is_empty() const;
int get_num_subpaths() const;
tove::SubpathRef get_subpath(int p_subpath) const;
tove::PathRef get_tove_path() const;
tove::GraphicsRef get_subtree_graphics() const;
void set_dirty(bool p_children = false);
void set_tove_path(tove::PathRef p_path);
void recenter();
Node2D *create_mesh_node();
VGPath();
VGPath(tove::PathRef p_path);
virtual ~VGPath();
static VGPath *create_from_svg(Ref<Resource> p_resource);
void import_svg(const String &p_path);
};
#endif // VG_PATH_H