processing 1.1.2 → 1.1.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 +12 -0
- data/VERSION +1 -1
- data/lib/processing/all.rb +53 -0
- data/lib/processing/graphics_context.rb +5 -2
- data/lib/processing.rb +15 -10
- data/processing.gemspec +4 -4
- data/test/test_graphics_context.rb +4 -0
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ef8468c160d98ed171b6895b53b5d7f2de366412dc11016009344e84e5eeb3d
|
4
|
+
data.tar.gz: c0d126f5efdca61a943ce8636e6e8de9b0f00d9c11e8fe992cf7acf4344e16ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3bf31eac373300c0c5adbe71a43931cee89f78c90de57a77f065430e4622295f6ac94af876f542764864e4be40735a5f1fa4d3fc0e728d1fbd7baf11bc8e9c1
|
7
|
+
data.tar.gz: ed6609b295154cac65f3fe1af3f48a4532421da3cac7b0846feccccfb135181e88db60bdf5b5b478f1f57c8084f230af5738cfa651cadd979aa1c72cf7cd4800
|
data/ChangeLog.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
# processing ChangeLog
|
2
2
|
|
3
3
|
|
4
|
+
## [v1.1.4] - 2025-01-27
|
5
|
+
|
6
|
+
- Event blocks can be defined as methods with 'def'
|
7
|
+
- Alias snake case methods
|
8
|
+
- ellipse() can take 3 params
|
9
|
+
|
10
|
+
|
11
|
+
## [v1.1.3] - 2025-01-23
|
12
|
+
|
13
|
+
- Update dependencies
|
14
|
+
|
15
|
+
|
4
16
|
## [v1.1.2] - 2025-01-14
|
5
17
|
|
6
18
|
- Update workflow files
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.4
|
data/lib/processing/all.rb
CHANGED
@@ -9,6 +9,59 @@ require 'net/http'
|
|
9
9
|
require 'xot/inspectable'
|
10
10
|
require 'reflex'
|
11
11
|
|
12
|
+
|
13
|
+
module Processing
|
14
|
+
|
15
|
+
# @private
|
16
|
+
EVENT_NAMES__ = %i[
|
17
|
+
setup draw
|
18
|
+
keyPressed keyReleased keyTyped
|
19
|
+
mousePressed mouseReleased mouseMoved mouseDragged
|
20
|
+
mouseClicked doubleClicked mouseWheel
|
21
|
+
touchStarted touchEnded touchMoved
|
22
|
+
windowMoved windowResized motion
|
23
|
+
]
|
24
|
+
|
25
|
+
# @private
|
26
|
+
def self.setup__(namespace)
|
27
|
+
w = (ENV['WIDTH'] || 500).to_i
|
28
|
+
h = (ENV['HEIGHT'] || 500).to_i
|
29
|
+
|
30
|
+
window = Processing::Window.new(w, h) {start}
|
31
|
+
context = namespace::Context.new window
|
32
|
+
funcs = (context.methods - Object.instance_methods)
|
33
|
+
.reject {_1 =~ /__$/} # methods for internal use
|
34
|
+
events = to_snake_case__(EVENT_NAMES__).flatten.uniq
|
35
|
+
.each.with_object({}) {|event, hash| hash[event] = -> {__send__ event}}
|
36
|
+
|
37
|
+
return window, context, funcs, events
|
38
|
+
end
|
39
|
+
|
40
|
+
# @private
|
41
|
+
def self.alias_snake_case_methods__(klass, recursive = 1)
|
42
|
+
to_snake_case__(klass.instance_methods false)
|
43
|
+
.reject {|camel, snake| camel =~ /__$/}
|
44
|
+
.reject {|camel, snake| klass.method_defined? snake}
|
45
|
+
.each {|camel, snake| klass.alias_method snake, camel}
|
46
|
+
if recursive > 0
|
47
|
+
klass.constants.map {klass.const_get _1}
|
48
|
+
.flatten
|
49
|
+
.select {_1.class == Module || _1.class == Class}
|
50
|
+
.each {|inner_class| alias_snake_case_methods__ inner_class, recursive - 1}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# @private
|
55
|
+
def self.to_snake_case__(camel_case_names)
|
56
|
+
camel_case_names.map do |camel|
|
57
|
+
snake = camel.to_s.gsub(/([a-z])([A-Z])/) {"#{$1}_#{$2.downcase}"}
|
58
|
+
[camel, snake].map(&:to_sym)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end# Processing
|
63
|
+
|
64
|
+
|
12
65
|
require 'processing/extension'
|
13
66
|
require 'processing/app'
|
14
67
|
require 'processing/window'
|
@@ -1540,6 +1540,9 @@ module Processing
|
|
1540
1540
|
#
|
1541
1541
|
# The parameters a, b, c, and d are determined by ellipseMode().
|
1542
1542
|
#
|
1543
|
+
# @overload ellipse(a, b, c)
|
1544
|
+
# @overload ellipse(a, b, c, d)
|
1545
|
+
#
|
1543
1546
|
# @param a [Numeric] horizontal position of the shape, by default
|
1544
1547
|
# @param b [Numeric] vertical position of the shape, by default
|
1545
1548
|
# @param c [Numeric] width of the shape, by default
|
@@ -1550,9 +1553,9 @@ module Processing
|
|
1550
1553
|
# @see https://processing.org/reference/ellipse_.html
|
1551
1554
|
# @see https://p5js.org/reference/p5/ellipse/
|
1552
1555
|
#
|
1553
|
-
def ellipse(a, b, c, d)
|
1556
|
+
def ellipse(a, b, c, d = nil)
|
1554
1557
|
assertDrawing__
|
1555
|
-
x, y, w, h = toXYWH__ @ellipseMode__, a, b, c, d
|
1558
|
+
x, y, w, h = toXYWH__ @ellipseMode__, a, b, c, (d || c)
|
1556
1559
|
@painter__.ellipse x, y, w, h
|
1557
1560
|
nil
|
1558
1561
|
end
|
data/lib/processing.rb
CHANGED
@@ -2,19 +2,24 @@ require 'processing/all'
|
|
2
2
|
|
3
3
|
|
4
4
|
module Processing
|
5
|
-
|
6
|
-
|
7
|
-
WINDOW__
|
8
|
-
CONTEXT__ = Processing::Context.new WINDOW__
|
5
|
+
Processing.alias_snake_case_methods__ Processing
|
6
|
+
|
7
|
+
WINDOW__, CONTEXT__, funcs, events = Processing.setup__ Processing
|
9
8
|
|
10
9
|
refine Object do
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
funcs.each do |func|
|
11
|
+
define_method func do |*args, **kwargs, &block|
|
12
|
+
CONTEXT__.__send__ func, *args, **kwargs, &block
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
event_names = events.keys
|
17
|
+
Object.singleton_class.define_method :method_added do |method|
|
18
|
+
if event_names.include? method
|
19
|
+
caller = events[method]
|
20
|
+
CONTEXT__.__send__(method) {caller.call} if caller
|
17
21
|
end
|
22
|
+
end
|
18
23
|
end
|
19
24
|
end# Processing
|
20
25
|
|
data/processing.gemspec
CHANGED
@@ -26,10 +26,10 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.required_ruby_version = '>= 3.0.0'
|
27
27
|
|
28
28
|
s.add_dependency 'rexml'
|
29
|
-
s.add_dependency 'xot', '~> 0.3.
|
30
|
-
s.add_dependency 'rucy', '~> 0.3.
|
31
|
-
s.add_dependency 'rays', '~> 0.3.
|
32
|
-
s.add_dependency 'reflexion', '~> 0.3.
|
29
|
+
s.add_dependency 'xot', '~> 0.3.3', '>= 0.3.3'
|
30
|
+
s.add_dependency 'rucy', '~> 0.3.3', '>= 0.3.3'
|
31
|
+
s.add_dependency 'rays', '~> 0.3.3', '>= 0.3.3'
|
32
|
+
s.add_dependency 'reflexion', '~> 0.3.3', '>= 0.3.3'
|
33
33
|
|
34
34
|
s.files = `git ls-files`.split $/
|
35
35
|
s.test_files = s.files.grep %r{^(test|spec|features)/}
|
@@ -198,9 +198,13 @@ class TestGraphicsContext < Test::Unit::TestCase
|
|
198
198
|
|
199
199
|
def test_ellipse_with_ellipseMode()
|
200
200
|
assert_p5_draw 'ellipseMode CORNER; ellipse 100, 200, 300, 400'
|
201
|
+
assert_p5_draw 'ellipseMode CORNER; ellipse 100, 200, 300'
|
201
202
|
assert_p5_draw 'ellipseMode CORNERS; ellipse 100, 200, 300, 500'
|
203
|
+
assert_p5_draw 'ellipseMode CORNERS; ellipse 100, 200, 300'
|
202
204
|
assert_p5_draw 'ellipseMode CENTER; ellipse 400, 500, 300, 400'
|
205
|
+
assert_p5_draw 'ellipseMode CENTER; ellipse 400, 500, 300'
|
203
206
|
assert_p5_draw 'ellipseMode RADIUS; ellipse 400, 500, 300, 400'
|
207
|
+
assert_p5_draw 'ellipseMode RADIUS; ellipse 400, 500, 300'
|
204
208
|
end
|
205
209
|
|
206
210
|
def test_circle()
|
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: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xordog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rexml
|
@@ -30,80 +30,80 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.3.
|
33
|
+
version: 0.3.3
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 0.3.
|
36
|
+
version: 0.3.3
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.3.
|
43
|
+
version: 0.3.3
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.3.
|
46
|
+
version: 0.3.3
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rucy
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.3.
|
53
|
+
version: 0.3.3
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.3.
|
56
|
+
version: 0.3.3
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.3.
|
63
|
+
version: 0.3.3
|
64
64
|
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: 0.3.
|
66
|
+
version: 0.3.3
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: rays
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: 0.3.
|
73
|
+
version: 0.3.3
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.3.
|
76
|
+
version: 0.3.3
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.3.
|
83
|
+
version: 0.3.3
|
84
84
|
- - ">="
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: 0.3.
|
86
|
+
version: 0.3.3
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
88
|
name: reflexion
|
89
89
|
requirement: !ruby/object:Gem::Requirement
|
90
90
|
requirements:
|
91
91
|
- - "~>"
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.3.
|
93
|
+
version: 0.3.3
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.3.
|
96
|
+
version: 0.3.3
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.3.
|
103
|
+
version: 0.3.3
|
104
104
|
- - ">="
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: 0.3.
|
106
|
+
version: 0.3.3
|
107
107
|
description: Creative Coding Framework has API compatible to Processing or p5.js.
|
108
108
|
email: xordog@gmail.com
|
109
109
|
executables: []
|