glimmer-dsl-libui 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +16 -14
- data/VERSION +1 -1
- data/examples/area_gallery.rb +2 -2
- data/examples/area_gallery2.rb +2 -2
- data/examples/area_gallery3.rb +2 -2
- data/examples/area_gallery4.rb +2 -2
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/libui/control_proxy/path_proxy.rb +26 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc16d9ab058fc6f75617c56ba43134253caf52ff729402efa045121823687245
|
4
|
+
data.tar.gz: 3ff67efc0e34b5730818c477693f81d31cb41a7f3b928fda34038d358d26c71e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cfe89c0e5f2f0507484c8fadddc2bd75f02e8cb6f09368679c58ebde66fb37dc8c1980b9617e578846138e92b2a6b77920e2f7b5309ddb98cfc658b7bcaabd7
|
7
|
+
data.tar.gz: 99479329a3c7917bc2768f3ca7d7514c448ce70888b807741bf18db67e45d5c139c0ffe6ac7d21595a4f33ddb0cd92e7c328f63470cedd0569c974574fb5938a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.1.7
|
4
|
+
|
5
|
+
- Support `stroke` `:dashes` and use in examples/area_gallery.rb
|
6
|
+
- Support symbol values for draw_line_cap (`:round`, `:square`, `:flat`) and draw_line_join (`:miter`, `:round`, `:bevel`) and draw_fill_mode (`:winding` and `:alternate`)
|
7
|
+
|
3
8
|
## 0.1.6
|
4
9
|
|
5
10
|
- Update default `window` `width` to `190`
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.1.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.1.7
|
2
2
|
## Prerequisite-Free Ruby Desktop Development GUI Library
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
|
4
4
|
[![Maintainability](https://api.codeclimate.com/v1/badges/ce2853efdbecf6ebdc73/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-libui/maintainability)
|
@@ -115,13 +115,13 @@ window('Area Gallery', 400, 400) {
|
|
115
115
|
}
|
116
116
|
|
117
117
|
fill r: 202, g: 102, b: 204, a: 0.5
|
118
|
-
stroke
|
118
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
119
119
|
}
|
120
120
|
path { # declarative stable path
|
121
121
|
arc(200, 200, 90, 0, 360, false)
|
122
122
|
|
123
123
|
fill r: 202, g: 102, b: 204, a: 0.5
|
124
|
-
stroke
|
124
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
125
125
|
}
|
126
126
|
}
|
127
127
|
}.show
|
@@ -143,7 +143,7 @@ Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interes
|
|
143
143
|
|
144
144
|
## Table of Contents
|
145
145
|
|
146
|
-
- [Glimmer DSL for LibUI 0.1.
|
146
|
+
- [Glimmer DSL for LibUI 0.1.7](#-glimmer-dsl-for-libui-017)
|
147
147
|
- [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts)
|
148
148
|
- [Usage](#usage)
|
149
149
|
- [Girb (Glimmer IRB)](#girb-glimmer-irb)
|
@@ -273,7 +273,7 @@ gem install glimmer-dsl-libui
|
|
273
273
|
Or install via Bundler `Gemfile`:
|
274
274
|
|
275
275
|
```ruby
|
276
|
-
gem 'glimmer-dsl-libui', '~> 0.1.
|
276
|
+
gem 'glimmer-dsl-libui', '~> 0.1.7'
|
277
277
|
```
|
278
278
|
|
279
279
|
Add `require 'glimmer-dsl-libui'` at the top, and then `include Glimmer` into the top-level main object for testing or into an actual class for serious usage.
|
@@ -381,7 +381,7 @@ Control(Args) | Properties | Listeners
|
|
381
381
|
`msg_box(window = main_window as Glimmer::LibUI::WindowProxy, title as String, description as String)` | None | None
|
382
382
|
`msg_box_error(window = main_window as Glimmer::LibUI::WindowProxy, title as String, description as String)` | None | None
|
383
383
|
`non_wrapping_multiline_entry` | `read_only` (Boolean), `text` (`String`) | `on_changed`
|
384
|
-
`path` | `fill` (`Hash` of `:r` as `0`-`255`, `:g` as `0`-`255`, `:b` as `0`-`255`, `:a` as `0.0`-`1.0`), `stroke` (`Hash` of `:r` as `0`-`255`, `:g` as `0`-`255`, `:b` as `0`-`255`, `:a` as `0.0`-`1.0`, `:cap` as
|
384
|
+
`path(draw_fill_mode = :winding)` | `fill` (`Hash` of `:r` as `0`-`255`, `:g` as `0`-`255`, `:b` as `0`-`255`, `:a` as `0.0`-`1.0`), `stroke` (`Hash` of `:r` as `0`-`255`, `:g` as `0`-`255`, `:b` as `0`-`255`, `:a` as `0.0`-`1.0`, `:cap` as (`:round`, `:square`, `:flat`), `:join` as (`:miter`, `:round`, `:bevel`), `:thickness` as `Numeric`, `:miter_limit` as `Numeric`, `:dashes` as `Array` of `Numeric` ) | None
|
385
385
|
`preferences_menu_item` | None | `on_clicked`
|
386
386
|
`progress_bar` | `value` (`Numeric`) | None
|
387
387
|
`progress_bar_column(name as String)` | None | None
|
@@ -585,6 +585,8 @@ window('Basic Area', 400, 400) {
|
|
585
585
|
|
586
586
|
Check [examples/dynamic_area.rb](#dynamic-area) for a more detailed semi-declarative example.
|
587
587
|
|
588
|
+
`path` can receive a `draw_fill_mode` argument that can accept values `:winding` or `:alternate` and defaults to `:winding`.
|
589
|
+
|
588
590
|
Available nested `path` shapes:
|
589
591
|
- `rectangle(x as Numeric, y as Numeric, width as Numeric, height as Numeric)`
|
590
592
|
- `square(x as Numeric, y as Numeric, length as Numeric)`
|
@@ -3367,13 +3369,13 @@ window('Area Gallery', 400, 400) {
|
|
3367
3369
|
}
|
3368
3370
|
|
3369
3371
|
fill r: 202, g: 102, b: 204, a: 0.5
|
3370
|
-
stroke
|
3372
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
3371
3373
|
}
|
3372
3374
|
path { # declarative stable path
|
3373
3375
|
arc(200, 200, 90, 0, 360, false)
|
3374
3376
|
|
3375
3377
|
fill r: 202, g: 102, b: 204, a: 0.5
|
3376
|
-
stroke
|
3378
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
3377
3379
|
}
|
3378
3380
|
}
|
3379
3381
|
}.show
|
@@ -3476,7 +3478,7 @@ window('Area Gallery', 400, 400) {
|
|
3476
3478
|
}
|
3477
3479
|
|
3478
3480
|
fill r: 202, g: 102, b: 204, a: 0.5
|
3479
|
-
stroke
|
3481
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
3480
3482
|
}
|
3481
3483
|
path { # declarative stable path
|
3482
3484
|
arc {
|
@@ -3489,7 +3491,7 @@ window('Area Gallery', 400, 400) {
|
|
3489
3491
|
}
|
3490
3492
|
|
3491
3493
|
fill r: 202, g: 102, b: 204, a: 0.5
|
3492
|
-
stroke
|
3494
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
3493
3495
|
}
|
3494
3496
|
}
|
3495
3497
|
}.show
|
@@ -3539,13 +3541,13 @@ window('Area Gallery', 400, 400) {
|
|
3539
3541
|
}
|
3540
3542
|
|
3541
3543
|
fill r: 202, g: 102, b: 204, a: 0.5
|
3542
|
-
stroke
|
3544
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
3543
3545
|
}
|
3544
3546
|
path { # a dynamic path is added semi-declaratively inside on_draw block
|
3545
3547
|
arc(200, 200, 90, 0, 360, false)
|
3546
3548
|
|
3547
3549
|
fill r: 202, g: 102, b: 204, a: 0.5
|
3548
|
-
stroke
|
3550
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
3549
3551
|
}
|
3550
3552
|
end
|
3551
3553
|
}
|
@@ -3650,7 +3652,7 @@ window('Area Gallery', 400, 400) {
|
|
3650
3652
|
}
|
3651
3653
|
|
3652
3654
|
fill r: 202, g: 102, b: 204, a: 0.5
|
3653
|
-
stroke
|
3655
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
3654
3656
|
}
|
3655
3657
|
path { # a dynamic path is added semi-declaratively inside on_draw block
|
3656
3658
|
arc {
|
@@ -3663,7 +3665,7 @@ window('Area Gallery', 400, 400) {
|
|
3663
3665
|
}
|
3664
3666
|
|
3665
3667
|
fill r: 202, g: 102, b: 204, a: 0.5
|
3666
|
-
stroke
|
3668
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
3667
3669
|
}
|
3668
3670
|
end
|
3669
3671
|
}
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
data/examples/area_gallery.rb
CHANGED
@@ -38,13 +38,13 @@ window('Area Gallery', 400, 400) {
|
|
38
38
|
}
|
39
39
|
|
40
40
|
fill r: 202, g: 102, b: 204, a: 0.5
|
41
|
-
stroke
|
41
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
42
42
|
}
|
43
43
|
path { # declarative stable path
|
44
44
|
arc(200, 200, 90, 0, 360, false)
|
45
45
|
|
46
46
|
fill r: 202, g: 102, b: 204, a: 0.5
|
47
|
-
stroke
|
47
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
48
48
|
}
|
49
49
|
}
|
50
50
|
}.show
|
data/examples/area_gallery2.rb
CHANGED
@@ -92,7 +92,7 @@ window('Area Gallery', 400, 400) {
|
|
92
92
|
}
|
93
93
|
|
94
94
|
fill r: 202, g: 102, b: 204, a: 0.5
|
95
|
-
stroke
|
95
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
96
96
|
}
|
97
97
|
path { # declarative stable path
|
98
98
|
arc {
|
@@ -105,7 +105,7 @@ window('Area Gallery', 400, 400) {
|
|
105
105
|
}
|
106
106
|
|
107
107
|
fill r: 202, g: 102, b: 204, a: 0.5
|
108
|
-
stroke
|
108
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
109
109
|
}
|
110
110
|
}
|
111
111
|
}.show
|
data/examples/area_gallery3.rb
CHANGED
@@ -39,13 +39,13 @@ window('Area Gallery', 400, 400) {
|
|
39
39
|
}
|
40
40
|
|
41
41
|
fill r: 202, g: 102, b: 204, a: 0.5
|
42
|
-
stroke
|
42
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
43
43
|
}
|
44
44
|
path { # a dynamic path is added semi-declaratively inside on_draw block
|
45
45
|
arc(200, 200, 90, 0, 360, false)
|
46
46
|
|
47
47
|
fill r: 202, g: 102, b: 204, a: 0.5
|
48
|
-
stroke
|
48
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
49
49
|
}
|
50
50
|
end
|
51
51
|
}
|
data/examples/area_gallery4.rb
CHANGED
@@ -93,7 +93,7 @@ window('Area Gallery', 400, 400) {
|
|
93
93
|
}
|
94
94
|
|
95
95
|
fill r: 202, g: 102, b: 204, a: 0.5
|
96
|
-
stroke
|
96
|
+
stroke r: 0, g: 0, b: 0, thickness: 2, dashes: [50, 10, 10, 10], dash_phase: -50.0
|
97
97
|
}
|
98
98
|
path { # a dynamic path is added semi-declaratively inside on_draw block
|
99
99
|
arc {
|
@@ -106,7 +106,7 @@ window('Area Gallery', 400, 400) {
|
|
106
106
|
}
|
107
107
|
|
108
108
|
fill r: 202, g: 102, b: 204, a: 0.5
|
109
|
-
stroke
|
109
|
+
stroke r: 0, g: 0, b: 0, thickness: 2
|
110
110
|
}
|
111
111
|
end
|
112
112
|
}
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -117,17 +117,38 @@ module Glimmer
|
|
117
117
|
|
118
118
|
def draw_stroke_params
|
119
119
|
@draw_stroke_params ||= ::LibUI::FFI::DrawStrokeParams.malloc
|
120
|
-
@draw_stroke_params.Cap =
|
121
|
-
@draw_stroke_params.Join =
|
120
|
+
@draw_stroke_params.Cap = draw_line_cap # flat
|
121
|
+
@draw_stroke_params.Join = draw_line_join # miter
|
122
122
|
@draw_stroke_params.Thickness = @stroke[:thickness] || 1
|
123
123
|
@draw_stroke_params.MiterLimit = @stroke[:miter_limit] || 10 # DEFAULT_MITER_LIMIT
|
124
|
-
@
|
125
|
-
@draw_stroke_params.
|
126
|
-
@draw_stroke_params.NumDashes = @stroke[:num_dashes] || 0 # TODO reimplement this line correctly (perhaps no need to pass num dashes, yet dashes themselves and use their count here)
|
124
|
+
@draw_stroke_params.Dashes = @stroke[:dashes].to_a.pack('d*')
|
125
|
+
@draw_stroke_params.NumDashes = @stroke[:dashes].to_a.count
|
127
126
|
@draw_stroke_params.DashPhase = @stroke[:dash_phase] || 0
|
128
127
|
@draw_stroke_params
|
129
128
|
end
|
130
129
|
|
130
|
+
def draw_line_cap
|
131
|
+
case @stroke && @stroke[:cap].to_s
|
132
|
+
when 'round'
|
133
|
+
1
|
134
|
+
when 'square'
|
135
|
+
2
|
136
|
+
else # 'flat'
|
137
|
+
0
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def draw_line_join
|
142
|
+
case @stroke && @stroke[:join].to_s
|
143
|
+
when 'round'
|
144
|
+
1
|
145
|
+
when 'bevel'
|
146
|
+
2
|
147
|
+
else # 'miter'
|
148
|
+
0
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
131
152
|
def destroy
|
132
153
|
@parent_proxy&.children&.delete(self)
|
133
154
|
ControlProxy.control_proxies.delete(self)
|