glimmer-dsl-libui 0.3.0 → 0.3.4
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 +35 -0
- data/README.md +1229 -1210
- data/VERSION +1 -1
- data/examples/area_gallery.rb +28 -28
- data/examples/area_gallery2.rb +113 -110
- data/examples/area_gallery3.rb +28 -28
- data/examples/area_gallery4.rb +112 -110
- data/examples/basic_area.rb +1 -3
- data/examples/basic_area2.rb +1 -3
- data/examples/basic_area3.rb +17 -0
- data/examples/basic_area4.rb +19 -0
- data/examples/basic_scrolling_area.rb +79 -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/shape_expression.rb +6 -1
- data/lib/glimmer/libui/control_proxy/area_proxy/scrolling_area_proxy.rb +35 -0
- 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_proxy.rb +42 -35
- data/lib/glimmer/libui/control_proxy/table_proxy.rb +15 -2
- data/lib/glimmer/libui/control_proxy/window_proxy.rb +20 -0
- data/lib/glimmer/libui/shape.rb +49 -1
- metadata +12 -19
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
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
|
-
|
8
|
-
square(0, 0, 100)
|
9
|
-
square(100, 100, 400)
|
10
|
-
|
11
|
-
fill r: 102, g: 102, b: 204
|
12
|
-
}
|
13
|
-
path { # declarative stable path
|
14
|
-
rectangle(0, 100, 100, 400)
|
15
|
-
rectangle(100, 0, 400, 100)
|
16
|
-
|
17
|
-
# linear gradient (has x0, y0, x1, y1, and stops)
|
18
|
-
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
|
-
path { # declarative stable path
|
21
|
-
polygon(100, 100, 100, 400, 400, 100, 400, 400)
|
22
|
-
|
7
|
+
polygon(100, 100, 100, 400, 400, 100, 400, 400) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
23
8
|
fill r: 202, g: 102, b: 104, a: 0.5
|
24
9
|
stroke r: 0, g: 0, b: 0
|
25
10
|
}
|
26
|
-
|
27
|
-
|
28
|
-
|
11
|
+
|
12
|
+
polybezier(0, 0,
|
13
|
+
200, 100, 100, 200, 400, 100,
|
14
|
+
300, 100, 100, 300, 100, 400,
|
15
|
+
100, 300, 300, 100, 400, 400) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
29
16
|
fill r: 202, g: 102, b: 204, a: 0.5
|
30
17
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
31
18
|
}
|
32
|
-
path { # declarative stable path
|
33
|
-
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
34
19
|
|
20
|
+
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
21
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
36
22
|
}
|
37
|
-
|
38
|
-
|
39
|
-
|
23
|
+
|
24
|
+
arc(404, 216, 190, 90, 90, false) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
40
25
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
41
26
|
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
27
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
43
28
|
}
|
44
|
-
|
45
|
-
|
46
|
-
|
29
|
+
|
30
|
+
circle(200, 200, 90) { # declarative stable path (implicit path syntax for a single shape nested directly under area)
|
47
31
|
fill r: 202, g: 102, b: 204, a: 0.5
|
48
32
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
49
33
|
}
|
50
|
-
|
34
|
+
|
35
|
+
path { # declarative stable path (explicit path syntax for multiple shapes sharing attributes)
|
36
|
+
square(0, 0, 100)
|
37
|
+
square(100, 100, 400)
|
38
|
+
|
39
|
+
fill r: 102, g: 102, b: 204
|
40
|
+
}
|
41
|
+
|
42
|
+
path { # declarative stable path (explicit path syntax for multiple shapes sharing attributes)
|
43
|
+
rectangle(0, 100, 100, 400)
|
44
|
+
rectangle(100, 0, 400, 100)
|
45
|
+
|
46
|
+
# linear gradient (has x0, y0, x1, y1, and stops)
|
47
|
+
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}]
|
48
|
+
}
|
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,120 @@ include Glimmer
|
|
4
4
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
6
|
area {
|
7
|
-
|
7
|
+
|
8
|
+
figure { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
9
|
+
x 100
|
10
|
+
y 100
|
11
|
+
|
12
|
+
line {
|
13
|
+
x 100
|
14
|
+
y 400
|
15
|
+
}
|
16
|
+
|
17
|
+
line {
|
18
|
+
x 400
|
19
|
+
y 100
|
20
|
+
}
|
21
|
+
|
22
|
+
line {
|
23
|
+
x 400
|
24
|
+
y 400
|
25
|
+
}
|
26
|
+
|
27
|
+
closed true # polygon figure is closed (last point forms a line with first point)
|
28
|
+
fill r: 202, g: 102, b: 104, a: 0.5
|
29
|
+
stroke r: 0, g: 0, b: 0
|
30
|
+
}
|
31
|
+
|
32
|
+
figure { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
33
|
+
x 0
|
34
|
+
y 0
|
35
|
+
|
36
|
+
bezier {
|
37
|
+
c1_x 200
|
38
|
+
c1_y 100
|
39
|
+
c2_x 100
|
40
|
+
c2_y 200
|
41
|
+
end_x 400
|
42
|
+
end_y 100
|
43
|
+
}
|
44
|
+
|
45
|
+
bezier {
|
46
|
+
c1_x 300
|
47
|
+
c1_y 100
|
48
|
+
c2_x 100
|
49
|
+
c2_y 300
|
50
|
+
end_x 100
|
51
|
+
end_y 400
|
52
|
+
}
|
53
|
+
|
54
|
+
bezier {
|
55
|
+
c1_x 100
|
56
|
+
c1_y 300
|
57
|
+
c2_x 300
|
58
|
+
c2_y 100
|
59
|
+
end_x 400
|
60
|
+
end_y 400
|
61
|
+
}
|
62
|
+
|
63
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
64
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
65
|
+
}
|
66
|
+
|
67
|
+
figure { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
68
|
+
x 100
|
69
|
+
y 100
|
70
|
+
|
71
|
+
line {
|
72
|
+
x 400
|
73
|
+
y 100
|
74
|
+
}
|
75
|
+
|
76
|
+
line {
|
77
|
+
x 100
|
78
|
+
y 400
|
79
|
+
}
|
80
|
+
|
81
|
+
line {
|
82
|
+
x 400
|
83
|
+
y 400
|
84
|
+
}
|
85
|
+
|
86
|
+
line {
|
87
|
+
x 0
|
88
|
+
y 0
|
89
|
+
}
|
90
|
+
|
91
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
92
|
+
}
|
93
|
+
|
94
|
+
arc { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
95
|
+
x_center 404
|
96
|
+
y_center 216
|
97
|
+
radius 190
|
98
|
+
start_angle 90
|
99
|
+
sweep 90
|
100
|
+
is_negative false
|
101
|
+
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
102
|
+
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}]
|
103
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
104
|
+
}
|
105
|
+
|
106
|
+
circle { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
|
107
|
+
x_center 200
|
108
|
+
y_center 200
|
109
|
+
radius 90
|
110
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
111
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
112
|
+
}
|
113
|
+
|
114
|
+
path { # declarative stable path with explicit attributes (explicit path syntax for multiple shapes sharing attributes)
|
8
115
|
square {
|
9
116
|
x 0
|
10
117
|
y 0
|
11
118
|
length 100
|
12
119
|
}
|
120
|
+
|
13
121
|
square {
|
14
122
|
x 100
|
15
123
|
y 100
|
@@ -18,13 +126,15 @@ window('Area Gallery', 400, 400) {
|
|
18
126
|
|
19
127
|
fill r: 102, g: 102, b: 204
|
20
128
|
}
|
21
|
-
|
129
|
+
|
130
|
+
path { # declarative stable path with explicit attributes (explicit path syntax for multiple shapes sharing attributes)
|
22
131
|
rectangle {
|
23
132
|
x 0
|
24
133
|
y 100
|
25
134
|
width 100
|
26
135
|
height 400
|
27
136
|
}
|
137
|
+
|
28
138
|
rectangle {
|
29
139
|
x 100
|
30
140
|
y 0
|
@@ -35,115 +145,8 @@ window('Area Gallery', 400, 400) {
|
|
35
145
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
36
146
|
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
147
|
}
|
38
|
-
path { # declarative stable path
|
39
|
-
figure {
|
40
|
-
x 100
|
41
|
-
y 100
|
42
|
-
|
43
|
-
line {
|
44
|
-
x 100
|
45
|
-
y 400
|
46
|
-
}
|
47
|
-
line {
|
48
|
-
x 400
|
49
|
-
y 100
|
50
|
-
}
|
51
|
-
line {
|
52
|
-
x 400
|
53
|
-
y 400
|
54
|
-
}
|
55
|
-
|
56
|
-
closed true
|
57
|
-
}
|
58
|
-
|
59
|
-
fill r: 202, g: 102, b: 104, a: 0.5
|
60
|
-
stroke r: 0, g: 0, b: 0
|
61
|
-
}
|
62
|
-
path { # declarative stable path
|
63
|
-
figure {
|
64
|
-
x 0
|
65
|
-
y 0
|
66
|
-
|
67
|
-
bezier {
|
68
|
-
c1_x 200
|
69
|
-
c1_y 100
|
70
|
-
c2_x 100
|
71
|
-
c2_y 200
|
72
|
-
end_x 400
|
73
|
-
end_y 100
|
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
|
-
}
|
91
|
-
}
|
92
|
-
|
93
|
-
fill r: 202, g: 102, b: 204, a: 0.5
|
94
|
-
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
95
|
-
}
|
96
|
-
path { # declarative stable path
|
97
|
-
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
98
|
-
figure {
|
99
|
-
x 100
|
100
|
-
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
|
-
}
|
119
148
|
|
120
|
-
|
121
|
-
}
|
122
|
-
path { # declarative stable path
|
123
|
-
arc {
|
124
|
-
x_center 404
|
125
|
-
y_center 216
|
126
|
-
radius 190
|
127
|
-
start_angle 90
|
128
|
-
sweep 90
|
129
|
-
is_negative false
|
130
|
-
}
|
131
|
-
|
132
|
-
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
133
|
-
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
|
-
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
135
|
-
}
|
136
|
-
path { # declarative stable path
|
137
|
-
circle {
|
138
|
-
x_center 200
|
139
|
-
y_center 200
|
140
|
-
radius 90
|
141
|
-
}
|
142
|
-
|
143
|
-
fill r: 202, g: 102, b: 204, a: 0.5
|
144
|
-
stroke r: 0, g: 0, b: 0, thickness: 2
|
145
|
-
}
|
146
|
-
text {
|
149
|
+
text { # declarative stable text with explicit attributes
|
147
150
|
x 161
|
148
151
|
y 40
|
149
152
|
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
|
-
|
9
|
-
square(0, 0, 100)
|
10
|
-
square(100, 100, 400)
|
11
|
-
|
12
|
-
fill r: 102, g: 102, b: 204
|
13
|
-
}
|
14
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
15
|
-
rectangle(0, 100, 100, 400)
|
16
|
-
rectangle(100, 0, 400, 100)
|
17
|
-
|
18
|
-
# linear gradient (has x0, y0, x1, y1, and stops)
|
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}]
|
20
|
-
}
|
21
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
22
|
-
polygon(100, 100, 100, 400, 400, 100, 400, 400)
|
23
|
-
|
8
|
+
polygon(100, 100, 100, 400, 400, 100, 400, 400) { # dynamic path, added semi-declaratively inside on_draw block
|
24
9
|
fill r: 202, g: 102, b: 104, a: 0.5
|
25
10
|
stroke r: 0, g: 0, b: 0
|
26
11
|
}
|
27
|
-
|
28
|
-
|
29
|
-
|
12
|
+
|
13
|
+
polybezier(0, 0,
|
14
|
+
200, 100, 100, 200, 400, 100,
|
15
|
+
300, 100, 100, 300, 100, 400,
|
16
|
+
100, 300, 300, 100, 400, 400) { # dynamic path, added semi-declaratively inside on_draw block
|
30
17
|
fill r: 202, g: 102, b: 204, a: 0.5
|
31
18
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
32
19
|
}
|
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
20
|
|
21
|
+
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0) { # dynamic path, added semi-declaratively inside on_draw block
|
36
22
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
37
23
|
}
|
38
|
-
|
39
|
-
|
40
|
-
|
24
|
+
|
25
|
+
arc(404, 216, 190, 90, 90, false) { # dynamic path, added semi-declaratively inside on_draw block
|
41
26
|
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
42
27
|
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
28
|
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
44
29
|
}
|
45
|
-
|
46
|
-
|
47
|
-
|
30
|
+
|
31
|
+
circle(200, 200, 90) { # dynamic path, added semi-declaratively inside on_draw block
|
48
32
|
fill r: 202, g: 102, b: 204, a: 0.5
|
49
33
|
stroke r: 0, g: 0, b: 0, thickness: 2
|
50
34
|
}
|
51
|
-
|
35
|
+
|
36
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
37
|
+
square(0, 0, 100)
|
38
|
+
square(100, 100, 400)
|
39
|
+
|
40
|
+
fill r: 102, g: 102, b: 204
|
41
|
+
}
|
42
|
+
|
43
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
44
|
+
rectangle(0, 100, 100, 400)
|
45
|
+
rectangle(100, 0, 400, 100)
|
46
|
+
|
47
|
+
# linear gradient (has x0, y0, x1, y1, and stops)
|
48
|
+
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}]
|
49
|
+
}
|
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,119 @@ include Glimmer
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
6
|
area {
|
7
7
|
on_draw do |area_draw_params|
|
8
|
-
|
8
|
+
figure { # dynamic path, added semi-declaratively inside on_draw block
|
9
|
+
x 100
|
10
|
+
y 100
|
11
|
+
|
12
|
+
line {
|
13
|
+
x 100
|
14
|
+
y 400
|
15
|
+
}
|
16
|
+
|
17
|
+
line {
|
18
|
+
x 400
|
19
|
+
y 100
|
20
|
+
}
|
21
|
+
|
22
|
+
line {
|
23
|
+
x 400
|
24
|
+
y 400
|
25
|
+
}
|
26
|
+
|
27
|
+
closed true # polygon figure is closed (last point forms a line with first point)
|
28
|
+
fill r: 202, g: 102, b: 104, a: 0.5
|
29
|
+
stroke r: 0, g: 0, b: 0
|
30
|
+
}
|
31
|
+
|
32
|
+
figure { # dynamic path, added semi-declaratively inside on_draw block
|
33
|
+
x 0
|
34
|
+
y 0
|
35
|
+
|
36
|
+
bezier {
|
37
|
+
c1_x 200
|
38
|
+
c1_y 100
|
39
|
+
c2_x 100
|
40
|
+
c2_y 200
|
41
|
+
end_x 400
|
42
|
+
end_y 100
|
43
|
+
}
|
44
|
+
|
45
|
+
bezier {
|
46
|
+
c1_x 300
|
47
|
+
c1_y 100
|
48
|
+
c2_x 100
|
49
|
+
c2_y 300
|
50
|
+
end_x 100
|
51
|
+
end_y 400
|
52
|
+
}
|
53
|
+
|
54
|
+
bezier {
|
55
|
+
c1_x 100
|
56
|
+
c1_y 300
|
57
|
+
c2_x 300
|
58
|
+
c2_y 100
|
59
|
+
end_x 400
|
60
|
+
end_y 400
|
61
|
+
}
|
62
|
+
|
63
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
64
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
65
|
+
}
|
66
|
+
|
67
|
+
figure { # dynamic path, added semi-declaratively inside on_draw block
|
68
|
+
x 100
|
69
|
+
y 100
|
70
|
+
|
71
|
+
line {
|
72
|
+
x 400
|
73
|
+
y 100
|
74
|
+
}
|
75
|
+
|
76
|
+
line {
|
77
|
+
x 100
|
78
|
+
y 400
|
79
|
+
}
|
80
|
+
|
81
|
+
line {
|
82
|
+
x 400
|
83
|
+
y 400
|
84
|
+
}
|
85
|
+
|
86
|
+
line {
|
87
|
+
x 0
|
88
|
+
y 0
|
89
|
+
}
|
90
|
+
|
91
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
92
|
+
}
|
93
|
+
|
94
|
+
arc { # dynamic path, added semi-declaratively inside on_draw block
|
95
|
+
x_center 404
|
96
|
+
y_center 216
|
97
|
+
radius 190
|
98
|
+
start_angle 90
|
99
|
+
sweep 90
|
100
|
+
is_negative false
|
101
|
+
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
102
|
+
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}]
|
103
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
104
|
+
}
|
105
|
+
|
106
|
+
circle { # dynamic path, added semi-declaratively inside on_draw block
|
107
|
+
x_center 200
|
108
|
+
y_center 200
|
109
|
+
radius 90
|
110
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
111
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
112
|
+
}
|
113
|
+
|
114
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
9
115
|
square {
|
10
116
|
x 0
|
11
117
|
y 0
|
12
118
|
length 100
|
13
119
|
}
|
120
|
+
|
14
121
|
square {
|
15
122
|
x 100
|
16
123
|
y 100
|
@@ -19,13 +126,15 @@ window('Area Gallery', 400, 400) {
|
|
19
126
|
|
20
127
|
fill r: 102, g: 102, b: 204
|
21
128
|
}
|
22
|
-
|
129
|
+
|
130
|
+
path { # dynamic path, added semi-declaratively inside on_draw block
|
23
131
|
rectangle {
|
24
132
|
x 0
|
25
133
|
y 100
|
26
134
|
width 100
|
27
135
|
height 400
|
28
136
|
}
|
137
|
+
|
29
138
|
rectangle {
|
30
139
|
x 100
|
31
140
|
y 0
|
@@ -36,115 +145,8 @@ window('Area Gallery', 400, 400) {
|
|
36
145
|
# linear gradient (has x0, y0, x1, y1, and stops)
|
37
146
|
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
147
|
}
|
39
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
40
|
-
figure {
|
41
|
-
x 100
|
42
|
-
y 100
|
43
|
-
|
44
|
-
line {
|
45
|
-
x 100
|
46
|
-
y 400
|
47
|
-
}
|
48
|
-
line {
|
49
|
-
x 400
|
50
|
-
y 100
|
51
|
-
}
|
52
|
-
line {
|
53
|
-
x 400
|
54
|
-
y 400
|
55
|
-
}
|
56
|
-
|
57
|
-
closed true
|
58
|
-
}
|
59
|
-
|
60
|
-
fill r: 202, g: 102, b: 104, a: 0.5
|
61
|
-
stroke r: 0, g: 0, b: 0
|
62
|
-
}
|
63
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
64
|
-
figure {
|
65
|
-
x 0
|
66
|
-
y 0
|
67
|
-
|
68
|
-
bezier {
|
69
|
-
c1_x 200
|
70
|
-
c1_y 100
|
71
|
-
c2_x 100
|
72
|
-
c2_y 200
|
73
|
-
end_x 400
|
74
|
-
end_y 100
|
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
|
-
}
|
92
|
-
}
|
93
|
-
|
94
|
-
fill r: 202, g: 102, b: 204, a: 0.5
|
95
|
-
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
96
|
-
}
|
97
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
98
|
-
polyline(100, 100, 400, 100, 100, 400, 400, 400, 0, 0)
|
99
|
-
figure {
|
100
|
-
x 100
|
101
|
-
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
|
-
}
|
120
148
|
|
121
|
-
|
122
|
-
}
|
123
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
124
|
-
arc {
|
125
|
-
x_center 404
|
126
|
-
y_center 216
|
127
|
-
radius 190
|
128
|
-
start_angle 90
|
129
|
-
sweep 90
|
130
|
-
is_negative false
|
131
|
-
}
|
132
|
-
|
133
|
-
# radial gradient (has an outer_radius in addition to x0, y0, x1, y1, and stops)
|
134
|
-
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
|
-
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
136
|
-
}
|
137
|
-
path { # a dynamic path is added semi-declaratively inside on_draw block
|
138
|
-
circle {
|
139
|
-
x_center 200
|
140
|
-
y_center 200
|
141
|
-
radius 90
|
142
|
-
}
|
143
|
-
|
144
|
-
fill r: 202, g: 102, b: 204, a: 0.5
|
145
|
-
stroke r: 0, g: 0, b: 0, thickness: 2
|
146
|
-
}
|
147
|
-
text {
|
149
|
+
text { # dynamic path, added semi-declaratively inside on_draw block
|
148
150
|
x 161
|
149
151
|
y 40
|
150
152
|
width 100
|
data/examples/basic_area.rb
CHANGED
@@ -7,9 +7,7 @@ window('Basic Area', 400, 400) {
|
|
7
7
|
|
8
8
|
vertical_box {
|
9
9
|
area {
|
10
|
-
|
11
|
-
rectangle(0, 0, 400, 400)
|
12
|
-
|
10
|
+
rectangle(0, 0, 400, 400) { # stable implicit path shape, added declaratively
|
13
11
|
fill r: 102, g: 102, b: 204, a: 1.0
|
14
12
|
}
|
15
13
|
}
|
data/examples/basic_area2.rb
CHANGED
@@ -8,9 +8,7 @@ window('Basic Area', 400, 400) {
|
|
8
8
|
vertical_box {
|
9
9
|
area {
|
10
10
|
on_draw do |area_draw_params|
|
11
|
-
|
12
|
-
rectangle(0, 0, 400, 400)
|
13
|
-
|
11
|
+
rectangle(0, 0, 400, 400) { # dynamic implicit path shape, added semi-declaratively inside on_draw block
|
14
12
|
fill r: 102, g: 102, b: 204, a: 1.0
|
15
13
|
}
|
16
14
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'glimmer-dsl-libui'
|
2
|
+
|
3
|
+
include Glimmer
|
4
|
+
|
5
|
+
window('Basic Area', 400, 400) {
|
6
|
+
margined true
|
7
|
+
|
8
|
+
vertical_box {
|
9
|
+
area {
|
10
|
+
path { # stable path, added declaratively
|
11
|
+
rectangle(0, 0, 400, 400)
|
12
|
+
|
13
|
+
fill r: 102, g: 102, b: 204, a: 1.0
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}.show
|