rays 0.1.39 → 0.1.42

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f822523cc0b4b94ce7f76cfe73eecf06cec674230605d74999d03b4c47cafebc
4
- data.tar.gz: ce2f362baca442ada14c7e3b770e0194063334531733773329d4a5023d30e712
3
+ metadata.gz: 71f51f47f1fba7c8987c1d898e6c34ae5a1702eb39b477a316bcf0d0545d301d
4
+ data.tar.gz: 93ab3dbb64858f23d726a04da0541c2ef64b889944e20085762537b61f5be8c4
5
5
  SHA512:
6
- metadata.gz: '06429b08ad69b515da932a8a3d29055f19ee650c2d3c9b67b524c40fd2ecc40371edd1c5b4447b871835fc78fbae0ecc72a6354dd380c98edc38979792537e4a'
7
- data.tar.gz: df507d34e172092d10d6c4d50f43b9207e209ca45f521c99a74cc6330e556195b05f7deb35831ef978f09a67d953dc884a52203bc1c35b06918c9811f356d0ef
6
+ metadata.gz: afdc769d1ca50f3ce3f8918bd2643e03458d58b5893dc906cdc51c448a48787904c70ec21b3094ff04406a7a36aff8b8ed25e63e68eed8d9aa76215fda477adc
7
+ data.tar.gz: a4060191a2b4f3abec170d820b0ab9bed202ad0411e3a4051c02c2cdaa537404ef33c61d47e89db387799b713dc78bd353a651f31b5b9b90bcb5d4c4ce255b2b
@@ -67,17 +67,17 @@ VALUE color_space(VALUE self)
67
67
  }
68
68
 
69
69
  static
70
- VALUE set_at(VALUE self)
70
+ VALUE set_at(VALUE self, VALUE x, VALUE y, VALUE color)
71
71
  {
72
72
  CHECK;
73
- check_arg_count(__FILE__, __LINE__, "Bitmap#set_at", argc, 3, 4, 5, 6);
74
73
 
75
- int x = to<int>(argv[0]);
76
- int y = to<int>(argv[1]);
77
- Rays::Color color = to<Rays::Color>(argc - 2, argv + 2);
74
+ bool is_array = color.is_array();
75
+ size_t argc = is_array ? color.size() : 1;
76
+ const Value* argv = is_array ? color.as_array() : &color;
77
+ to<Rays::Color>(argc, argv)
78
+ .get(THIS->at<void>(to<int>(x), to<int>(y)), THIS->color_space());
78
79
 
79
- color.get(THIS->at<void>(x, y), THIS->color_space());
80
- return value(color);
80
+ return color;
81
81
  }
82
82
 
83
83
  static
data/ChangeLog.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # rays ChangeLog
2
2
 
3
3
 
4
+ ## [v0.1.42] - 2023-06-11
5
+
6
+ - Point#normal() checks 'length == 0' again
7
+
8
+
9
+ ## [v0.1.41] - 2023-06-08
10
+
11
+ - Point#normal() does not check 'length == 0'
12
+
13
+
14
+ ## [v0.1.40] - 2023-06-07
15
+
16
+ - Redesign parameters for Bitmap#[]=
17
+
18
+
4
19
  ## [v0.1.39] - 2023-05-29
5
20
 
6
21
  - Add Painter#painting?
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.39
1
+ 0.1.42
data/ext/rays/bitmap.cpp CHANGED
@@ -73,17 +73,17 @@ RUCY_DEF0(color_space)
73
73
  RUCY_END
74
74
 
75
75
  static
76
- RUCY_DEFN(set_at)
76
+ RUCY_DEF3(set_at, x, y, color)
77
77
  {
78
78
  CHECK;
79
- check_arg_count(__FILE__, __LINE__, "Bitmap#set_at", argc, 3, 4, 5, 6);
80
79
 
81
- int x = to<int>(argv[0]);
82
- int y = to<int>(argv[1]);
83
- Rays::Color color = to<Rays::Color>(argc - 2, argv + 2);
80
+ bool is_array = color.is_array();
81
+ size_t argc = is_array ? color.size() : 1;
82
+ const Value* argv = is_array ? color.as_array() : &color;
83
+ to<Rays::Color>(argc, argv)
84
+ .get(THIS->at<void>(to<int>(x), to<int>(y)), THIS->color_space());
84
85
 
85
- color.get(THIS->at<void>(x, y), THIS->color_space());
86
- return value(color);
86
+ return color;
87
87
  }
88
88
  RUCY_END
89
89
 
data/rays.gemspec CHANGED
@@ -25,8 +25,8 @@ Gem::Specification.new do |s|
25
25
  s.platform = Gem::Platform::RUBY
26
26
  s.required_ruby_version = '>= 3.0.0'
27
27
 
28
- s.add_runtime_dependency 'xot', '~> 0.1.38'
29
- s.add_runtime_dependency 'rucy', '~> 0.1.38'
28
+ s.add_runtime_dependency 'xot', '~> 0.1.39'
29
+ s.add_runtime_dependency 'rucy', '~> 0.1.39'
30
30
 
31
31
  s.add_development_dependency 'rake'
32
32
  s.add_development_dependency 'test-unit'
data/test/test_bitmap.rb CHANGED
@@ -34,8 +34,21 @@ class TestBitmap < Test::Unit::TestCase
34
34
  def test_at()
35
35
  o = bitmap
36
36
  assert_equal color(0, 0, 0, 0), o[0, 0]
37
- o[0, 0] = 1
37
+
38
+ o[0, 0] = 1
38
39
  assert_equal color(1, 1, 1, 1), o[0, 0]
40
+
41
+ o[0, 0] = [0, 1, 0]
42
+ assert_equal color(0, 1, 0, 1), o[0, 0]
43
+
44
+ o[0, 0] = [0, 1, 0, 0]
45
+ assert_equal color(0, 1, 0, 0), o[0, 0]
46
+
47
+ o[0, 0] = color(0, 0, 1)
48
+ assert_equal color(0, 0, 1, 1), o[0, 0]
49
+
50
+ o[0, 0] = color(0, 0, 1, 0)
51
+ assert_equal color(0, 0, 1, 0), o[0, 0]
39
52
  end
40
53
 
41
54
  def test_to_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.39
4
+ version: 0.1.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-29 00:00:00.000000000 Z
11
+ date: 2023-06-11 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.38
19
+ version: 0.1.39
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.38
26
+ version: 0.1.39
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.38
33
+ version: 0.1.39
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.38
40
+ version: 0.1.39
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement