rays 0.1.46 → 0.1.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.doc/ext/rays/bitmap.cpp +258 -0
- data/.doc/ext/rays/defs.cpp +3 -3
- data/.doc/ext/rays/painter.cpp +38 -3
- data/.doc/ext/rays/polygon.cpp +81 -4
- data/.doc/ext/rays/rays.cpp +11 -11
- data/.github/workflows/test.yml +0 -1
- data/ChangeLog.md +15 -0
- data/Rakefile +4 -4
- data/VERSION +1 -1
- data/ext/rays/bitmap.cpp +259 -0
- data/ext/rays/defs.cpp +3 -3
- data/ext/rays/painter.cpp +45 -8
- data/ext/rays/polygon.cpp +89 -4
- data/ext/rays/rays.cpp +11 -11
- data/include/rays/defs.h +26 -0
- data/include/rays/matrix.h +2 -0
- data/include/rays/painter.h +15 -1
- data/include/rays/polygon.h +6 -1
- data/include/rays/polyline.h +4 -0
- data/lib/rays/painter.rb +1 -1
- data/lib/rays/polygon.rb +36 -7
- data/rays.gemspec +2 -2
- data/src/color_space.cpp +2 -2
- data/src/matrix.cpp +8 -0
- data/src/painter.cpp +72 -5
- data/src/polygon.cpp +385 -91
- data/src/polyline.cpp +33 -18
- data/src/polyline.h +2 -2
- data/test/test_bitmap.rb +7 -0
- data/test/test_polygon.rb +2 -2
- data/test/test_polygon_line.rb +5 -5
- data/test/test_polyline.rb +7 -7
- metadata +6 -6
data/src/polyline.h
CHANGED
@@ -52,11 +52,11 @@ namespace Rays
|
|
52
52
|
|
53
53
|
void Polyline_create (
|
54
54
|
Polyline* polyline, const ClipperLib::Path& path, bool loop,
|
55
|
-
bool
|
55
|
+
bool hole = false);
|
56
56
|
|
57
57
|
void Polyline_get_path (
|
58
58
|
ClipperLib::Path* path, const Polyline& polyline,
|
59
|
-
bool
|
59
|
+
bool hole = false);
|
60
60
|
|
61
61
|
bool Polyline_expand (
|
62
62
|
Polygon* result, const Polyline& polyline,
|
data/test/test_bitmap.rb
CHANGED
@@ -31,6 +31,13 @@ class TestBitmap < Test::Unit::TestCase
|
|
31
31
|
assert_equal color(1, 0, 0, 0), o[0, 0]
|
32
32
|
end
|
33
33
|
|
34
|
+
def test_pixels()
|
35
|
+
colors = %w[#f00 #0f0 #00f #ff0].map {|s| color s}
|
36
|
+
bmp = bitmap 2, 2
|
37
|
+
bmp[0, 0], bmp[1, 0], bmp[0, 1], bmp[1, 1] = colors
|
38
|
+
assert_equal [0xffff0000, 0xff00ff00, 0xff0000ff, 0xffffff00], bmp.pixels
|
39
|
+
end
|
40
|
+
|
34
41
|
def test_at()
|
35
42
|
o = bitmap
|
36
43
|
assert_equal color(0, 0, 0, 0), o[0, 0]
|
data/test/test_polygon.rb
CHANGED
@@ -48,11 +48,11 @@ class TestPolygon < Test::Unit::TestCase
|
|
48
48
|
assert_nothing_raised {polygon( loop: false)}
|
49
49
|
assert_raise(ArgumentError) {polygon(1, loop: true)}
|
50
50
|
assert_raise(ArgumentError) {polygon(1, loop: false)}
|
51
|
-
|
51
|
+
assert_nothing_raised {polygon(1, 2, loop: true)}
|
52
52
|
assert_nothing_raised {polygon(1, 2, loop: false)}
|
53
53
|
assert_raise(ArgumentError) {polygon(1, 2, 3, loop: true)}
|
54
54
|
assert_raise(ArgumentError) {polygon(1, 2, 3, loop: false)}
|
55
|
-
|
55
|
+
assert_nothing_raised {polygon(1, 2, 3, 4, loop: true)}
|
56
56
|
assert_nothing_raised {polygon(1, 2, 3, 4, loop: false)}
|
57
57
|
assert_raise(ArgumentError) {polygon(1, 2, 3, 4, 5, loop: true)}
|
58
58
|
assert_raise(ArgumentError) {polygon(1, 2, 3, 4, 5, loop: false)}
|
data/test/test_polygon_line.rb
CHANGED
@@ -41,7 +41,7 @@ class TestPolygonLine < Test::Unit::TestCase
|
|
41
41
|
assert_raise(ArgumentError) {line(1, 2, 3, 4, 5, 6, loop: false, hole: true ).loop_hole}
|
42
42
|
assert_equal [false, false], line(1, 2, 3, 4, 5, 6, loop: false, hole: false).loop_hole
|
43
43
|
|
44
|
-
|
44
|
+
assert_nothing_raised {line( loop: true, hole: true )}
|
45
45
|
assert_nothing_raised {line( loop: true, hole: false)}
|
46
46
|
assert_raise(ArgumentError) {line( loop: false, hole: true )}
|
47
47
|
assert_nothing_raised {line( loop: false, hole: false)}
|
@@ -49,16 +49,16 @@ class TestPolygonLine < Test::Unit::TestCase
|
|
49
49
|
assert_raise(ArgumentError) {line(1, loop: true, hole: false)}
|
50
50
|
assert_raise(ArgumentError) {line(1, loop: false, hole: true )}
|
51
51
|
assert_raise(ArgumentError) {line(1, loop: false, hole: false)}
|
52
|
-
|
53
|
-
|
52
|
+
assert_nothing_raised {line(1, 2, loop: true, hole: true )}
|
53
|
+
assert_nothing_raised {line(1, 2, loop: true, hole: false)}
|
54
54
|
assert_raise(ArgumentError) {line(1, 2, loop: false, hole: true )}
|
55
55
|
assert_nothing_raised {line(1, 2, loop: false, hole: false)}
|
56
56
|
assert_raise(ArgumentError) {line(1, 2, 3, loop: true, hole: true )}
|
57
57
|
assert_raise(ArgumentError) {line(1, 2, 3, loop: true, hole: false)}
|
58
58
|
assert_raise(ArgumentError) {line(1, 2, 3, loop: false, hole: true )}
|
59
59
|
assert_raise(ArgumentError) {line(1, 2, 3, loop: false, hole: false)}
|
60
|
-
|
61
|
-
|
60
|
+
assert_nothing_raised {line(1, 2, 3, 4, loop: true, hole: true )}
|
61
|
+
assert_nothing_raised {line(1, 2, 3, 4, loop: true, hole: false)}
|
62
62
|
assert_raise(ArgumentError) {line(1, 2, 3, 4, loop: false, hole: true )}
|
63
63
|
assert_nothing_raised {line(1, 2, 3, 4, loop: false, hole: false)}
|
64
64
|
assert_raise(ArgumentError) {line(1, 2, 3, 4, 5, loop: true, hole: true )}
|
data/test/test_polyline.rb
CHANGED
@@ -27,21 +27,21 @@ class TestPolyline < Test::Unit::TestCase
|
|
27
27
|
assert_equal [[1, 1], [2, 2]], polyline( [1], [2]).dump
|
28
28
|
assert_equal [[1, 1], [2, 2]], polyline(point(1), point(2)).dump
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
assert_false polyline(1, 2, 3, 4, 5, 6 ).loop?
|
31
|
+
assert_true polyline(1, 2, 3, 4, 5, 6, loop: true ).loop?
|
32
|
+
assert_false polyline(1, 2, 3, 4, 5, 6, loop: false).loop?
|
33
|
+
assert_true polyline( loop: true ).loop?
|
34
|
+
assert_false polyline( loop: false).loop?
|
35
35
|
|
36
36
|
assert_nothing_raised {polyline( loop: true)}
|
37
37
|
assert_nothing_raised {polyline( loop: false)}
|
38
38
|
assert_raise(ArgumentError) {polyline(1, loop: true)}
|
39
39
|
assert_raise(ArgumentError) {polyline(1, loop: false)}
|
40
|
-
|
40
|
+
assert_nothing_raised {polyline(1, 2, loop: true)}
|
41
41
|
assert_nothing_raised {polyline(1, 2, loop: false)}
|
42
42
|
assert_raise(ArgumentError) {polyline(1, 2, 3, loop: true)}
|
43
43
|
assert_raise(ArgumentError) {polyline(1, 2, 3, loop: false)}
|
44
|
-
|
44
|
+
assert_nothing_raised {polyline(1, 2, 3, 4, loop: true)}
|
45
45
|
assert_nothing_raised {polyline(1, 2, 3, 4, loop: false)}
|
46
46
|
assert_raise(ArgumentError) {polyline(1, 2, 3, 4, 5, loop: true)}
|
47
47
|
assert_raise(ArgumentError) {polyline(1, 2, 3, 4, 5, loop: false)}
|
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.47
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xordog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xot
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.41
|
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.41
|
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.42
|
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.42
|
41
41
|
description: This library helps you to develop graphics application with OpenGL.
|
42
42
|
email: xordog@gmail.com
|
43
43
|
executables: []
|