-
Notifications
You must be signed in to change notification settings - Fork 0
/
sprites.h
104 lines (73 loc) · 1.8 KB
/
sprites.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
/**
* Copyright 2021 Jesús Abelardo Saldívar Aguilar
*
*
*/
#include <VG/openvg.h>
#include <VG/vgu.h>
typedef struct {
VGfloat *coords;
VGubyte *cmds;
// VGPath path;
int count_cmds;
int count_coords;
} JS_VG_PATH;
typedef struct {
VGfloat cx;
VGfloat cy;
VGfloat width;
VGfloat height;
} JS_VG_ELLIPSE;
typedef struct {
VGfloat x;
VGfloat y;
VGfloat width;
VGfloat height;
VGfloat startAngle;
VGfloat angleExtent;
int arcType;
} JS_VG_ARC;
//typedef struct JS_VG_SPRITE JS_VG_SPRITE;
typedef struct {
VGfloat translate[2];
VGfloat scale[2];
VGfloat rotate;
// TODO: Dash pattern
void *data;
void (* init_sprite)(void *);
void (* draw_func)(void *);
} JS_VG_SPRITE;
typedef struct {
JS_VG_SPRITE *sprite;
void *sig;
} JS_VG_SPRITE_LIST;
typedef struct {
int count;
JS_VG_SPRITE *sprites;
} JS_VG_SPRITE_GROUP;
typedef struct {
VGint cap_style;
VGint join_style;
VGfloat stroke_line_width;
VGfloat fill_color[4];
VGfloat stroke_color[4];
VGfloat bg_color[4];
// TODO: Dash pattern
JS_VG_PATH *data;
VGPath (* init_sp_path)(void *);
//void (*draw_func)(void *);
VGPaint fill_paint, stroke_paint;
VGPath path;
} JS_VG_SPRITE_PATH;
void init_sprite(JS_VG_SPRITE *sprite);
void draw_sprite(JS_VG_SPRITE *sprite);
JS_VG_SPRITE_LIST *spriteListFromArray(int count, JS_VG_SPRITE *sprites);
void init_sprite_path(JS_VG_SPRITE_PATH *sprite_path);
void init_sprite_group_array(JS_VG_SPRITE_GROUP *sprite_group);
void init_sprite_group_list(JS_VG_SPRITE_LIST *sprite_group);
void draw_sprite_path(JS_VG_SPRITE_PATH *sprite_path);
void draw_sprite_group_array(JS_VG_SPRITE_GROUP *sprite_group);
void draw_sprite_group_list(JS_VG_SPRITE_LIST *sprite_group);
VGPath inti_path_raw_path(void *data);
VGPath inti_path_ellipse(void *data);
VGPath inti_path_arc(void *data);