rays 0.1.14 → 0.1.15
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/.doc/ext/rays/color_space.cpp +22 -14
- data/.doc/ext/rays/painter.cpp +93 -0
- data/.doc/ext/rays/polygon.cpp +30 -4
- data/.doc/ext/rays/polyline.cpp +9 -3
- data/.doc/ext/rays/rays.cpp +105 -1
- data/Rakefile +3 -0
- data/VERSION +1 -1
- data/ext/rays/color_space.cpp +22 -14
- data/ext/rays/painter.cpp +104 -3
- data/ext/rays/polygon.cpp +31 -3
- data/ext/rays/polyline.cpp +8 -2
- data/ext/rays/rays.cpp +105 -1
- data/include/rays/color_space.h +4 -2
- data/include/rays/defs.h +33 -0
- data/include/rays/image.h +1 -1
- data/include/rays/painter.h +38 -0
- data/include/rays/polygon.h +35 -1
- data/include/rays/polyline.h +7 -1
- data/include/rays/ruby/rays.h +8 -0
- data/lib/rays/image.rb +1 -1
- data/lib/rays/painter.rb +23 -1
- data/lib/rays/polygon.rb +8 -0
- data/src/color_space.cpp +2 -2
- data/src/ios/bitmap.mm +4 -4
- data/src/ios/font.mm +2 -2
- data/src/osx/bitmap.mm +4 -4
- data/src/osx/font.mm +2 -2
- data/src/painter.cpp +100 -10
- data/src/polygon.cpp +199 -37
- data/src/polyline.cpp +4 -2
- data/src/polyline.h +3 -1
- data/test/test_painter_shape.rb +48 -3
- metadata +2 -2
data/src/polyline.cpp
CHANGED
@@ -89,9 +89,11 @@ namespace Rays
|
|
89
89
|
}
|
90
90
|
|
91
91
|
bool
|
92
|
-
Polyline::expand (
|
92
|
+
Polyline::expand (
|
93
|
+
Polygon* result,
|
94
|
+
coord width, CapType cap, JoinType join, coord miter_limit) const
|
93
95
|
{
|
94
|
-
return Polyline_expand(result, *this, width);
|
96
|
+
return Polyline_expand(result, *this, width, cap, join, miter_limit);
|
95
97
|
}
|
96
98
|
|
97
99
|
Bounds
|
data/src/polyline.h
CHANGED
@@ -58,7 +58,9 @@ namespace Rays
|
|
58
58
|
ClipperLib::Path* path, const Polyline& polyline,
|
59
59
|
bool reverse = false);
|
60
60
|
|
61
|
-
bool Polyline_expand (
|
61
|
+
bool Polyline_expand (
|
62
|
+
Polygon* result, const Polyline& polyline,
|
63
|
+
coord width, CapType cap, JoinType join, coord miter_limit);
|
62
64
|
|
63
65
|
|
64
66
|
}// Rays
|
data/test/test_painter_shape.rb
CHANGED
@@ -11,7 +11,7 @@ class TestPainterShape < Test::Unit::TestCase
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def image (fill = 1, stroke = 0, pixel_density = 1, &block)
|
14
|
-
Rays::Image.new(100, 100, Rays::
|
14
|
+
Rays::Image.new(100, 100, Rays::RGBA, pixel_density).paint {|p|
|
15
15
|
p.fill fill > 0 ? color(fill) : nil
|
16
16
|
p.stroke stroke > 0 ? color(stroke) : nil
|
17
17
|
p.instance_eval &block if block
|
@@ -22,11 +22,56 @@ class TestPainterShape < Test::Unit::TestCase
|
|
22
22
|
img = image(0, 1) {line 1, 1, 98, 98}
|
23
23
|
assert_equal 0, img[ 0, 0].a
|
24
24
|
assert_equal 1, img[ 1, 1].a
|
25
|
-
assert_equal 1, img[97, 97].a
|
26
|
-
#assert_equal 1, img[98, 98].a
|
25
|
+
assert_equal 1, img[97, 97].a #img[98, 98].a
|
27
26
|
assert_equal 0, img[99, 99].a
|
28
27
|
end
|
29
28
|
|
29
|
+
def test_curve ()
|
30
|
+
=begin
|
31
|
+
img = image(0, 1) {curve 1, 1, 98, 1, 98, 98, 1, 98}
|
32
|
+
assert_equal 0, img[ 0, 0].a
|
33
|
+
assert_equal 1, img[ 1, 1].a
|
34
|
+
assert_equal 0, img[98, 1].a
|
35
|
+
assert_equal 0, img[98, 50].a
|
36
|
+
assert_equal 0, img[98, 98].a
|
37
|
+
assert_equal 1, img[ 1, 97].a #img[ 1, 98].a
|
38
|
+
assert_equal 0, img[99, 99].a
|
39
|
+
=end
|
40
|
+
assert_raise(ArgumentError) {image {curve}}
|
41
|
+
assert_raise(ArgumentError) {image {curve 0}}
|
42
|
+
assert_raise(ArgumentError) {image {curve 0, 1}}
|
43
|
+
assert_raise(ArgumentError) {image {curve 0, 1, 2}}
|
44
|
+
assert_raise(ArgumentError) {image {curve 0, 1, 2, 3}}
|
45
|
+
assert_raise(ArgumentError) {image {curve 0, 1, 2, 3, 4}}
|
46
|
+
assert_raise(ArgumentError) {image {curve 0, 1, 2, 3, 4, 5}}
|
47
|
+
assert_raise(ArgumentError) {image {curve 0, 1, 2, 3, 4, 5, 6}}
|
48
|
+
assert_nothing_raised {image {curve 0, 1, 2, 3, 4, 5, 6, 7}}
|
49
|
+
assert_raise(ArgumentError) {image {curve 0, 1, 2, 3, 4, 5, 6, 7, 8}}
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_bezier ()
|
53
|
+
=begin
|
54
|
+
img = image(0, 1) {bezier 1, 1, 98, 1, 98, 98, 1, 98}
|
55
|
+
assert_equal 0, img[ 0, 0].a
|
56
|
+
assert_equal 1, img[ 1, 1].a
|
57
|
+
assert_equal 0, img[98, 1].a
|
58
|
+
assert_equal 0, img[98, 50].a
|
59
|
+
assert_equal 0, img[98, 98].a
|
60
|
+
assert_equal 1, img[ 1, 97].a #img[ 1, 98].a
|
61
|
+
assert_equal 0, img[99, 99].a
|
62
|
+
=end
|
63
|
+
assert_raise(ArgumentError) {image {bezier}}
|
64
|
+
assert_raise(ArgumentError) {image {bezier 0}}
|
65
|
+
assert_raise(ArgumentError) {image {bezier 0, 1}}
|
66
|
+
assert_raise(ArgumentError) {image {bezier 0, 1, 2}}
|
67
|
+
assert_raise(ArgumentError) {image {bezier 0, 1, 2, 3}}
|
68
|
+
assert_raise(ArgumentError) {image {bezier 0, 1, 2, 3, 4}}
|
69
|
+
assert_raise(ArgumentError) {image {bezier 0, 1, 2, 3, 4, 5}}
|
70
|
+
assert_raise(ArgumentError) {image {bezier 0, 1, 2, 3, 4, 5, 6}}
|
71
|
+
assert_nothing_raised {image {bezier 0, 1, 2, 3, 4, 5, 6, 7}}
|
72
|
+
assert_raise(ArgumentError) {image {bezier 0, 1, 2, 3, 4, 5, 6, 7, 8}}
|
73
|
+
end
|
74
|
+
|
30
75
|
def test_rect ()
|
31
76
|
img = image {rect 1, 1, 98, 98}
|
32
77
|
assert_equal 0, img[ 0, 0].a
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xordog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xot
|