glimmer-dsl-libui 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +684 -215
- data/VERSION +1 -1
- data/examples/area_gallery.rb +36 -38
- data/examples/area_gallery2.rb +90 -92
- data/examples/area_gallery3.rb +39 -41
- data/examples/area_gallery4.rb +96 -98
- data/examples/basic_area2.rb +1 -1
- data/examples/basic_transform.rb +27 -0
- data/examples/dynamic_area.rb +1 -1
- data/examples/histogram.rb +119 -0
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/libui/arc.rb +1 -1
- data/lib/glimmer/libui/area_proxy.rb +21 -11
- data/lib/glimmer/libui/box.rb +1 -1
- data/lib/glimmer/libui/color_button_proxy.rb +67 -15
- data/lib/glimmer/libui/control_proxy.rb +4 -12
- data/lib/glimmer/libui/form_proxy.rb +1 -1
- data/lib/glimmer/libui/grid_proxy.rb +1 -1
- data/lib/glimmer/libui/matrix_proxy.rb +145 -0
- data/lib/glimmer/libui/parent.rb +36 -0
- data/lib/glimmer/libui/path_proxy.rb +14 -17
- data/lib/glimmer/libui/shape.rb +8 -9
- data/lib/glimmer/libui/transformable.rb +72 -0
- data/lib/glimmer/libui/window_proxy.rb +8 -1
- data/lib/glimmer/libui.rb +50 -0
- data/lib/glimmer-dsl-libui.rb +1 -0
- metadata +8 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/examples/area_gallery.rb
CHANGED
@@ -3,50 +3,48 @@ require 'glimmer-dsl-libui'
|
|
3
3
|
include Glimmer
|
4
4
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
line(400, 400)
|
25
|
-
|
26
|
-
closed true
|
27
|
-
}
|
6
|
+
area {
|
7
|
+
path { # declarative stable path
|
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
|
+
fill r: 204, g: 102, b: 204
|
18
|
+
}
|
19
|
+
path { # declarative stable path
|
20
|
+
figure(100, 100) {
|
21
|
+
line(100, 400)
|
22
|
+
line(400, 100)
|
23
|
+
line(400, 400)
|
28
24
|
|
29
|
-
|
30
|
-
stroke r: 0, g: 0, b: 0
|
25
|
+
closed true
|
31
26
|
}
|
32
|
-
path { # declarative stable path
|
33
|
-
figure(0, 0) {
|
34
|
-
bezier(200, 100, 100, 200, 400, 100)
|
35
|
-
bezier(300, 100, 100, 300, 100, 400)
|
36
|
-
bezier(100, 300, 300, 100, 400, 400)
|
37
27
|
|
38
|
-
|
39
|
-
|
28
|
+
fill r: 202, g: 102, b: 104, a: 0.5
|
29
|
+
stroke r: 0, g: 0, b: 0
|
30
|
+
}
|
31
|
+
path { # declarative stable path
|
32
|
+
figure(0, 0) {
|
33
|
+
bezier(200, 100, 100, 200, 400, 100)
|
34
|
+
bezier(300, 100, 100, 300, 100, 400)
|
35
|
+
bezier(100, 300, 300, 100, 400, 400)
|
40
36
|
|
41
|
-
|
42
|
-
stroke thickness: 2, r: 0, g: 0, b: 0
|
37
|
+
closed true
|
43
38
|
}
|
44
|
-
path { # declarative stable path
|
45
|
-
arc(200, 200, 90, 0, 360, false)
|
46
39
|
|
47
|
-
|
48
|
-
|
49
|
-
|
40
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
41
|
+
stroke thickness: 2, r: 0, g: 0, b: 0
|
42
|
+
}
|
43
|
+
path { # declarative stable path
|
44
|
+
arc(200, 200, 90, 0, 360, false)
|
45
|
+
|
46
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
47
|
+
stroke thickness: 2, r: 0, g: 0, b: 0
|
50
48
|
}
|
51
49
|
}
|
52
50
|
}.show
|
data/examples/area_gallery2.rb
CHANGED
@@ -3,111 +3,109 @@ require 'glimmer-dsl-libui'
|
|
3
3
|
include Glimmer
|
4
4
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
length 100
|
13
|
-
}
|
14
|
-
square {
|
15
|
-
x 100
|
16
|
-
y 100
|
17
|
-
length 400
|
18
|
-
}
|
19
|
-
|
20
|
-
fill r: 102, g: 102, b: 204
|
6
|
+
area {
|
7
|
+
path { # declarative stable path
|
8
|
+
square {
|
9
|
+
x 0
|
10
|
+
y 0
|
11
|
+
length 100
|
21
12
|
}
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
13
|
+
square {
|
14
|
+
x 100
|
15
|
+
y 100
|
16
|
+
length 400
|
17
|
+
}
|
18
|
+
|
19
|
+
fill r: 102, g: 102, b: 204
|
20
|
+
}
|
21
|
+
path { # declarative stable path
|
22
|
+
rectangle {
|
23
|
+
x 0
|
24
|
+
y 100
|
25
|
+
width 100
|
26
|
+
height 400
|
27
|
+
}
|
28
|
+
rectangle {
|
29
|
+
x 100
|
30
|
+
y 0
|
31
|
+
width 400
|
32
|
+
height 100
|
37
33
|
}
|
38
|
-
|
39
|
-
|
34
|
+
|
35
|
+
fill r: 204, g: 102, b: 204
|
36
|
+
}
|
37
|
+
path { # declarative stable path
|
38
|
+
figure {
|
39
|
+
x 100
|
40
|
+
y 100
|
41
|
+
|
42
|
+
line {
|
40
43
|
x 100
|
44
|
+
y 400
|
45
|
+
}
|
46
|
+
line {
|
47
|
+
x 400
|
41
48
|
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
|
49
|
+
}
|
50
|
+
line {
|
51
|
+
x 400
|
52
|
+
y 400
|
57
53
|
}
|
58
54
|
|
59
|
-
|
60
|
-
stroke r: 0, g: 0, b: 0
|
55
|
+
closed true
|
61
56
|
}
|
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
57
|
|
92
|
-
|
58
|
+
fill r: 202, g: 102, b: 104, a: 0.5
|
59
|
+
stroke r: 0, g: 0, b: 0
|
60
|
+
}
|
61
|
+
path { # declarative stable path
|
62
|
+
figure {
|
63
|
+
x 0
|
64
|
+
y 0
|
65
|
+
|
66
|
+
bezier {
|
67
|
+
c1_x 200
|
68
|
+
c1_y 100
|
69
|
+
c2_x 100
|
70
|
+
c2_y 200
|
71
|
+
end_x 400
|
72
|
+
end_y 100
|
73
|
+
}
|
74
|
+
bezier {
|
75
|
+
c1_x 300
|
76
|
+
c1_y 100
|
77
|
+
c2_x 100
|
78
|
+
c2_y 300
|
79
|
+
end_x 100
|
80
|
+
end_y 400
|
81
|
+
}
|
82
|
+
bezier {
|
83
|
+
c1_x 100
|
84
|
+
c1_y 300
|
85
|
+
c2_x 300
|
86
|
+
c2_y 100
|
87
|
+
end_x 400
|
88
|
+
end_y 400
|
93
89
|
}
|
94
90
|
|
95
|
-
|
96
|
-
stroke thickness: 2, r: 0, g: 0, b: 0
|
91
|
+
closed true
|
97
92
|
}
|
98
|
-
path { # declarative stable path
|
99
|
-
arc {
|
100
|
-
x_center 200
|
101
|
-
y_center 200
|
102
|
-
radius 90
|
103
|
-
start_angle 0
|
104
|
-
sweep 360
|
105
|
-
is_negative false
|
106
|
-
}
|
107
93
|
|
108
|
-
|
109
|
-
|
94
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
95
|
+
stroke thickness: 2, r: 0, g: 0, b: 0
|
96
|
+
}
|
97
|
+
path { # declarative stable path
|
98
|
+
arc {
|
99
|
+
x_center 200
|
100
|
+
y_center 200
|
101
|
+
radius 90
|
102
|
+
start_angle 0
|
103
|
+
sweep 360
|
104
|
+
is_negative false
|
110
105
|
}
|
106
|
+
|
107
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
108
|
+
stroke thickness: 2, r: 0, g: 0, b: 0
|
111
109
|
}
|
112
110
|
}
|
113
111
|
}.show
|
data/examples/area_gallery3.rb
CHANGED
@@ -3,52 +3,50 @@ require 'glimmer-dsl-libui'
|
|
3
3
|
include Glimmer
|
4
4
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
|
-
|
7
|
-
|
8
|
-
on_draw
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
area {
|
7
|
+
on_draw do |area_draw_params|
|
8
|
+
path { # a dynamic path is added semi-declaratively inside on_draw block
|
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
|
+
fill r: 204, g: 102, b: 204
|
19
|
+
}
|
20
|
+
path { # a dynamic path is added semi-declaratively inside on_draw block
|
21
|
+
figure(100, 100) {
|
22
|
+
line(100, 400)
|
23
|
+
line(400, 100)
|
24
|
+
line(400, 400)
|
25
|
+
|
26
|
+
closed true
|
14
27
|
}
|
15
|
-
path(area_draw_params) { # a dynamic path is added semi-declaratively inside on_draw block
|
16
|
-
rectangle(0, 100, 100, 400)
|
17
|
-
rectangle(100, 0, 400, 100)
|
18
28
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
closed true
|
28
|
-
}
|
29
|
+
fill r: 202, g: 102, b: 104, a: 0.5
|
30
|
+
stroke r: 0, g: 0, b: 0
|
31
|
+
}
|
32
|
+
path { # a dynamic path is added semi-declaratively inside on_draw block
|
33
|
+
figure(0, 0) {
|
34
|
+
bezier(200, 100, 100, 200, 400, 100)
|
35
|
+
bezier(300, 100, 100, 300, 100, 400)
|
36
|
+
bezier(100, 300, 300, 100, 400, 400)
|
29
37
|
|
30
|
-
|
31
|
-
stroke r: 0, g: 0, b: 0
|
38
|
+
closed true
|
32
39
|
}
|
33
|
-
path(area_draw_params) { # a dynamic path is added semi-declaratively inside on_draw block
|
34
|
-
figure(0, 0) {
|
35
|
-
bezier(200, 100, 100, 200, 400, 100)
|
36
|
-
bezier(300, 100, 100, 300, 100, 400)
|
37
|
-
bezier(100, 300, 300, 100, 400, 400)
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
42
|
+
stroke thickness: 2, r: 0, g: 0, b: 0
|
43
|
+
}
|
44
|
+
path { # a dynamic path is added semi-declaratively inside on_draw block
|
45
|
+
arc(200, 200, 90, 0, 360, false)
|
41
46
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
arc(200, 200, 90, 0, 360, false)
|
47
|
-
|
48
|
-
fill r: 202, g: 102, b: 204, a: 0.5
|
49
|
-
stroke thickness: 2, r: 0, g: 0, b: 0
|
50
|
-
}
|
51
|
-
end
|
52
|
-
}
|
47
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
48
|
+
stroke thickness: 2, r: 0, g: 0, b: 0
|
49
|
+
}
|
50
|
+
end
|
53
51
|
}
|
54
52
|
}.show
|
data/examples/area_gallery4.rb
CHANGED
@@ -3,113 +3,111 @@ require 'glimmer-dsl-libui'
|
|
3
3
|
include Glimmer
|
4
4
|
|
5
5
|
window('Area Gallery', 400, 400) {
|
6
|
-
|
7
|
-
|
8
|
-
on_draw
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
6
|
+
area {
|
7
|
+
on_draw do |area_draw_params|
|
8
|
+
path { # a dynamic path is added semi-declaratively inside on_draw block
|
9
|
+
square {
|
10
|
+
x 0
|
11
|
+
y 0
|
12
|
+
length 100
|
13
|
+
}
|
14
|
+
square {
|
15
|
+
x 100
|
16
|
+
y 100
|
17
|
+
length 400
|
18
|
+
}
|
19
|
+
|
20
|
+
fill r: 102, g: 102, b: 204
|
21
|
+
}
|
22
|
+
path { # a dynamic path is added semi-declaratively inside on_draw block
|
23
|
+
rectangle {
|
24
|
+
x 0
|
25
|
+
y 100
|
26
|
+
width 100
|
27
|
+
height 400
|
28
|
+
}
|
29
|
+
rectangle {
|
30
|
+
x 100
|
31
|
+
y 0
|
32
|
+
width 400
|
33
|
+
height 100
|
34
|
+
}
|
35
|
+
|
36
|
+
fill r: 204, g: 102, b: 204
|
37
|
+
}
|
38
|
+
path { # a dynamic path is added semi-declaratively inside on_draw block
|
39
|
+
figure {
|
40
|
+
x 100
|
41
|
+
y 100
|
42
|
+
|
43
|
+
line {
|
16
44
|
x 100
|
17
|
-
y
|
18
|
-
length 400
|
45
|
+
y 400
|
19
46
|
}
|
20
|
-
|
21
|
-
|
22
|
-
}
|
23
|
-
path(area_draw_params) { # a dynamic path is added semi-declaratively inside on_draw block
|
24
|
-
rectangle {
|
25
|
-
x 0
|
47
|
+
line {
|
48
|
+
x 400
|
26
49
|
y 100
|
27
|
-
width 100
|
28
|
-
height 400
|
29
50
|
}
|
30
|
-
|
31
|
-
x
|
32
|
-
y
|
33
|
-
width 400
|
34
|
-
height 100
|
51
|
+
line {
|
52
|
+
x 400
|
53
|
+
y 400
|
35
54
|
}
|
36
|
-
|
37
|
-
|
55
|
+
|
56
|
+
closed true
|
38
57
|
}
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
56
|
-
|
57
|
-
closed true
|
58
|
+
|
59
|
+
fill r: 202, g: 102, b: 104, a: 0.5
|
60
|
+
stroke r: 0, g: 0, b: 0
|
61
|
+
}
|
62
|
+
path { # a dynamic path is added semi-declaratively inside on_draw block
|
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
|
58
74
|
}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
-
closed true
|
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
|
94
82
|
}
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
y_center 200
|
103
|
-
radius 90
|
104
|
-
start_angle 0
|
105
|
-
sweep 360
|
106
|
-
is_negative false
|
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
|
107
90
|
}
|
108
|
-
|
109
|
-
|
110
|
-
stroke thickness: 2, r: 0, g: 0, b: 0
|
91
|
+
|
92
|
+
closed true
|
111
93
|
}
|
112
|
-
|
113
|
-
|
94
|
+
|
95
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
96
|
+
stroke thickness: 2, r: 0, g: 0, b: 0
|
97
|
+
}
|
98
|
+
path { # a dynamic path is added semi-declaratively inside on_draw block
|
99
|
+
arc {
|
100
|
+
x_center 200
|
101
|
+
y_center 200
|
102
|
+
radius 90
|
103
|
+
start_angle 0
|
104
|
+
sweep 360
|
105
|
+
is_negative false
|
106
|
+
}
|
107
|
+
|
108
|
+
fill r: 202, g: 102, b: 204, a: 0.5
|
109
|
+
stroke thickness: 2, r: 0, g: 0, b: 0
|
110
|
+
}
|
111
|
+
end
|
114
112
|
}
|
115
113
|
}.show
|
data/examples/basic_area2.rb
CHANGED
@@ -8,7 +8,7 @@ window('Basic Area', 400, 400) {
|
|
8
8
|
vertical_box {
|
9
9
|
area {
|
10
10
|
on_draw do |area_draw_params|
|
11
|
-
path
|
11
|
+
path { # a dynamic path is added semi-declaratively inside on_draw block
|
12
12
|
rectangle(0, 0, 400, 400)
|
13
13
|
|
14
14
|
fill r: 102, g: 102, b: 204, a: 1.0
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'glimmer-dsl-libui'
|
2
|
+
|
3
|
+
include Glimmer
|
4
|
+
|
5
|
+
window('Basic Transform', 350, 350) {
|
6
|
+
area {
|
7
|
+
path {
|
8
|
+
square(0, 0, 350)
|
9
|
+
|
10
|
+
fill r: 255, g: 255, b: 0
|
11
|
+
}
|
12
|
+
40.times do |n|
|
13
|
+
path {
|
14
|
+
square(0, 0, 100)
|
15
|
+
|
16
|
+
fill r: [255 - n*5, 0].max, g: [n*5, 255].min, b: 0, a: 0.5
|
17
|
+
stroke color: 0, thickness: 2
|
18
|
+
transform {
|
19
|
+
skew 0.15, 0.15
|
20
|
+
translate 50, 50
|
21
|
+
rotate 100, 100, -9 * n
|
22
|
+
scale 1.1, 1.1
|
23
|
+
}
|
24
|
+
}
|
25
|
+
end
|
26
|
+
}
|
27
|
+
}.show
|
data/examples/dynamic_area.rb
CHANGED
@@ -88,7 +88,7 @@ window('Dynamic Area', 240, 600) {
|
|
88
88
|
|
89
89
|
@area = area {
|
90
90
|
on_draw do |area_draw_params|
|
91
|
-
path
|
91
|
+
path { # a dynamic path is added semi-declaratively inside on_draw block
|
92
92
|
rectangle(@x_spinbox.value, @y_spinbox.value, @width_spinbox.value, @height_spinbox.value)
|
93
93
|
|
94
94
|
fill r: @red_spinbox.value, g: @green_spinbox.value, b: @blue_spinbox.value, a: @alpha_spinbox.value / 100.0
|