processing 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/utils.rb +2 -1
- data/ChangeLog.md +5 -0
- data/VERSION +1 -1
- data/lib/processing/app.rb +1 -0
- data/lib/processing/context.rb +10 -4
- data/lib/processing/extension.rb +1 -0
- data/lib/processing/image.rb +11 -0
- data/lib/processing/touch.rb +4 -0
- data/lib/processing/vector.rb +2 -0
- data/lib/processing/window.rb +42 -32
- data/processing.gemspec +4 -4
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcfefec0dd503e3934cfd162cf4c2ed6e351b0ca16e5a8f262831ae339677741
|
4
|
+
data.tar.gz: aa8fa395d100d4c4b5124d239213f6608a87e556beefb80dd4d50cf8d64a8ce0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94852e2aff0eaece5b719cb1ca7ffb9651cd7de5012ae9992f909213746aee5cdca33a37e0f88e0d65bef1a2d79fa8a0bbbad2ed4d1439373175eb4167f7286a
|
7
|
+
data.tar.gz: a59a540d86331c45502c71bdc259e86591c836c92d857bb11dfe65244412f9697c664517aeceaba3f28fcbdc19917909c38832e21813e638b8c8a5580b28c1be
|
data/.github/workflows/utils.rb
CHANGED
@@ -20,8 +20,9 @@ def setup_dependencies(build: true, only: nil)
|
|
20
20
|
|
21
21
|
exts.each do |ext|
|
22
22
|
gem = RENAMES[ext.to_sym].then {|s| s || ext}
|
23
|
-
clone = "git clone --depth 1 https://github.com/xord/#{ext}.git ../#{ext}"
|
24
23
|
ver = gemspec[/add_runtime_dependency.*['"]#{gem}['"].*['"]\s*~>\s*([\d\.]+)\s*['"]/, 1]
|
24
|
+
opts = '-c advice.detachedHead=false --depth 1'
|
25
|
+
clone = "git clone #{opts} https://github.com/xord/#{ext}.git ../#{ext}"
|
25
26
|
|
26
27
|
# 'rake subtree:push' pushes all subrepos, so cloning by new tag
|
27
28
|
# often fails before tagging each new tag
|
data/ChangeLog.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.5
|
data/lib/processing/app.rb
CHANGED
data/lib/processing/context.rb
CHANGED
@@ -7,10 +7,14 @@ module Processing
|
|
7
7
|
|
8
8
|
include GraphicsContext
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
Graphics
|
13
|
-
|
10
|
+
Capture = Processing::Capture
|
11
|
+
Font = Processing::Font
|
12
|
+
Graphics = Processing::Graphics
|
13
|
+
Image = Processing::Image
|
14
|
+
Shader = Processing::Shader
|
15
|
+
TextBounds = Processing::TextBounds
|
16
|
+
Touch = Processing::Touch
|
17
|
+
Vector = Processing::Vector
|
14
18
|
|
15
19
|
# @private
|
16
20
|
@@context__ = nil
|
@@ -48,6 +52,8 @@ module Processing
|
|
48
52
|
@window__.update_canvas = proc {|i, p| updateCanvas__ i, p}
|
49
53
|
|
50
54
|
@window__.instance_variable_set :@context, self
|
55
|
+
|
56
|
+
# @private
|
51
57
|
def @window__.draw_screen(painter)
|
52
58
|
@context.drawImage__ painter
|
53
59
|
end
|
data/lib/processing/extension.rb
CHANGED
data/lib/processing/image.rb
CHANGED
@@ -26,6 +26,17 @@ module Processing
|
|
26
26
|
@image.height
|
27
27
|
end
|
28
28
|
|
29
|
+
alias w width
|
30
|
+
alias h height
|
31
|
+
|
32
|
+
# Returns the width and height of image.
|
33
|
+
#
|
34
|
+
# @return [Array<Numeric>] [width, height]
|
35
|
+
#
|
36
|
+
def size()
|
37
|
+
@image.size
|
38
|
+
end
|
39
|
+
|
29
40
|
# Applies an image filter.
|
30
41
|
#
|
31
42
|
# overload filter(shader)
|
data/lib/processing/touch.rb
CHANGED
data/lib/processing/vector.rb
CHANGED
data/lib/processing/window.rb
CHANGED
@@ -1,26 +1,9 @@
|
|
1
1
|
module Processing
|
2
2
|
|
3
3
|
|
4
|
+
# @private
|
4
5
|
class Window < Reflex::Window
|
5
6
|
|
6
|
-
class CanvasView < Reflex::View
|
7
|
-
def on_update(e)
|
8
|
-
window.on_canvas_update e
|
9
|
-
end
|
10
|
-
|
11
|
-
def on_draw(e)
|
12
|
-
window.on_canvas_draw e
|
13
|
-
end
|
14
|
-
|
15
|
-
def on_pointer(e)
|
16
|
-
window.on_canvas_pointer e
|
17
|
-
end
|
18
|
-
|
19
|
-
def on_resize(e)
|
20
|
-
window.on_canvas_resize e
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
7
|
attr_accessor :setup, :update, :draw, :resize,
|
25
8
|
:key_down, :key_up,
|
26
9
|
:pointer_down, :pointer_up, :pointer_move, :pointer_drag,
|
@@ -32,11 +15,12 @@ module Processing
|
|
32
15
|
def initialize(width = 500, height = 500, *args, **kwargs, &block)
|
33
16
|
Processing.instance_variable_set :@window, self
|
34
17
|
|
35
|
-
@events
|
36
|
-
@error
|
37
|
-
@auto_resize
|
38
|
-
@canvas
|
39
|
-
@canvas_view
|
18
|
+
@events = []
|
19
|
+
@error = nil
|
20
|
+
@auto_resize = true
|
21
|
+
@canvas = Canvas.new self
|
22
|
+
@canvas_view = add CanvasView.new name: :canvas
|
23
|
+
@overlay_view = @canvas_view.add Reflex::View.new name: :overlay
|
40
24
|
|
41
25
|
super(*args, size: [width, height], **kwargs, &block)
|
42
26
|
end
|
@@ -57,6 +41,10 @@ module Processing
|
|
57
41
|
@events.last
|
58
42
|
end
|
59
43
|
|
44
|
+
def add_overlay(view)
|
45
|
+
@overlay_view.add view
|
46
|
+
end
|
47
|
+
|
60
48
|
def start(&block)
|
61
49
|
draw_canvas do
|
62
50
|
block.call if block
|
@@ -64,14 +52,6 @@ module Processing
|
|
64
52
|
end
|
65
53
|
end
|
66
54
|
|
67
|
-
def resize_canvas(width, height, pixel_density = nil, window_pixel_density: nil)
|
68
|
-
@pixel_density = pixel_density if pixel_density
|
69
|
-
if @canvas.resize width, height, pixel_density || @pixel_density || window_pixel_density
|
70
|
-
@update_canvas.call canvas_image, canvas_painter if @update_canvas
|
71
|
-
size width, height
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
55
|
def on_setup()
|
76
56
|
call_block @setup, nil
|
77
57
|
end
|
@@ -128,12 +108,21 @@ module Processing
|
|
128
108
|
draw_canvas {call_block @resize, e} if @resize
|
129
109
|
end
|
130
110
|
|
111
|
+
def resize_canvas(width, height, pixel_density = nil, window_pixel_density: nil)
|
112
|
+
@pixel_density = pixel_density if pixel_density
|
113
|
+
if @canvas.resize width, height, pixel_density || @pixel_density || window_pixel_density
|
114
|
+
@update_canvas.call canvas_image, canvas_painter if @update_canvas
|
115
|
+
size width, height
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
131
119
|
private
|
132
120
|
|
133
121
|
def update_canvas_view()
|
134
122
|
scrollx, scrolly, zoom = get_scroll_and_zoom
|
135
123
|
@canvas_view.scroll_to scrollx, scrolly
|
136
|
-
@canvas_view.zoom zoom
|
124
|
+
@canvas_view.zoom = zoom
|
125
|
+
@overlay_view.size = canvas_image.size
|
137
126
|
end
|
138
127
|
|
139
128
|
def get_scroll_and_zoom()
|
@@ -235,4 +224,25 @@ module Processing
|
|
235
224
|
end# Window::Canvas
|
236
225
|
|
237
226
|
|
227
|
+
class Window::CanvasView < Reflex::View
|
228
|
+
|
229
|
+
def on_update(e)
|
230
|
+
window.on_canvas_update e
|
231
|
+
end
|
232
|
+
|
233
|
+
def on_draw(e)
|
234
|
+
window.on_canvas_draw e
|
235
|
+
end
|
236
|
+
|
237
|
+
def on_pointer(e)
|
238
|
+
window.on_canvas_pointer e
|
239
|
+
end
|
240
|
+
|
241
|
+
def on_resize(e)
|
242
|
+
window.on_canvas_resize e
|
243
|
+
end
|
244
|
+
|
245
|
+
end# Window::CanvasView
|
246
|
+
|
247
|
+
|
238
248
|
end# Processing
|
data/processing.gemspec
CHANGED
@@ -28,10 +28,10 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.platform = Gem::Platform::RUBY
|
29
29
|
s.required_ruby_version = '>= 2.7.0'
|
30
30
|
|
31
|
-
s.add_runtime_dependency 'xot', '~> 0.1.
|
32
|
-
s.add_runtime_dependency 'rucy', '~> 0.1.
|
33
|
-
s.add_runtime_dependency 'rays', '~> 0.1.
|
34
|
-
s.add_runtime_dependency 'reflexion', '~> 0.1.
|
31
|
+
s.add_runtime_dependency 'xot', '~> 0.1.34'
|
32
|
+
s.add_runtime_dependency 'rucy', '~> 0.1.34'
|
33
|
+
s.add_runtime_dependency 'rays', '~> 0.1.34'
|
34
|
+
s.add_runtime_dependency 'reflexion', '~> 0.1.35'
|
35
35
|
|
36
36
|
s.add_development_dependency 'rake'
|
37
37
|
s.add_development_dependency 'test-unit'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: processing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xordog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xot
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.34
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
26
|
+
version: 0.1.34
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rucy
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.1.
|
33
|
+
version: 0.1.34
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.1.
|
40
|
+
version: 0.1.34
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rays
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.1.
|
47
|
+
version: 0.1.34
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.1.
|
54
|
+
version: 0.1.34
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: reflexion
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.1.
|
61
|
+
version: 0.1.35
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.1.
|
68
|
+
version: 0.1.35
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|