rays 0.3.16 → 0.4.0
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/bitmap.cpp +1 -1
- data/.doc/ext/rays/bounds.cpp +1 -4
- data/.doc/ext/rays/camera.cpp +10 -2
- data/.doc/ext/rays/color.cpp +1 -3
- data/.doc/ext/rays/color_space.cpp +3 -3
- data/.doc/ext/rays/font.cpp +1 -4
- data/.doc/ext/rays/image.cpp +4 -3
- data/.doc/ext/rays/matrix.cpp +1 -4
- data/.doc/ext/rays/painter.cpp +8 -0
- data/.doc/ext/rays/point.cpp +1 -4
- data/.doc/ext/rays/polygon.cpp +11 -3
- data/.doc/ext/rays/polyline.cpp +13 -8
- data/.doc/ext/rays/rays.cpp +10 -6
- data/.doc/ext/rays/shader.cpp +13 -5
- data/.github/workflows/release-gem.yml +10 -1
- data/.github/workflows/test.yml +9 -0
- data/ChangeLog.md +10 -0
- data/VERSION +1 -1
- data/ext/rays/bitmap.cpp +1 -1
- data/ext/rays/bounds.cpp +1 -4
- data/ext/rays/camera.cpp +11 -2
- data/ext/rays/color.cpp +1 -3
- data/ext/rays/color_space.cpp +3 -3
- data/ext/rays/font.cpp +1 -4
- data/ext/rays/image.cpp +4 -3
- data/ext/rays/matrix.cpp +1 -4
- data/ext/rays/painter.cpp +9 -0
- data/ext/rays/point.cpp +1 -4
- data/ext/rays/polygon.cpp +12 -3
- data/ext/rays/polyline.cpp +14 -8
- data/ext/rays/rays.cpp +10 -6
- data/ext/rays/shader.cpp +14 -5
- data/include/rays/bitmap.h +1 -1
- data/include/rays/color_space.h +6 -2
- data/include/rays/defs.h +14 -4
- data/include/rays/image.h +2 -2
- data/lib/rays/camera.rb +1 -1
- data/lib/rays/extension.rb +1 -1
- data/lib/rays/image.rb +2 -2
- data/lib/rays/polygon.rb +1 -1
- data/lib/rays/polyline.rb +1 -1
- data/lib/rays/shader.rb +1 -1
- data/rays.gemspec +2 -2
- data/src/color_space.cpp +5 -5
- data/src/image.cpp +2 -2
- data/src/ios/bitmap.mm +3 -3
- data/src/ios/font.mm +3 -3
- data/src/opengl/bitmap.cpp +1 -1
- data/src/opengl/color_space.cpp +11 -2
- data/src/opengl/color_space.h +1 -1
- data/src/opengl/texture.cpp +5 -5
- data/src/osx/bitmap.mm +14 -3
- data/src/osx/font.mm +3 -3
- data/src/sdl/bitmap.cpp +28 -9
- data/src/texture.h +1 -1
- data/src/win32/bitmap.cpp +73 -35
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c4a61df95620a3670bc3c6ac06801ce4cb657bb6b2712766a369837289cc941
|
|
4
|
+
data.tar.gz: 9694b17c790a7c096053d69801e1d3f86efc90e7549be748392f2f420e38136a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a104aec9bf0808baad2503c28a8295f7be0b654f1fa1f7718b2a18c4c8d9fdfeb3220a5217f068fdd6e1eace5d2eaa10caf14801796147614d29252f43e03f1d
|
|
7
|
+
data.tar.gz: a83d43fdd44fbefeee5e60380e2f6541e6806521a4a93c896df29b7cbfeb128fda5738ade84b1bc7d79b7f14de5fe21ce781336b51ef9836053a72aea6381626
|
data/.doc/ext/rays/bitmap.cpp
CHANGED
data/.doc/ext/rays/bounds.cpp
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#include "rays/ruby/bounds.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
#include <assert.h>
|
|
5
4
|
#include "rays/ruby/point.h"
|
|
6
5
|
#include "defs.h"
|
|
7
6
|
|
|
@@ -589,14 +588,12 @@ namespace Rucy
|
|
|
589
588
|
template <> RAYS_EXPORT Rays::Bounds
|
|
590
589
|
value_to<Rays::Bounds> (int argc, const Value* argv, bool convert)
|
|
591
590
|
{
|
|
592
|
-
if (argc == 1 && argv->is_array())
|
|
591
|
+
if (argc == 1 && argv && argv->is_array())
|
|
593
592
|
{
|
|
594
593
|
argc = argv->size();
|
|
595
594
|
argv = argv->as_array();
|
|
596
595
|
}
|
|
597
596
|
|
|
598
|
-
assert(argc == 0 || (argc > 0 && argv));
|
|
599
|
-
|
|
600
597
|
if (convert)
|
|
601
598
|
{
|
|
602
599
|
if (argc == 0)
|
data/.doc/ext/rays/camera.cpp
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#include "rays/ruby/camera.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
#include "rays/exception.h"
|
|
4
5
|
#include "rays/ruby/image.h"
|
|
5
6
|
#include "defs.h"
|
|
6
7
|
|
|
@@ -19,7 +20,7 @@ VALUE alloc(VALUE klass)
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
static
|
|
22
|
-
VALUE
|
|
23
|
+
VALUE initialize(VALUE self, VALUE device_name, VALUE min_width, VALUE min_height, VALUE resize, VALUE crop)
|
|
23
24
|
{
|
|
24
25
|
RUCY_CHECK_OBJ(Rays::Camera, self);
|
|
25
26
|
|
|
@@ -30,6 +31,12 @@ VALUE setup(VALUE self, VALUE device_name, VALUE min_width, VALUE min_height, VA
|
|
|
30
31
|
return self;
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
static
|
|
35
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
|
36
|
+
{
|
|
37
|
+
Rays::rays_error(__FILE__, __LINE__, "can not duplicate Camera");
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
static
|
|
34
41
|
VALUE start(VALUE self)
|
|
35
42
|
{
|
|
@@ -140,7 +147,8 @@ Init_rays_camera ()
|
|
|
140
147
|
|
|
141
148
|
cCamera = rb_define_class_under(mRays, "Camera", rb_cObject);
|
|
142
149
|
rb_define_alloc_func(cCamera, alloc);
|
|
143
|
-
|
|
150
|
+
cCamera.define_private_method("initialize!", initialize);
|
|
151
|
+
rb_define_private_method(cCamera, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
|
144
152
|
rb_define_method(cCamera, "start", RUBY_METHOD_FUNC(start), 0);
|
|
145
153
|
rb_define_method(cCamera, "stop", RUBY_METHOD_FUNC(stop), 0);
|
|
146
154
|
cCamera.define_method("active?", is_active);
|
data/.doc/ext/rays/color.cpp
CHANGED
|
@@ -352,14 +352,12 @@ namespace Rucy
|
|
|
352
352
|
template <> RAYS_EXPORT Rays::Color
|
|
353
353
|
value_to<Rays::Color> (int argc, const Value*argv, bool convert)
|
|
354
354
|
{
|
|
355
|
-
if (argc == 1 && argv->is_array())
|
|
355
|
+
if (argc == 1 && argv && argv->is_array())
|
|
356
356
|
{
|
|
357
357
|
argc = argv->size();
|
|
358
358
|
argv = argv->as_array();
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
assert(argc == 0 || (argc > 0 && argv));
|
|
362
|
-
|
|
363
361
|
if (convert)
|
|
364
362
|
{
|
|
365
363
|
if (argc == 0)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#include "rays/ruby/color_space.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
#include <assert.h>
|
|
5
4
|
#include "defs.h"
|
|
6
5
|
|
|
7
6
|
|
|
@@ -209,13 +208,14 @@ namespace Rucy
|
|
|
209
208
|
template <> RAYS_EXPORT Rays::ColorSpace
|
|
210
209
|
value_to<Rays::ColorSpace> (int argc, const Value* argv, bool convert)
|
|
211
210
|
{
|
|
212
|
-
if (argc == 1 && argv->is_array())
|
|
211
|
+
if (argc == 1 && argv && argv->is_array())
|
|
213
212
|
{
|
|
214
213
|
argc = argv->size();
|
|
215
214
|
argv = argv->as_array();
|
|
216
215
|
}
|
|
217
216
|
|
|
218
|
-
|
|
217
|
+
if (argc <= 0 || !argv)
|
|
218
|
+
argument_error(__FILE__, __LINE__);
|
|
219
219
|
|
|
220
220
|
if (convert)
|
|
221
221
|
{
|
data/.doc/ext/rays/font.cpp
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#include "rays/ruby/font.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
#include <assert.h>
|
|
5
4
|
#include "defs.h"
|
|
6
5
|
|
|
7
6
|
|
|
@@ -176,14 +175,12 @@ namespace Rucy
|
|
|
176
175
|
template <> RAYS_EXPORT Rays::Font
|
|
177
176
|
value_to<Rays::Font> (int argc, const Value* argv, bool convert)
|
|
178
177
|
{
|
|
179
|
-
if (argc == 1 && argv->is_array())
|
|
178
|
+
if (argc == 1 && argv && argv->is_array())
|
|
180
179
|
{
|
|
181
180
|
argc = argv->size();
|
|
182
181
|
argv = argv->as_array();
|
|
183
182
|
}
|
|
184
183
|
|
|
185
|
-
assert(argc == 0 || (argc > 0 && argv));
|
|
186
|
-
|
|
187
184
|
if (convert)
|
|
188
185
|
{
|
|
189
186
|
if (argc == 0)
|
data/.doc/ext/rays/image.cpp
CHANGED
|
@@ -41,7 +41,7 @@ VALUE initialize(VALUE self, VALUE args, VALUE pixel_density, VALUE smooth)
|
|
|
41
41
|
{
|
|
42
42
|
int width = to<int>(args[0]);
|
|
43
43
|
int height = to<int>(args[1]);
|
|
44
|
-
auto cs = (argc >= 3) ? to<Rays::ColorSpace>(args[2]) : Rays::
|
|
44
|
+
auto cs = (argc >= 3) ? to<Rays::ColorSpace>(args[2]) : Rays::DEFAULT_COLORSPACE;
|
|
45
45
|
*THIS = Rays::Image(width, height, cs, pd, smooth);
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -132,9 +132,10 @@ VALUE compare(VALUE self, VALUE other)
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
static
|
|
135
|
-
VALUE load(VALUE self, VALUE path)
|
|
135
|
+
VALUE load(VALUE self, VALUE path, VALUE pixel_density, VALUE smooth)
|
|
136
136
|
{
|
|
137
|
-
return value(Rays::load_image(
|
|
137
|
+
return value(Rays::load_image(
|
|
138
|
+
path.c_str(), to<float>(pixel_density), to<bool>(smooth)));
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
|
data/.doc/ext/rays/matrix.cpp
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#include "rays/ruby/matrix.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
#include <assert.h>
|
|
5
4
|
#include "rays/ruby/point.h"
|
|
6
5
|
#include "defs.h"
|
|
7
6
|
|
|
@@ -284,14 +283,12 @@ namespace Rucy
|
|
|
284
283
|
template <> RAYS_EXPORT Rays::Matrix
|
|
285
284
|
value_to<Rays::Matrix> (int argc, const Value* argv, bool convert)
|
|
286
285
|
{
|
|
287
|
-
if (argc == 1 && argv->is_array())
|
|
286
|
+
if (argc == 1 && argv && argv->is_array())
|
|
288
287
|
{
|
|
289
288
|
argc = argv->size();
|
|
290
289
|
argv = argv->as_array();
|
|
291
290
|
}
|
|
292
291
|
|
|
293
|
-
assert(argc == 0 || (argc > 0 && argv));
|
|
294
|
-
|
|
295
292
|
if (convert)
|
|
296
293
|
{
|
|
297
294
|
if (argc == 0)
|
data/.doc/ext/rays/painter.cpp
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
#include <vector>
|
|
5
|
+
#include "rays/exception.h"
|
|
5
6
|
#include "rays/ruby/point.h"
|
|
6
7
|
#include "rays/ruby/bounds.h"
|
|
7
8
|
#include "rays/ruby/color.h"
|
|
@@ -25,6 +26,12 @@ VALUE alloc(VALUE klass)
|
|
|
25
26
|
return new_type<Rays::Painter>(klass);
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
static
|
|
30
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
|
31
|
+
{
|
|
32
|
+
Rays::rays_error(__FILE__, __LINE__, "can not duplicate Painter");
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
static
|
|
29
36
|
VALUE canvas(VALUE self)
|
|
30
37
|
{
|
|
@@ -793,6 +800,7 @@ Init_rays_painter ()
|
|
|
793
800
|
|
|
794
801
|
cPainter = rb_define_class_under(mRays, "Painter", rb_cObject);
|
|
795
802
|
rb_define_alloc_func(cPainter, alloc);
|
|
803
|
+
rb_define_private_method(cPainter, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
|
796
804
|
|
|
797
805
|
rb_define_method(cPainter, "canvas", RUBY_METHOD_FUNC(canvas), -1);
|
|
798
806
|
rb_define_method(cPainter, "bounds", RUBY_METHOD_FUNC(bounds), 0);
|
data/.doc/ext/rays/point.cpp
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#include "rays/ruby/point.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
#include <assert.h>
|
|
5
4
|
#include "defs.h"
|
|
6
5
|
|
|
7
6
|
|
|
@@ -282,14 +281,12 @@ namespace Rucy
|
|
|
282
281
|
template <> RAYS_EXPORT Rays::Point
|
|
283
282
|
value_to<Rays::Point> (int argc, const Value* argv, bool convert)
|
|
284
283
|
{
|
|
285
|
-
if (argc == 1 && argv->is_array())
|
|
284
|
+
if (argc == 1 && argv && argv->is_array())
|
|
286
285
|
{
|
|
287
286
|
argc = argv->size();
|
|
288
287
|
argv = argv->as_array();
|
|
289
288
|
}
|
|
290
289
|
|
|
291
|
-
assert(argc == 0 || (argc > 0 && argv));
|
|
292
|
-
|
|
293
290
|
if (convert)
|
|
294
291
|
{
|
|
295
292
|
if (argc == 0)
|
data/.doc/ext/rays/polygon.cpp
CHANGED
|
@@ -22,7 +22,7 @@ VALUE alloc(VALUE klass)
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
static
|
|
25
|
-
VALUE
|
|
25
|
+
VALUE initialize(VALUE self, VALUE args, VALUE loop, VALUE colors, VALUE texcoords)
|
|
26
26
|
{
|
|
27
27
|
CHECK;
|
|
28
28
|
|
|
@@ -37,6 +37,13 @@ VALUE setup(VALUE self, VALUE args, VALUE loop, VALUE colors, VALUE texcoords)
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
static
|
|
41
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
|
42
|
+
{
|
|
43
|
+
CHECK;
|
|
44
|
+
*THIS = to<Rays::Polygon&>(obj);
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
static
|
|
41
48
|
VALUE expand(VALUE self)
|
|
42
49
|
{
|
|
@@ -98,7 +105,7 @@ VALUE each(VALUE self)
|
|
|
98
105
|
|
|
99
106
|
Value ret = Qnil;
|
|
100
107
|
for (const auto& polyline : *THIS)
|
|
101
|
-
ret =
|
|
108
|
+
ret = yield(value(polyline));
|
|
102
109
|
return ret;
|
|
103
110
|
}
|
|
104
111
|
|
|
@@ -346,7 +353,8 @@ Init_rays_polygon ()
|
|
|
346
353
|
|
|
347
354
|
cPolygon = rb_define_class_under(mRays, "Polygon", rb_cObject);
|
|
348
355
|
rb_define_alloc_func(cPolygon, alloc);
|
|
349
|
-
|
|
356
|
+
cPolygon.define_private_method("initialize!", initialize);
|
|
357
|
+
rb_define_private_method(cPolygon, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
|
350
358
|
rb_define_method(cPolygon, "expand", RUBY_METHOD_FUNC(expand), -1);
|
|
351
359
|
rb_define_method(cPolygon, "bounds", RUBY_METHOD_FUNC(bounds), 0);
|
|
352
360
|
rb_define_method(cPolygon, "size", RUBY_METHOD_FUNC(size), 0);
|
data/.doc/ext/rays/polyline.cpp
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#include "rays/ruby/polyline.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
#include <assert.h>
|
|
5
4
|
#include <vector>
|
|
6
5
|
#include "rays/ruby/color.h"
|
|
7
6
|
#include "rays/ruby/point.h"
|
|
@@ -24,7 +23,7 @@ VALUE alloc(VALUE klass)
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
static
|
|
27
|
-
VALUE
|
|
26
|
+
VALUE initialize(VALUE self, VALUE points, VALUE loop, VALUE fill, VALUE colors, VALUE texcoords, VALUE hole)
|
|
28
27
|
{
|
|
29
28
|
CHECK;
|
|
30
29
|
|
|
@@ -35,6 +34,13 @@ VALUE setup(VALUE self, VALUE points, VALUE loop, VALUE fill, VALUE colors, VALU
|
|
|
35
34
|
hole);
|
|
36
35
|
}
|
|
37
36
|
|
|
37
|
+
static
|
|
38
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
|
39
|
+
{
|
|
40
|
+
CHECK;
|
|
41
|
+
*THIS = to<Rays::Polyline&>(obj);
|
|
42
|
+
}
|
|
43
|
+
|
|
38
44
|
static
|
|
39
45
|
VALUE expand(VALUE self)
|
|
40
46
|
{
|
|
@@ -138,7 +144,7 @@ VALUE each_point(VALUE self)
|
|
|
138
144
|
|
|
139
145
|
Value ret = Qnil;
|
|
140
146
|
for (const auto& point : *THIS)
|
|
141
|
-
ret =
|
|
147
|
+
ret = yield(value(point));
|
|
142
148
|
return ret;
|
|
143
149
|
}
|
|
144
150
|
|
|
@@ -154,7 +160,7 @@ VALUE each_color(VALUE self)
|
|
|
154
160
|
{
|
|
155
161
|
size_t size = THIS->size();
|
|
156
162
|
for (size_t i = 0; i < size; ++i)
|
|
157
|
-
ret =
|
|
163
|
+
ret = yield(value(colors[i]));
|
|
158
164
|
}
|
|
159
165
|
return ret;
|
|
160
166
|
}
|
|
@@ -171,7 +177,7 @@ VALUE each_texcoord(VALUE self)
|
|
|
171
177
|
{
|
|
172
178
|
size_t size = THIS->size();
|
|
173
179
|
for (size_t i = 0; i < size; ++i)
|
|
174
|
-
ret =
|
|
180
|
+
ret = yield(value(*(Rays::Point*) &texcoords[i]));
|
|
175
181
|
}
|
|
176
182
|
return ret;
|
|
177
183
|
}
|
|
@@ -186,7 +192,8 @@ Init_rays_polyline ()
|
|
|
186
192
|
|
|
187
193
|
cPolyline = rb_define_class_under(mRays, "Polyline", rb_cObject);
|
|
188
194
|
rb_define_alloc_func(cPolyline, alloc);
|
|
189
|
-
|
|
195
|
+
cPolyline.define_private_method("initialize!", initialize);
|
|
196
|
+
rb_define_private_method(cPolyline, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
|
190
197
|
rb_define_method(cPolyline, "expand", RUBY_METHOD_FUNC(expand), -1);
|
|
191
198
|
rb_define_method(cPolyline, "bounds", RUBY_METHOD_FUNC(bounds), 0);
|
|
192
199
|
cPolyline.define_method("loop?", is_loop);
|
|
@@ -211,8 +218,6 @@ namespace Rucy
|
|
|
211
218
|
template <> RAYS_EXPORT Rays::Polyline
|
|
212
219
|
value_to<Rays::Polyline> (int argc, const Value* argv, bool convert)
|
|
213
220
|
{
|
|
214
|
-
assert(argc == 0 || (argc > 0 && argv));
|
|
215
|
-
|
|
216
221
|
if (convert)
|
|
217
222
|
{
|
|
218
223
|
if (argc <= 0)
|
data/.doc/ext/rays/rays.cpp
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#include "rays/ruby/rays.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
#include <assert.h>
|
|
5
4
|
#include <vector>
|
|
6
5
|
#include "defs.h"
|
|
7
6
|
|
|
@@ -112,7 +111,8 @@ namespace Rucy
|
|
|
112
111
|
template <> RAYS_EXPORT Rays::CapType
|
|
113
112
|
value_to<Rays::CapType> (int argc, const Value* argv, bool convert)
|
|
114
113
|
{
|
|
115
|
-
|
|
114
|
+
if (argc <= 0 || !argv)
|
|
115
|
+
argument_error(__FILE__, __LINE__);
|
|
116
116
|
|
|
117
117
|
if (convert)
|
|
118
118
|
{
|
|
@@ -145,7 +145,8 @@ namespace Rucy
|
|
|
145
145
|
template <> RAYS_EXPORT Rays::JoinType
|
|
146
146
|
value_to<Rays::JoinType> (int argc, const Value* argv, bool convert)
|
|
147
147
|
{
|
|
148
|
-
|
|
148
|
+
if (argc <= 0 || !argv)
|
|
149
|
+
argument_error(__FILE__, __LINE__);
|
|
149
150
|
|
|
150
151
|
if (convert)
|
|
151
152
|
{
|
|
@@ -178,7 +179,8 @@ namespace Rucy
|
|
|
178
179
|
template <> RAYS_EXPORT Rays::BlendMode
|
|
179
180
|
value_to<Rays::BlendMode> (int argc, const Value* argv, bool convert)
|
|
180
181
|
{
|
|
181
|
-
|
|
182
|
+
if (argc <= 0 || !argv)
|
|
183
|
+
argument_error(__FILE__, __LINE__);
|
|
182
184
|
|
|
183
185
|
if (convert)
|
|
184
186
|
{
|
|
@@ -211,7 +213,8 @@ namespace Rucy
|
|
|
211
213
|
template <> RAYS_EXPORT Rays::TexCoordMode
|
|
212
214
|
value_to<Rays::TexCoordMode> (int argc, const Value* argv, bool convert)
|
|
213
215
|
{
|
|
214
|
-
|
|
216
|
+
if (argc <= 0 || !argv)
|
|
217
|
+
argument_error(__FILE__, __LINE__);
|
|
215
218
|
|
|
216
219
|
if (convert)
|
|
217
220
|
{
|
|
@@ -244,7 +247,8 @@ namespace Rucy
|
|
|
244
247
|
template <> RAYS_EXPORT Rays::TexCoordWrap
|
|
245
248
|
value_to<Rays::TexCoordWrap> (int argc, const Value* argv, bool convert)
|
|
246
249
|
{
|
|
247
|
-
|
|
250
|
+
if (argc <= 0 || !argv)
|
|
251
|
+
argument_error(__FILE__, __LINE__);
|
|
248
252
|
|
|
249
253
|
if (convert)
|
|
250
254
|
{
|
data/.doc/ext/rays/shader.cpp
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#include "rays/ruby/shader.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
#include
|
|
4
|
+
#include "rays/exception.h"
|
|
5
5
|
#include "rays/ruby/image.h"
|
|
6
6
|
#include "defs.h"
|
|
7
7
|
|
|
@@ -19,6 +19,12 @@ VALUE alloc(VALUE klass)
|
|
|
19
19
|
return new_type<Rays::Shader>(klass);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
static
|
|
23
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
|
24
|
+
{
|
|
25
|
+
Rays::rays_error(__FILE__, __LINE__, "can not duplicate Shader");
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
static const char*
|
|
23
29
|
to_name (const Value& names, size_t index)
|
|
24
30
|
{
|
|
@@ -81,7 +87,7 @@ make_env (const Value& names, const Value& ignore_no_uniform_location_error)
|
|
|
81
87
|
}
|
|
82
88
|
|
|
83
89
|
static
|
|
84
|
-
VALUE
|
|
90
|
+
VALUE initialize(VALUE self, VALUE
|
|
85
91
|
fragment_shader_source, VALUE vertex_shader_source, VALUE
|
|
86
92
|
builtin_variable_names, VALUE ignore_no_uniform_location_error)
|
|
87
93
|
{
|
|
@@ -180,7 +186,8 @@ Init_rays_shader ()
|
|
|
180
186
|
|
|
181
187
|
cShader = rb_define_class_under(mRays, "Shader", rb_cObject);
|
|
182
188
|
rb_define_alloc_func(cShader, alloc);
|
|
183
|
-
|
|
189
|
+
cShader.define_private_method("initialize!", initialize);
|
|
190
|
+
rb_define_private_method(cShader, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
|
184
191
|
rb_define_private_method(cShader, "set_uniform", RUBY_METHOD_FUNC(set_uniform), -1);
|
|
185
192
|
rb_define_method(cShader, "vertex_shader_source", RUBY_METHOD_FUNC(get_vertex_shader_source), 0);
|
|
186
193
|
rb_define_method(cShader, "fragment_shader_source", RUBY_METHOD_FUNC(get_fragment_shader_source), 0);
|
|
@@ -194,13 +201,14 @@ namespace Rucy
|
|
|
194
201
|
template <> RAYS_EXPORT Rays::Shader
|
|
195
202
|
value_to<Rays::Shader> (int argc, const Value* argv, bool convert)
|
|
196
203
|
{
|
|
197
|
-
if (argc == 1 && argv->is_array())
|
|
204
|
+
if (argc == 1 && argv && argv->is_array())
|
|
198
205
|
{
|
|
199
206
|
argc = argv->size();
|
|
200
207
|
argv = argv->as_array();
|
|
201
208
|
}
|
|
202
209
|
|
|
203
|
-
|
|
210
|
+
if (argc <= 0 || !argv)
|
|
211
|
+
argument_error(__FILE__, __LINE__);
|
|
204
212
|
|
|
205
213
|
if (convert)
|
|
206
214
|
{
|
|
@@ -26,8 +26,17 @@ jobs:
|
|
|
26
26
|
- name: setup dependencies
|
|
27
27
|
run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
|
|
28
28
|
|
|
29
|
+
- name: packages
|
|
30
|
+
run: bundle exec rake packages
|
|
31
|
+
|
|
32
|
+
- name: setup zig
|
|
33
|
+
if: github.event.repository.name == 'reflex-terminal'
|
|
34
|
+
uses: mlugg/setup-zig@v2
|
|
35
|
+
with:
|
|
36
|
+
version: 0.16.0
|
|
37
|
+
|
|
29
38
|
- name: test
|
|
30
|
-
run: bundle exec rake
|
|
39
|
+
run: bundle exec rake test
|
|
31
40
|
|
|
32
41
|
- name: create gem
|
|
33
42
|
id: gem
|
data/.github/workflows/test.yml
CHANGED
|
@@ -27,6 +27,15 @@ jobs:
|
|
|
27
27
|
- name: packages
|
|
28
28
|
run: bundle exec rake verbose packages
|
|
29
29
|
|
|
30
|
+
- name: setup zig
|
|
31
|
+
if: github.event.repository.name == 'reflex-terminal'
|
|
32
|
+
uses: mlugg/setup-zig@v2
|
|
33
|
+
with:
|
|
34
|
+
version: 0.16.0
|
|
35
|
+
|
|
36
|
+
- name: vendor
|
|
37
|
+
run: bundle exec rake vendor
|
|
38
|
+
|
|
30
39
|
- name: lib
|
|
31
40
|
run: bundle exec rake verbose lib
|
|
32
41
|
|
data/ChangeLog.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# rays ChangeLog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## [v0.4.0] - 2026-08-04
|
|
5
|
+
|
|
6
|
+
- [BREAKING] Rename COLORSPACE_UNKNOWN to COLORSPACE_NONE
|
|
7
|
+
- [BREAKING] Default to BGRA color space on Windows
|
|
8
|
+
- Add pixel_density and smooth options to Image.load
|
|
9
|
+
- Support dup on value classes, reject it on stateful ones
|
|
10
|
+
|
|
11
|
+
- Fix crash when an empty array is passed where a Color, Point, Bounds, etc. is expected
|
|
12
|
+
|
|
13
|
+
|
|
4
14
|
## [v0.3.16] - 2026-06-23
|
|
5
15
|
|
|
6
16
|
- Update dependencies
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.4.0
|
data/ext/rays/bitmap.cpp
CHANGED
data/ext/rays/bounds.cpp
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#include "rays/ruby/bounds.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
#include <assert.h>
|
|
5
4
|
#include "rays/ruby/point.h"
|
|
6
5
|
#include "defs.h"
|
|
7
6
|
|
|
@@ -636,14 +635,12 @@ namespace Rucy
|
|
|
636
635
|
template <> RAYS_EXPORT Rays::Bounds
|
|
637
636
|
value_to<Rays::Bounds> (int argc, const Value* argv, bool convert)
|
|
638
637
|
{
|
|
639
|
-
if (argc == 1 && argv->is_array())
|
|
638
|
+
if (argc == 1 && argv && argv->is_array())
|
|
640
639
|
{
|
|
641
640
|
argc = argv->size();
|
|
642
641
|
argv = argv->as_array();
|
|
643
642
|
}
|
|
644
643
|
|
|
645
|
-
assert(argc == 0 || (argc > 0 && argv));
|
|
646
|
-
|
|
647
644
|
if (convert)
|
|
648
645
|
{
|
|
649
646
|
if (argc == 0)
|
data/ext/rays/camera.cpp
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#include "rays/ruby/camera.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
#include "rays/exception.h"
|
|
4
5
|
#include "rays/ruby/image.h"
|
|
5
6
|
#include "defs.h"
|
|
6
7
|
|
|
@@ -20,7 +21,7 @@ RUCY_DEF_ALLOC(alloc, klass)
|
|
|
20
21
|
RUCY_END
|
|
21
22
|
|
|
22
23
|
static
|
|
23
|
-
RUCY_DEF5(
|
|
24
|
+
RUCY_DEF5(initialize, device_name, min_width, min_height, resize, crop)
|
|
24
25
|
{
|
|
25
26
|
RUCY_CHECK_OBJ(Rays::Camera, self);
|
|
26
27
|
|
|
@@ -32,6 +33,13 @@ RUCY_DEF5(setup, device_name, min_width, min_height, resize, crop)
|
|
|
32
33
|
}
|
|
33
34
|
RUCY_END
|
|
34
35
|
|
|
36
|
+
static
|
|
37
|
+
RUCY_DEF1(initialize_copy, obj)
|
|
38
|
+
{
|
|
39
|
+
Rays::rays_error(__FILE__, __LINE__, "can not duplicate Camera");
|
|
40
|
+
}
|
|
41
|
+
RUCY_END
|
|
42
|
+
|
|
35
43
|
static
|
|
36
44
|
RUCY_DEF0(start)
|
|
37
45
|
{
|
|
@@ -155,7 +163,8 @@ Init_rays_camera ()
|
|
|
155
163
|
|
|
156
164
|
cCamera = mRays.define_class("Camera");
|
|
157
165
|
cCamera.define_alloc_func(alloc);
|
|
158
|
-
cCamera.define_private_method("
|
|
166
|
+
cCamera.define_private_method("initialize!", initialize);
|
|
167
|
+
cCamera.define_private_method("initialize_copy", initialize_copy);
|
|
159
168
|
cCamera.define_method("start", start);
|
|
160
169
|
cCamera.define_method("stop", stop);
|
|
161
170
|
cCamera.define_method("active?", is_active);
|
data/ext/rays/color.cpp
CHANGED
|
@@ -366,14 +366,12 @@ namespace Rucy
|
|
|
366
366
|
template <> RAYS_EXPORT Rays::Color
|
|
367
367
|
value_to<Rays::Color> (int argc, const Value*argv, bool convert)
|
|
368
368
|
{
|
|
369
|
-
if (argc == 1 && argv->is_array())
|
|
369
|
+
if (argc == 1 && argv && argv->is_array())
|
|
370
370
|
{
|
|
371
371
|
argc = argv->size();
|
|
372
372
|
argv = argv->as_array();
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
-
assert(argc == 0 || (argc > 0 && argv));
|
|
376
|
-
|
|
377
375
|
if (convert)
|
|
378
376
|
{
|
|
379
377
|
if (argc == 0)
|
data/ext/rays/color_space.cpp
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#include "rays/ruby/color_space.h"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
#include <assert.h>
|
|
5
4
|
#include "defs.h"
|
|
6
5
|
|
|
7
6
|
|
|
@@ -222,13 +221,14 @@ namespace Rucy
|
|
|
222
221
|
template <> RAYS_EXPORT Rays::ColorSpace
|
|
223
222
|
value_to<Rays::ColorSpace> (int argc, const Value* argv, bool convert)
|
|
224
223
|
{
|
|
225
|
-
if (argc == 1 && argv->is_array())
|
|
224
|
+
if (argc == 1 && argv && argv->is_array())
|
|
226
225
|
{
|
|
227
226
|
argc = argv->size();
|
|
228
227
|
argv = argv->as_array();
|
|
229
228
|
}
|
|
230
229
|
|
|
231
|
-
|
|
230
|
+
if (argc <= 0 || !argv)
|
|
231
|
+
argument_error(__FILE__, __LINE__);
|
|
232
232
|
|
|
233
233
|
if (convert)
|
|
234
234
|
{
|