processing 0.5.30 → 0.5.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test-draw.yml +0 -1
- data/.github/workflows/test.yml +0 -1
- data/ChangeLog.md +26 -0
- data/Rakefile +14 -6
- data/VERSION +1 -1
- data/lib/processing/all.rb +1 -0
- data/lib/processing/font.rb +30 -3
- data/lib/processing/graphics.rb +0 -11
- data/lib/processing/graphics_context.rb +526 -53
- data/lib/processing/image.rb +38 -10
- data/lib/processing/shape.rb +294 -0
- data/lib/processing/vector.rb +3 -3
- data/processing.gemspec +4 -4
- data/test/helper.rb +86 -4
- data/test/{draw/p5.rb → p5.rb} +22 -8
- data/test/test_font.rb +33 -2
- data/test/test_graphics.rb +1 -7
- data/test/test_graphics_context.rb +671 -5
- data/test/test_image.rb +21 -0
- data/test/test_shape.rb +512 -0
- data/test/test_vector.rb +1 -1
- metadata +15 -16
- data/test/draw/helper.rb +0 -31
- data/test/draw/test_draw.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f96427cef5e2add31fe4baa3c6055a94bdff9d126d1ae194cd937c24066d4af4
|
4
|
+
data.tar.gz: a4a797bb6246dbb1de3450d6a802ec273553cdf4d5c4b8b2a87e82160f8a22b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d39fcf7857c9ad1b10597811adcb23b04f96f1f78e128ff089b2cd7cd1fe4b851ba0ff235813f8946853d940383ec82568300d9a9914ce028fc9d3622d58b4a
|
7
|
+
data.tar.gz: 226f9d830533ae9f5836ad447bd84de2bb8939d8a5718d1b43c4f66dc073b776c67c7b5c5ccfa421e9271707a9511568b626a9124b6cfaf65dd61ba95fd88af5
|
data/.github/workflows/test.yml
CHANGED
data/ChangeLog.md
CHANGED
@@ -1,6 +1,32 @@
|
|
1
1
|
# processing ChangeLog
|
2
2
|
|
3
3
|
|
4
|
+
## [v0.5.32] - 2024-01-08
|
5
|
+
|
6
|
+
- Add requestImage()
|
7
|
+
- Add texture(), textureMode(), and textureWrap()
|
8
|
+
- Add loadPixels(), updatePixels(), and pixels()
|
9
|
+
- Add curveVertex(), bezierVertex(), and quadraticVertex()
|
10
|
+
- Add beginContour() and endContour()
|
11
|
+
- Add createFont(), loadFont(), and Font.list()
|
12
|
+
- Add Shape#setFill
|
13
|
+
|
14
|
+
- vertex() can teke UV parameters
|
15
|
+
- vertex() records the fill color
|
16
|
+
- Drawing shapes with texture is affected by tin() instead of the fill()
|
17
|
+
|
18
|
+
|
19
|
+
## [v0.5.31] - 2023-12-09
|
20
|
+
|
21
|
+
- Add Shape class
|
22
|
+
- Add createShape(), shape(), shapeMode()
|
23
|
+
- Add beginShape(), endShape(), and vertex(x, y)
|
24
|
+
- Test with p5.rb
|
25
|
+
- GraphicsContext#rotate() can take z parameter
|
26
|
+
- Set default miter_limit to 10
|
27
|
+
- Trigger github actions on all pull_request
|
28
|
+
|
29
|
+
|
4
30
|
## [v0.5.30] - 2023-11-09
|
5
31
|
|
6
32
|
- Test drawing methods with p5.rb
|
data/Rakefile
CHANGED
@@ -14,12 +14,16 @@ require 'reflex/extension'
|
|
14
14
|
require 'processing/extension'
|
15
15
|
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
def test_with_p5()
|
18
|
+
ENV['TEST_WITH_P5'] = '1'
|
19
|
+
end
|
20
|
+
|
21
|
+
EXTENSIONS = [Xot, Rucy, Rays, Reflex, Processing]
|
20
22
|
|
21
23
|
ENV['RDOC'] = 'yardoc --no-private'
|
22
24
|
|
25
|
+
#test_with_p5 if ci?
|
26
|
+
|
23
27
|
default_tasks
|
24
28
|
use_bundler
|
25
29
|
test_ruby_extension
|
@@ -30,10 +34,14 @@ task :clean => 'test:clean'
|
|
30
34
|
|
31
35
|
namespace :test do
|
32
36
|
task :clean do
|
33
|
-
sh %( rm -rf test
|
37
|
+
sh %( rm -rf test/.png/*.png )
|
38
|
+
end
|
39
|
+
|
40
|
+
task :with_p5 do
|
41
|
+
test_with_p5
|
34
42
|
end
|
35
43
|
|
36
|
-
|
37
|
-
|
44
|
+
::Rake::TestTask.new :draw do |t|
|
45
|
+
t.test_files = FileList['test/test_*.rb']
|
38
46
|
end
|
39
47
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.32
|
data/lib/processing/all.rb
CHANGED
data/lib/processing/font.rb
CHANGED
@@ -7,7 +7,8 @@ module Processing
|
|
7
7
|
|
8
8
|
# @private
|
9
9
|
def initialize(font)
|
10
|
-
@font
|
10
|
+
@font = font or raise ArgumentError
|
11
|
+
@cachedSizes = {}
|
11
12
|
end
|
12
13
|
|
13
14
|
# Returns bounding box.
|
@@ -24,8 +25,8 @@ module Processing
|
|
24
25
|
# @return [TextBounds] bounding box for text
|
25
26
|
#
|
26
27
|
def textBounds(str, x = 0, y = 0, fontSize = nil)
|
27
|
-
|
28
|
-
TextBounds.new x, y, x +
|
28
|
+
font = getInternal__ fontSize
|
29
|
+
TextBounds.new x, y, x + font.width(str), y + font.height
|
29
30
|
end
|
30
31
|
|
31
32
|
# Returns a string containing a human-readable representation of object.
|
@@ -36,6 +37,32 @@ module Processing
|
|
36
37
|
"#<Processing::Font: name:'#{@font.name}' size:#{@font.size}>"
|
37
38
|
end
|
38
39
|
|
40
|
+
# Returns available font names
|
41
|
+
#
|
42
|
+
# @return [String] font names
|
43
|
+
#
|
44
|
+
# @see https://processing.org/reference/PFont_list_.html
|
45
|
+
#
|
46
|
+
def self.list()
|
47
|
+
Rays::Font.families.values.flatten
|
48
|
+
end
|
49
|
+
|
50
|
+
# @private
|
51
|
+
def getInternal__(size = nil)
|
52
|
+
if size
|
53
|
+
@cachedSizes[size.to_f] ||= @font.dup.tap {|font| font.size = size}
|
54
|
+
else
|
55
|
+
@font
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# @private
|
60
|
+
def setSize__(size)
|
61
|
+
return if size == @font.size
|
62
|
+
@cachedSizes[@font.size] = @font
|
63
|
+
@font = getInternal__ size
|
64
|
+
end
|
65
|
+
|
39
66
|
end# Font
|
40
67
|
|
41
68
|
|
data/lib/processing/graphics.rb
CHANGED
@@ -38,17 +38,6 @@ module Processing
|
|
38
38
|
endDraw__
|
39
39
|
end
|
40
40
|
|
41
|
-
# Saves image to file.
|
42
|
-
#
|
43
|
-
# @param filename [String] file name to save image
|
44
|
-
#
|
45
|
-
# @return [nil] nil
|
46
|
-
#
|
47
|
-
def save(filename)
|
48
|
-
@image__.save filename
|
49
|
-
nil
|
50
|
-
end
|
51
|
-
|
52
41
|
end# Graphics
|
53
42
|
|
54
43
|
|