glimmer-dsl-libui 0.2.24 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/README.md +1153 -921
- data/VERSION +1 -1
- data/examples/area_gallery.rb +19 -19
- data/examples/area_gallery2.rb +91 -89
- data/examples/area_gallery3.rb +19 -19
- data/examples/area_gallery4.rb +91 -89
- data/examples/basic_image.rb +19 -0
- data/examples/basic_image2.rb +13 -0
- data/examples/basic_image3.rb +23 -0
- data/examples/basic_image4.rb +17 -0
- data/examples/basic_image5.rb +75 -0
- data/examples/basic_table_color.rb +1 -11
- data/examples/basic_table_color2.rb +39 -0
- data/examples/basic_table_image.rb +2 -14
- data/examples/basic_table_image2.rb +44 -0
- data/examples/basic_table_image_text.rb +2 -13
- data/examples/basic_table_image_text2.rb +44 -0
- data/examples/basic_transform.rb +3 -6
- data/examples/basic_transform2.rb +34 -0
- data/examples/color_the_circles.rb +1 -3
- data/examples/dynamic_area.rb +1 -3
- data/examples/dynamic_area2.rb +5 -7
- data/examples/form_table.rb +4 -0
- data/examples/grid.rb +4 -4
- data/examples/histogram.rb +4 -8
- data/examples/meta_example.rb +50 -10
- data/examples/snake.rb +1 -3
- data/examples/tetris.rb +15 -18
- data/examples/tic_tac_toe/board.rb +4 -2
- data/examples/tic_tac_toe.rb +1 -3
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/dsl/libui/control_expression.rb +1 -1
- data/lib/glimmer/dsl/libui/shape_expression.rb +6 -1
- data/lib/glimmer/libui/control_proxy/area_proxy.rb +1 -0
- data/lib/glimmer/libui/control_proxy/column.rb +2 -2
- data/lib/glimmer/libui/control_proxy/image_part_proxy.rb +0 -1
- data/lib/glimmer/libui/control_proxy/image_proxy.rb +159 -12
- data/lib/glimmer/libui/control_proxy/table_proxy.rb +15 -2
- data/lib/glimmer/libui/control_proxy/window_proxy.rb +1 -1
- data/lib/glimmer/libui/control_proxy.rb +7 -7
- data/lib/glimmer/libui/image_path_renderer.rb +30 -0
- data/lib/glimmer/libui/shape.rb +44 -1
- metadata +29 -19
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.3
|
data/examples/area_gallery.rb
CHANGED
@@ -4,50 +4,50 @@ include Glimmer
|
|
4
4
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
6
|
area {
|
7
|
-
path { # declarative stable path
|
7
|
+
path { # declarative stable path (explicit path syntax for multiple shapes sharing attributes)
|
8
8
|
square(0, 0, 100)
|
9
9
|
square(100, 100, 400)
|
10
|
-
|
10
|
+
|
11
11
|
fill r: 102, g: 102, b: 204
|
12
12
|
}
|
13
|
-
|
13
|
+
|
14
|
+
path { # declarative stable path (explicit path syntax for multiple shapes sharing attributes)
|
14
15
|
rectangle(0, 100, 100, 400)
|
15
16
|
rectangle(100, 0, 400, 100)
|
16
|
-
|
17
|
+
|
17
18
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
18
19
|
fill x0: 10, y0: 10, x1: 350, y1: 350, stops: [{pos: 0.25, r: 204, g: 102, b: 204}, {pos: 0.75, r: 102, g: 102, b: 204}]
|
19
20
|
}
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
|
22
|
+
polygon(100, 100, 100, 400, 400, 100, 400, 400) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
23
23
|
fill r: 202, g: 102, b: 104, a: 0.5
|
24
24
|
stroke r: 0, g: 0, b: 0
|
25
25
|
}
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
|
27
|
+
polybezier(0, 0,
|
28
|
+
200, 100, 100, 200, 400, 100,
|
29
|
+
300, 100, 100, 300, 100, 400,
|
30
|
+
100, 300, 300, 100, 400, 400) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
29
31
|
fill r: 202, g: 102, b: 204, a: 0.5
|
30
32
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
31
33
|
}
|
32
|
-
path { # declarative stable path
|
33
|
-
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
34
34
|
|
35
|
+
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
35
36
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
36
37
|
}
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
|
39
|
+
arc(404, 216, 190, 90, 90, false) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
40
40
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
41
41
|
fill outer_radius: 90, x0: 0, y0: 0, x1: 500, y1: 500, stops: [{pos: 0.25, r: 102, g: 102, b: 204, a: 0.5}, {pos: 0.75, r: 204, g: 102, b: 204}]
|
42
42
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
43
43
|
}
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
|
45
|
+
circle(200, 200, 90) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
47
46
|
fill r: 202, g: 102, b: 204, a: 0.5
|
48
47
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
49
48
|
}
|
50
|
-
|
49
|
+
|
50
|
+
text(161, 40, 100) { # declarative stable text
|
51
51
|
string('Area Gallery') {
|
52
52
|
font family: 'Arial', size: (OS.mac? ? 14 : 11)
|
53
53
|
color :black
|
data/examples/area_gallery2.rb
CHANGED
@@ -4,12 +4,13 @@ include Glimmer
|
|
4
4
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
6
|
area {
|
7
|
-
path { # declarative stable path
|
7
|
+
path { # declarative stable path with explicit attributes (explicit path syntax for multiple shapes sharing attributes)
|
8
8
|
square {
|
9
9
|
x 0
|
10
10
|
y 0
|
11
11
|
length 100
|
12
12
|
}
|
13
|
+
|
13
14
|
square {
|
14
15
|
x 100
|
15
16
|
y 100
|
@@ -18,13 +19,15 @@ window('Area Gallery', 400, 400) {
|
|
18
19
|
|
19
20
|
fill r: 102, g: 102, b: 204
|
20
21
|
}
|
21
|
-
|
22
|
+
|
23
|
+
path { # declarative stable path with explicit attributes (explicit path syntax for multiple shapes sharing attributes)
|
22
24
|
rectangle {
|
23
25
|
x 0
|
24
26
|
y 100
|
25
27
|
width 100
|
26
28
|
height 400
|
27
29
|
}
|
30
|
+
|
28
31
|
rectangle {
|
29
32
|
x 100
|
30
33
|
y 0
|
@@ -35,115 +38,114 @@ window('Area Gallery', 400, 400) {
|
|
35
38
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
36
39
|
fill x0: 10, y0: 10, x1: 350, y1: 350, stops: [{pos: 0.25, r: 204, g: 102, b: 204}, {pos: 0.75, r: 102, g: 102, b: 204}]
|
37
40
|
}
|
38
|
-
|
39
|
-
|
41
|
+
|
42
|
+
figure { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
43
|
+
x 100
|
44
|
+
y 100
|
45
|
+
|
46
|
+
line {
|
40
47
|
x 100
|
48
|
+
y 400
|
49
|
+
}
|
50
|
+
|
51
|
+
line {
|
52
|
+
x 400
|
41
53
|
y 100
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
line {
|
48
|
-
x 400
|
49
|
-
y 100
|
50
|
-
}
|
51
|
-
line {
|
52
|
-
x 400
|
53
|
-
y 400
|
54
|
-
}
|
55
|
-
|
56
|
-
closed true
|
54
|
+
}
|
55
|
+
|
56
|
+
line {
|
57
|
+
x 400
|
58
|
+
y 400
|
57
59
|
}
|
58
60
|
|
61
|
+
closed true # polygon figure is closed (last point forms a line with first point)
|
59
62
|
fill r: 202, g: 102, b: 104, a: 0.5
|
60
63
|
stroke r: 0, g: 0, b: 0
|
61
64
|
}
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
}
|
75
|
-
bezier {
|
76
|
-
c1_x 300
|
77
|
-
c1_y 100
|
78
|
-
c2_x 100
|
79
|
-
c2_y 300
|
80
|
-
end_x 100
|
81
|
-
end_y 400
|
82
|
-
}
|
83
|
-
bezier {
|
84
|
-
c1_x 100
|
85
|
-
c1_y 300
|
86
|
-
c2_x 300
|
87
|
-
c2_y 100
|
88
|
-
end_x 400
|
89
|
-
end_y 400
|
90
|
-
}
|
65
|
+
|
66
|
+
figure { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
67
|
+
x 0
|
68
|
+
y 0
|
69
|
+
|
70
|
+
bezier {
|
71
|
+
c1_x 200
|
72
|
+
c1_y 100
|
73
|
+
c2_x 100
|
74
|
+
c2_y 200
|
75
|
+
end_x 400
|
76
|
+
end_y 100
|
91
77
|
}
|
92
|
-
|
78
|
+
|
79
|
+
bezier {
|
80
|
+
c1_x 300
|
81
|
+
c1_y 100
|
82
|
+
c2_x 100
|
83
|
+
c2_y 300
|
84
|
+
end_x 100
|
85
|
+
end_y 400
|
86
|
+
}
|
87
|
+
|
88
|
+
bezier {
|
89
|
+
c1_x 100
|
90
|
+
c1_y 300
|
91
|
+
c2_x 300
|
92
|
+
c2_y 100
|
93
|
+
end_x 400
|
94
|
+
end_y 400
|
95
|
+
}
|
96
|
+
|
93
97
|
fill r: 202, g: 102, b: 204, a: 0.5
|
94
98
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
95
99
|
}
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
+
|
101
|
+
figure { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
102
|
+
x 100
|
103
|
+
y 100
|
104
|
+
|
105
|
+
line {
|
106
|
+
x 400
|
100
107
|
y 100
|
101
|
-
|
102
|
-
line {
|
103
|
-
x 400
|
104
|
-
y 100
|
105
|
-
}
|
106
|
-
line {
|
107
|
-
x 100
|
108
|
-
y 400
|
109
|
-
}
|
110
|
-
line {
|
111
|
-
x 400
|
112
|
-
y 400
|
113
|
-
}
|
114
|
-
line {
|
115
|
-
x 0
|
116
|
-
y 0
|
117
|
-
}
|
118
108
|
}
|
119
|
-
|
109
|
+
|
110
|
+
line {
|
111
|
+
x 100
|
112
|
+
y 400
|
113
|
+
}
|
114
|
+
|
115
|
+
line {
|
116
|
+
x 400
|
117
|
+
y 400
|
118
|
+
}
|
119
|
+
|
120
|
+
line {
|
121
|
+
x 0
|
122
|
+
y 0
|
123
|
+
}
|
124
|
+
|
120
125
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
121
126
|
}
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
}
|
131
|
-
|
127
|
+
|
128
|
+
arc { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
129
|
+
x_center 404
|
130
|
+
y_center 216
|
131
|
+
radius 190
|
132
|
+
start_angle 90
|
133
|
+
sweep 90
|
134
|
+
is_negative false
|
132
135
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
133
136
|
fill outer_radius: 90, x0: 0, y0: 0, x1: 500, y1: 500, stops: [{pos: 0.25, r: 102, g: 102, b: 204, a: 0.5}, {pos: 0.75, r: 204, g: 102, b: 204}]
|
134
137
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
135
138
|
}
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
}
|
142
|
-
|
139
|
+
|
140
|
+
circle { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
141
|
+
x_center 200
|
142
|
+
y_center 200
|
143
|
+
radius 90
|
143
144
|
fill r: 202, g: 102, b: 204, a: 0.5
|
144
145
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
145
146
|
}
|
146
|
-
|
147
|
+
|
148
|
+
text { # declarative stable text with explicit attributes
|
147
149
|
x 161
|
148
150
|
y 40
|
149
151
|
width 100
|
data/examples/area_gallery3.rb
CHANGED
@@ -5,50 +5,50 @@ include Glimmer
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
6
|
area {
|
7
7
|
on_draw do |area_draw_params|
|
8
|
-
path { #
|
8
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
9
9
|
square(0, 0, 100)
|
10
10
|
square(100, 100, 400)
|
11
|
-
|
11
|
+
|
12
12
|
fill r: 102, g: 102, b: 204
|
13
13
|
}
|
14
|
-
|
14
|
+
|
15
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
15
16
|
rectangle(0, 100, 100, 400)
|
16
17
|
rectangle(100, 0, 400, 100)
|
17
|
-
|
18
|
+
|
18
19
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
19
20
|
fill x0: 10, y0: 10, x1: 350, y1: 350, stops: [{pos: 0.25, r: 204, g: 102, b: 204}, {pos: 0.75, r: 102, g: 102, b: 204}]
|
20
21
|
}
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
|
23
|
+
polygon(100, 100, 100, 400, 400, 100, 400, 400) { # dynamic path, added semi-declaratively inside on_draw block
|
24
24
|
fill r: 202, g: 102, b: 104, a: 0.5
|
25
25
|
stroke r: 0, g: 0, b: 0
|
26
26
|
}
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
|
28
|
+
polybezier(0, 0,
|
29
|
+
200, 100, 100, 200, 400, 100,
|
30
|
+
300, 100, 100, 300, 100, 400,
|
31
|
+
100, 300, 300, 100, 400, 400) { # dynamic path, added semi-declaratively inside on_draw block
|
30
32
|
fill r: 202, g: 102, b: 204, a: 0.5
|
31
33
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
32
34
|
}
|
33
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
34
|
-
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
35
35
|
|
36
|
+
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0) { # dynamic path, added semi-declaratively inside on_draw block
|
36
37
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
37
38
|
}
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
|
40
|
+
arc(404, 216, 190, 90, 90, false) { # dynamic path, added semi-declaratively inside on_draw block
|
41
41
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
42
42
|
fill outer_radius: 90, x0: 0, y0: 0, x1: 500, y1: 500, stops: [{pos: 0.25, r: 102, g: 102, b: 204, a: 0.5}, {pos: 0.75, r: 204, g: 102, b: 204}]
|
43
43
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
44
44
|
}
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
|
46
|
+
circle(200, 200, 90) { # dynamic path, added semi-declaratively inside on_draw block
|
48
47
|
fill r: 202, g: 102, b: 204, a: 0.5
|
49
48
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
50
49
|
}
|
51
|
-
|
50
|
+
|
51
|
+
text(161, 40, 100) { # dynamic text added semi-declaratively inside on_draw block
|
52
52
|
string('Area Gallery') {
|
53
53
|
font family: 'Arial', size: (OS.mac? ? 14 : 11)
|
54
54
|
color :black
|
data/examples/area_gallery4.rb
CHANGED
@@ -5,12 +5,13 @@ include Glimmer
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
6
|
area {
|
7
7
|
on_draw do |area_draw_params|
|
8
|
-
path { #
|
8
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
9
9
|
square {
|
10
10
|
x 0
|
11
11
|
y 0
|
12
12
|
length 100
|
13
13
|
}
|
14
|
+
|
14
15
|
square {
|
15
16
|
x 100
|
16
17
|
y 100
|
@@ -19,13 +20,15 @@ window('Area Gallery', 400, 400) {
|
|
19
20
|
|
20
21
|
fill r: 102, g: 102, b: 204
|
21
22
|
}
|
22
|
-
|
23
|
+
|
24
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
23
25
|
rectangle {
|
24
26
|
x 0
|
25
27
|
y 100
|
26
28
|
width 100
|
27
29
|
height 400
|
28
30
|
}
|
31
|
+
|
29
32
|
rectangle {
|
30
33
|
x 100
|
31
34
|
y 0
|
@@ -36,115 +39,114 @@ window('Area Gallery', 400, 400) {
|
|
36
39
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
37
40
|
fill x0: 10, y0: 10, x1: 350, y1: 350, stops: [{pos: 0.25, r: 204, g: 102, b: 204}, {pos: 0.75, r: 102, g: 102, b: 204}]
|
38
41
|
}
|
39
|
-
|
40
|
-
|
42
|
+
|
43
|
+
figure { # dynamic path, added semi-declaratively inside on_draw block
|
44
|
+
x 100
|
45
|
+
y 100
|
46
|
+
|
47
|
+
line {
|
41
48
|
x 100
|
49
|
+
y 400
|
50
|
+
}
|
51
|
+
|
52
|
+
line {
|
53
|
+
x 400
|
42
54
|
y 100
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
line {
|
49
|
-
x 400
|
50
|
-
y 100
|
51
|
-
}
|
52
|
-
line {
|
53
|
-
x 400
|
54
|
-
y 400
|
55
|
-
}
|
56
|
-
|
57
|
-
closed true
|
55
|
+
}
|
56
|
+
|
57
|
+
line {
|
58
|
+
x 400
|
59
|
+
y 400
|
58
60
|
}
|
59
61
|
|
62
|
+
closed true # polygon figure is closed (last point forms a line with first point)
|
60
63
|
fill r: 202, g: 102, b: 104, a: 0.5
|
61
64
|
stroke r: 0, g: 0, b: 0
|
62
65
|
}
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
}
|
76
|
-
bezier {
|
77
|
-
c1_x 300
|
78
|
-
c1_y 100
|
79
|
-
c2_x 100
|
80
|
-
c2_y 300
|
81
|
-
end_x 100
|
82
|
-
end_y 400
|
83
|
-
}
|
84
|
-
bezier {
|
85
|
-
c1_x 100
|
86
|
-
c1_y 300
|
87
|
-
c2_x 300
|
88
|
-
c2_y 100
|
89
|
-
end_x 400
|
90
|
-
end_y 400
|
91
|
-
}
|
66
|
+
|
67
|
+
figure { # dynamic path, added semi-declaratively inside on_draw block
|
68
|
+
x 0
|
69
|
+
y 0
|
70
|
+
|
71
|
+
bezier {
|
72
|
+
c1_x 200
|
73
|
+
c1_y 100
|
74
|
+
c2_x 100
|
75
|
+
c2_y 200
|
76
|
+
end_x 400
|
77
|
+
end_y 100
|
92
78
|
}
|
93
|
-
|
79
|
+
|
80
|
+
bezier {
|
81
|
+
c1_x 300
|
82
|
+
c1_y 100
|
83
|
+
c2_x 100
|
84
|
+
c2_y 300
|
85
|
+
end_x 100
|
86
|
+
end_y 400
|
87
|
+
}
|
88
|
+
|
89
|
+
bezier {
|
90
|
+
c1_x 100
|
91
|
+
c1_y 300
|
92
|
+
c2_x 300
|
93
|
+
c2_y 100
|
94
|
+
end_x 400
|
95
|
+
end_y 400
|
96
|
+
}
|
97
|
+
|
94
98
|
fill r: 202, g: 102, b: 204, a: 0.5
|
95
99
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
96
100
|
}
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
+
|
102
|
+
figure { # dynamic path, added semi-declaratively inside on_draw block
|
103
|
+
x 100
|
104
|
+
y 100
|
105
|
+
|
106
|
+
line {
|
107
|
+
x 400
|
101
108
|
y 100
|
102
|
-
|
103
|
-
line {
|
104
|
-
x 400
|
105
|
-
y 100
|
106
|
-
}
|
107
|
-
line {
|
108
|
-
x 100
|
109
|
-
y 400
|
110
|
-
}
|
111
|
-
line {
|
112
|
-
x 400
|
113
|
-
y 400
|
114
|
-
}
|
115
|
-
line {
|
116
|
-
x 0
|
117
|
-
y 0
|
118
|
-
}
|
119
109
|
}
|
120
|
-
|
110
|
+
|
111
|
+
line {
|
112
|
+
x 100
|
113
|
+
y 400
|
114
|
+
}
|
115
|
+
|
116
|
+
line {
|
117
|
+
x 400
|
118
|
+
y 400
|
119
|
+
}
|
120
|
+
|
121
|
+
line {
|
122
|
+
x 0
|
123
|
+
y 0
|
124
|
+
}
|
125
|
+
|
121
126
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
122
127
|
}
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
}
|
132
|
-
|
128
|
+
|
129
|
+
arc { # dynamic path, added semi-declaratively inside on_draw block
|
130
|
+
x_center 404
|
131
|
+
y_center 216
|
132
|
+
radius 190
|
133
|
+
start_angle 90
|
134
|
+
sweep 90
|
135
|
+
is_negative false
|
133
136
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
134
137
|
fill outer_radius: 90, x0: 0, y0: 0, x1: 500, y1: 500, stops: [{pos: 0.25, r: 102, g: 102, b: 204, a: 0.5}, {pos: 0.75, r: 204, g: 102, b: 204}]
|
135
138
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
136
139
|
}
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
}
|
143
|
-
|
140
|
+
|
141
|
+
circle { # dynamic path, added semi-declaratively inside on_draw block
|
142
|
+
x_center 200
|
143
|
+
y_center 200
|
144
|
+
radius 90
|
144
145
|
fill r: 202, g: 102, b: 204, a: 0.5
|
145
146
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
146
147
|
}
|
147
|
-
|
148
|
+
|
149
|
+
text { # dynamic path, added semi-declaratively inside on_draw block
|
148
150
|
x 161
|
149
151
|
y 40
|
150
152
|
width 100
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'glimmer-dsl-libui'
|
4
|
+
|
5
|
+
include Glimmer
|
6
|
+
|
7
|
+
window('Basic Image', 96, 96) {
|
8
|
+
area {
|
9
|
+
# image is not a real LibUI control. It is built in Glimmer as a custom control that renders
|
10
|
+
# tiny pixels/lines as rectangle paths. As such, it does not have good performance, but can
|
11
|
+
# be used in exceptional circumstances where an image control is really needed.
|
12
|
+
#
|
13
|
+
# Furthermore, adding image directly under area is even slower due to taking up more memory for every
|
14
|
+
# image pixel rendered. Check basic_image2.rb for a faster alternative using on_draw manually.
|
15
|
+
#
|
16
|
+
# It is recommended to pass width/height args to shrink image and achieve faster performance.
|
17
|
+
image(File.expand_path('../icons/glimmer.png', __dir__), 96, 96)
|
18
|
+
}
|
19
|
+
}.show
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'glimmer-dsl-libui'
|
4
|
+
|
5
|
+
include Glimmer
|
6
|
+
|
7
|
+
window('Basic Image', 96, 96) {
|
8
|
+
area {
|
9
|
+
# image is not a real LibUI control. It is built in Glimmer as a custom control that renders
|
10
|
+
# tiny pixels/lines as rectangle paths. As such, it does not have good performance, but can
|
11
|
+
# be used in exceptional circumstances where an image control is really needed.
|
12
|
+
#
|
13
|
+
# Furthermore, adding image directly under area is even slower due to taking up more memory for every
|
14
|
+
# image pixel rendered. Check basic_image4.rb for a faster alternative using on_draw manually.
|
15
|
+
#
|
16
|
+
# It is recommended to pass width/height args to shrink image and achieve faster performance.
|
17
|
+
image {
|
18
|
+
file File.expand_path('../icons/glimmer.png', __dir__)
|
19
|
+
width 96
|
20
|
+
height 96
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}.show
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'glimmer-dsl-libui'
|
4
|
+
|
5
|
+
include Glimmer
|
6
|
+
|
7
|
+
window('Basic Image', 96, 96) {
|
8
|
+
area {
|
9
|
+
on_draw do |area_draw_params|
|
10
|
+
image {
|
11
|
+
file File.expand_path('../icons/glimmer.png', __dir__)
|
12
|
+
width 96
|
13
|
+
height 96
|
14
|
+
}
|
15
|
+
end
|
16
|
+
}
|
17
|
+
}.show
|