rays 0.3.16 → 0.5.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 +29 -9
- data/.doc/ext/rays/bounds.cpp +2 -5
- data/.doc/ext/rays/camera.cpp +15 -7
- data/.doc/ext/rays/color.cpp +2 -4
- data/.doc/ext/rays/color_space.cpp +13 -9
- data/.doc/ext/rays/font.cpp +117 -22
- data/.doc/ext/rays/image.cpp +31 -7
- data/.doc/ext/rays/matrix.cpp +2 -5
- data/.doc/ext/rays/painter.cpp +13 -5
- data/.doc/ext/rays/point.cpp +2 -5
- data/.doc/ext/rays/polygon.cpp +15 -7
- data/.doc/ext/rays/polyline.cpp +15 -10
- data/.doc/ext/rays/rays.cpp +10 -6
- data/.doc/ext/rays/shader.cpp +15 -7
- data/.github/workflows/release-gem.yml +2 -40
- data/.github/workflows/tag.yml +5 -28
- data/.github/workflows/test.yml +1 -28
- data/ChangeLog.md +31 -0
- data/Gemfile.lock +13 -8
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/ext/rays/bitmap.cpp +29 -9
- data/ext/rays/bounds.cpp +2 -5
- data/ext/rays/camera.cpp +16 -7
- data/ext/rays/color.cpp +2 -4
- data/ext/rays/color_space.cpp +13 -9
- data/ext/rays/defs.h +3 -3
- data/ext/rays/extconf.rb +6 -5
- data/ext/rays/font.cpp +121 -22
- data/ext/rays/image.cpp +31 -7
- data/ext/rays/matrix.cpp +2 -5
- data/ext/rays/painter.cpp +14 -5
- data/ext/rays/point.cpp +2 -5
- data/ext/rays/polygon.cpp +16 -7
- data/ext/rays/polyline.cpp +16 -10
- data/ext/rays/rays.cpp +10 -6
- data/ext/rays/shader.cpp +16 -7
- data/include/rays/bitmap.h +3 -1
- data/include/rays/color_space.h +6 -2
- data/include/rays/defs.h +14 -4
- data/include/rays/font.h +46 -4
- data/include/rays/image.h +11 -7
- data/include/rays/painter.h +3 -1
- data/include/rays/ruby/color_space.h +2 -0
- data/include/rays/shader.h +3 -0
- data/lib/rays/camera.rb +1 -1
- data/lib/rays/extension.rb +1 -1
- data/lib/rays/font.rb +4 -1
- data/lib/rays/image.rb +4 -2
- data/lib/rays/painter.rb +5 -5
- data/lib/rays/polygon.rb +1 -1
- data/lib/rays/polyline.rb +1 -1
- data/lib/rays/shader.rb +1 -1
- data/rays.gemspec +3 -3
- data/src/bitmap.cpp +107 -0
- data/src/color.cpp +17 -0
- data/src/color_space.cpp +5 -5
- data/src/font.cpp +121 -25
- data/src/font.h +7 -5
- data/src/image.cpp +104 -102
- data/src/ios/bitmap.mm +3 -3
- data/src/ios/font.mm +79 -26
- data/src/opengl/bitmap.cpp +1 -1
- data/src/opengl/color_space.cpp +15 -3
- data/src/opengl/color_space.h +1 -1
- data/src/opengl/painter.cpp +86 -18
- data/src/opengl/shader.cpp +15 -13
- data/src/opengl/texture.cpp +7 -7
- data/src/opengl/win32/opengl.cpp +17 -12
- data/src/osx/bitmap.mm +14 -3
- data/src/osx/font.mm +79 -26
- data/src/painter.cpp +12 -12
- data/src/painter.h +5 -1
- data/src/polygon.cpp +21 -21
- data/src/polyline.cpp +4 -4
- data/src/sdl/bitmap.cpp +43 -18
- data/src/sdl/font.cpp +56 -50
- data/src/texture.h +1 -1
- data/src/win32/bitmap.cpp +92 -45
- data/src/win32/font.cpp +43 -44
- data/src/win32/gdi.cpp +43 -46
- data/src/win32/gdi.h +6 -1
- data/src/win32/rays.cpp +18 -1
- data/test/test_bitmap.rb +28 -10
- data/test/test_font.rb +58 -0
- data/test/test_image.rb +29 -6
- data/test/test_painter.rb +39 -0
- metadata +8 -8
- data/.github/workflows/utils.rb +0 -127
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"
|
|
@@ -16,7 +17,7 @@ RUCY_DEFINE_VALUE_FROM_TO(RAYS_EXPORT, Rays::Painter)
|
|
|
16
17
|
|
|
17
18
|
#define THIS to<Rays::Painter*>(self)
|
|
18
19
|
|
|
19
|
-
#define CHECK
|
|
20
|
+
#define CHECK RUCY_CHECK_OBJ(Rays::Painter, self)
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
static
|
|
@@ -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
|
{
|
|
@@ -155,7 +162,7 @@ VALUE point(VALUE self)
|
|
|
155
162
|
std::vector<Rays::Point> points;
|
|
156
163
|
get_points(&points, argc, argv);
|
|
157
164
|
|
|
158
|
-
THIS->points(
|
|
165
|
+
THIS->points(points.data(), points.size());
|
|
159
166
|
return self;
|
|
160
167
|
}
|
|
161
168
|
|
|
@@ -167,7 +174,7 @@ VALUE line(VALUE self, VALUE args, VALUE loop)
|
|
|
167
174
|
std::vector<Rays::Point> points;
|
|
168
175
|
get_points(&points, args.size(), args.as_array());
|
|
169
176
|
|
|
170
|
-
THIS->line(
|
|
177
|
+
THIS->line(points.data(), points.size(), loop);
|
|
171
178
|
return self;
|
|
172
179
|
}
|
|
173
180
|
|
|
@@ -225,7 +232,7 @@ VALUE curve(VALUE self, VALUE args, VALUE loop)
|
|
|
225
232
|
std::vector<Rays::Point> points;
|
|
226
233
|
get_points(&points, args.size(), args.as_array());
|
|
227
234
|
|
|
228
|
-
THIS->curve(
|
|
235
|
+
THIS->curve(points.data(), points.size(), loop);
|
|
229
236
|
return self;
|
|
230
237
|
}
|
|
231
238
|
|
|
@@ -240,7 +247,7 @@ VALUE bezier(VALUE self, VALUE args, VALUE loop)
|
|
|
240
247
|
std::vector<Rays::Point> points;
|
|
241
248
|
get_points(&points, args.size(), args.as_array());
|
|
242
249
|
|
|
243
|
-
THIS->bezier(
|
|
250
|
+
THIS->bezier(points.data(), points.size(), loop);
|
|
244
251
|
return self;
|
|
245
252
|
}
|
|
246
253
|
|
|
@@ -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
|
|
|
@@ -9,7 +8,7 @@ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Point)
|
|
|
9
8
|
|
|
10
9
|
#define THIS to<Rays::Point*>(self)
|
|
11
10
|
|
|
12
|
-
#define CHECK
|
|
11
|
+
#define CHECK RUCY_CHECK_PTR(Rays::Point, self)
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
static
|
|
@@ -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
|
@@ -12,7 +12,7 @@ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Polygon)
|
|
|
12
12
|
|
|
13
13
|
#define THIS to<Rays::Polygon*>(self)
|
|
14
14
|
|
|
15
|
-
#define CHECK
|
|
15
|
+
#define CHECK RUCY_CHECK_OBJ(Rays::Polygon, self)
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
static
|
|
@@ -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
|
|
|
@@ -149,7 +156,7 @@ VALUE op_add(VALUE self, VALUE obj)
|
|
|
149
156
|
});
|
|
150
157
|
}
|
|
151
158
|
|
|
152
|
-
return value(Rays::Polygon(
|
|
159
|
+
return value(Rays::Polygon(polylines.data(), polylines.size()));
|
|
153
160
|
}
|
|
154
161
|
|
|
155
162
|
static
|
|
@@ -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);
|
|
@@ -394,14 +402,14 @@ namespace Rucy
|
|
|
394
402
|
polylines.reserve(argc);
|
|
395
403
|
for (int i = 0; i < argc; ++i)
|
|
396
404
|
polylines.emplace_back(to<Rays::Polyline&>(argv[i]));
|
|
397
|
-
return Rays::Polygon(
|
|
405
|
+
return Rays::Polygon(polylines.data(), polylines.size());
|
|
398
406
|
}
|
|
399
407
|
}
|
|
400
408
|
else if (argv->is_num() || argv->is_array())
|
|
401
409
|
{
|
|
402
410
|
std::vector<Rays::Point> points;
|
|
403
411
|
get_points(&points, argc, argv);
|
|
404
|
-
return Rays::Polygon(
|
|
412
|
+
return Rays::Polygon(points.data(), points.size());
|
|
405
413
|
}
|
|
406
414
|
}
|
|
407
415
|
|
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"
|
|
@@ -14,7 +13,7 @@ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Polyline)
|
|
|
14
13
|
|
|
15
14
|
#define THIS to<Rays::Polyline*>(self)
|
|
16
15
|
|
|
17
|
-
#define CHECK
|
|
16
|
+
#define CHECK RUCY_CHECK_OBJ(Rays::Polyline, self)
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
static
|
|
@@ -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)
|
|
@@ -221,7 +226,7 @@ namespace Rucy
|
|
|
221
226
|
{
|
|
222
227
|
std::vector<Rays::Point> points;
|
|
223
228
|
get_points(&points, argc, argv);
|
|
224
|
-
return Rays::Polyline(
|
|
229
|
+
return Rays::Polyline(points.data(), points.size());
|
|
225
230
|
}
|
|
226
231
|
}
|
|
227
232
|
|
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
|
|
|
@@ -10,7 +10,7 @@ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Shader)
|
|
|
10
10
|
|
|
11
11
|
#define THIS to<Rays::Shader*>(self)
|
|
12
12
|
|
|
13
|
-
#define CHECK
|
|
13
|
+
#define CHECK RUCY_CHECK_OBJ(Rays::Shader, self)
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
static
|
|
@@ -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,11 +87,11 @@ 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
|
{
|
|
88
|
-
|
|
94
|
+
RUCY_CHECK_PTR(Rays::Shader, self);
|
|
89
95
|
|
|
90
96
|
if (fragment_shader_source.is_nil())
|
|
91
97
|
argument_error(__FILE__, __LINE__);
|
|
@@ -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
|
{
|
|
@@ -9,43 +9,5 @@ permissions:
|
|
|
9
9
|
|
|
10
10
|
jobs:
|
|
11
11
|
release:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
steps:
|
|
15
|
-
- name: ruby 3.2
|
|
16
|
-
uses: ruby/setup-ruby@v1
|
|
17
|
-
with:
|
|
18
|
-
ruby-version: 3.2
|
|
19
|
-
|
|
20
|
-
- name: checkout
|
|
21
|
-
uses: actions/checkout@v4
|
|
22
|
-
|
|
23
|
-
- name: setup gems
|
|
24
|
-
run: bundle install
|
|
25
|
-
|
|
26
|
-
- name: setup dependencies
|
|
27
|
-
run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
|
|
28
|
-
|
|
29
|
-
- name: test
|
|
30
|
-
run: bundle exec rake packages test
|
|
31
|
-
|
|
32
|
-
- name: create gem
|
|
33
|
-
id: gem
|
|
34
|
-
run: |
|
|
35
|
-
bundle exec rake gem
|
|
36
|
-
echo path=$(ruby -e 'print Dir.glob("*.gem").first') >> $GITHUB_OUTPUT
|
|
37
|
-
|
|
38
|
-
- name: create github release
|
|
39
|
-
env:
|
|
40
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
41
|
-
run: ruby -I.github/workflows -rutils -e 'release(*ARGV)' ./${{ steps.gem.outputs.path }}
|
|
42
|
-
|
|
43
|
-
- name: upload to rubygems
|
|
44
|
-
env:
|
|
45
|
-
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
|
|
46
|
-
run: |
|
|
47
|
-
mkdir -p $HOME/.gem
|
|
48
|
-
touch $HOME/.gem/credentials
|
|
49
|
-
chmod 0600 $HOME/.gem/credentials
|
|
50
|
-
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
|
51
|
-
bundle exec rake upload
|
|
12
|
+
uses: xord/xot/.github/workflows/release-gem.yml@master
|
|
13
|
+
secrets: inherit
|
data/.github/workflows/tag.yml
CHANGED
|
@@ -1,35 +1,12 @@
|
|
|
1
1
|
name: Tag
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
4
|
+
workflow_run:
|
|
5
|
+
workflows: [Test]
|
|
6
|
+
types: [completed]
|
|
5
7
|
branches: [master]
|
|
6
8
|
|
|
7
9
|
jobs:
|
|
8
10
|
tag:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
steps:
|
|
12
|
-
- name: ruby 3.2
|
|
13
|
-
uses: ruby/setup-ruby@v1
|
|
14
|
-
with:
|
|
15
|
-
ruby-version: 3.2
|
|
16
|
-
|
|
17
|
-
- name: checkout
|
|
18
|
-
uses: actions/checkout@v4
|
|
19
|
-
with:
|
|
20
|
-
fetch-depth: 0
|
|
21
|
-
token: ${{ secrets.PAT }}
|
|
22
|
-
|
|
23
|
-
- name: setup dependencies
|
|
24
|
-
run: "ruby -I.github/workflows -rutils -e 'setup_dependencies only: :xot'"
|
|
25
|
-
|
|
26
|
-
- name: setup user name and email
|
|
27
|
-
run: |
|
|
28
|
-
git config --global user.email "xordog@gmail.com"
|
|
29
|
-
git config --global user.name "xord"
|
|
30
|
-
|
|
31
|
-
- name: tag versions
|
|
32
|
-
run: "ruby -I.github/workflows -rutils -e 'tag_versions'"
|
|
33
|
-
|
|
34
|
-
- name: push tags
|
|
35
|
-
run: git push origin --tags
|
|
11
|
+
uses: xord/xot/.github/workflows/tag.yml@master
|
|
12
|
+
secrets: inherit
|
data/.github/workflows/test.yml
CHANGED
|
@@ -7,31 +7,4 @@ on:
|
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
test:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
steps:
|
|
13
|
-
- name: ruby 3.2
|
|
14
|
-
uses: ruby/setup-ruby@v1
|
|
15
|
-
with:
|
|
16
|
-
ruby-version: 3.2
|
|
17
|
-
|
|
18
|
-
- name: checkout
|
|
19
|
-
uses: actions/checkout@v4
|
|
20
|
-
|
|
21
|
-
- name: setup gems
|
|
22
|
-
run: bundle install
|
|
23
|
-
|
|
24
|
-
- name: setup dependencies
|
|
25
|
-
run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
|
|
26
|
-
|
|
27
|
-
- name: packages
|
|
28
|
-
run: bundle exec rake verbose packages
|
|
29
|
-
|
|
30
|
-
- name: lib
|
|
31
|
-
run: bundle exec rake verbose lib
|
|
32
|
-
|
|
33
|
-
- name: ext
|
|
34
|
-
run: bundle exec rake verbose ext
|
|
35
|
-
|
|
36
|
-
- name: test
|
|
37
|
-
run: bundle exec rake verbose test
|
|
10
|
+
uses: xord/xot/.github/workflows/test.yml@master
|
data/ChangeLog.md
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
# rays ChangeLog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## [v0.5.0] - 2026-11-04
|
|
5
|
+
|
|
6
|
+
- [BREAKING] Store and blend alpha premultiplied on the GPU, so a fragment shader sees premultiplied samples and must emit premultiplied color
|
|
7
|
+
- [BREAKING] Bitmap#pixels exchanges straight alpha, not premultiplied
|
|
8
|
+
- [BREAKING] Size fonts in pixels on Windows, as on the other platforms
|
|
9
|
+
- [BREAKING] Font#name returns the name asked for, and Font#name(true) the name of the face the platform picked
|
|
10
|
+
- Add weight and italic to Font
|
|
11
|
+
- Add Font#italic? and #smooth?, and Image#smooth?
|
|
12
|
+
- Handle non-ASCII text and file paths on Windows
|
|
13
|
+
- Support High DPI on Windows
|
|
14
|
+
- Draw BGRA bitmaps on every platform
|
|
15
|
+
- Make a paint session that draws nothing cost almost nothing, and stop waiting for the GPU at its end
|
|
16
|
+
|
|
17
|
+
- Fix Font.new with no arguments sharing the default font, so that changing it changed every default font
|
|
18
|
+
- Fix text drawn off its baseline at a pixel density other than 1
|
|
19
|
+
- Fix a crash on the error paths, as loading a GIF from a missing file, on macOS
|
|
20
|
+
- Fix a crash in Font.families when the GC runs
|
|
21
|
+
- Fix an overflow of a font name longer than 31 characters on Windows
|
|
22
|
+
- Fix linking the extension statically on macOS
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [v0.4.0] - 2026-08-04
|
|
26
|
+
|
|
27
|
+
- [BREAKING] Rename COLORSPACE_UNKNOWN to COLORSPACE_NONE
|
|
28
|
+
- [BREAKING] Default to BGRA color space on Windows
|
|
29
|
+
- Add pixel_density and smooth options to Image.load
|
|
30
|
+
- Support dup on value classes, reject it on stateful ones
|
|
31
|
+
|
|
32
|
+
- Fix crash when an empty array is passed where a Color, Point, Bounds, etc. is expected
|
|
33
|
+
|
|
34
|
+
|
|
4
35
|
## [v0.3.16] - 2026-06-23
|
|
5
36
|
|
|
6
37
|
- Update dependencies
|
data/Gemfile.lock
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
power_assert (3.0
|
|
5
|
-
rake (13.
|
|
6
|
-
test-unit (3.7.
|
|
4
|
+
power_assert (3.1.0)
|
|
5
|
+
rake (13.4.2)
|
|
6
|
+
test-unit (3.7.8)
|
|
7
7
|
power_assert
|
|
8
|
-
yard (0.9.
|
|
8
|
+
yard (0.9.45)
|
|
9
9
|
|
|
10
10
|
PLATFORMS
|
|
11
|
-
|
|
12
|
-
arm64-darwin-23
|
|
13
|
-
arm64-darwin-24
|
|
11
|
+
ruby
|
|
14
12
|
|
|
15
13
|
DEPENDENCIES
|
|
16
14
|
rake
|
|
17
15
|
test-unit
|
|
18
16
|
yard
|
|
19
17
|
|
|
18
|
+
CHECKSUMS
|
|
19
|
+
bundler (4.0.20) sha256=7978a8ac648767f5e635bc522445b79e80a52b907a39a36c2d8085ed6bc762ae
|
|
20
|
+
power_assert (3.1.0) sha256=fefe98ed5d3140628138f3f9f9194d6ece01f1320e69700d3c928adca7518251
|
|
21
|
+
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
|
|
22
|
+
test-unit (3.7.8) sha256=689d1ca53f4d46f678b4e5d68d8e4294f87fc5e8b9238cc4de7c5727e8d65943
|
|
23
|
+
yard (0.9.45) sha256=52e211493f7cb8a3ebf7e104a25a1e73937a3103092545d34cb88fafebb3dc51
|
|
24
|
+
|
|
20
25
|
BUNDLED WITH
|
|
21
|
-
|
|
26
|
+
4.0.20
|
data/Rakefile
CHANGED
|
@@ -37,7 +37,7 @@ use_external_library 'https://github.com/andrewwillmott/splines-lib',
|
|
|
37
37
|
commit: '11e7240d57b0d22871aec3308186a5fcf915ba77',
|
|
38
38
|
excludes: 'Test\.cpp',
|
|
39
39
|
&proc {
|
|
40
|
-
filter_file
|
|
40
|
+
filter_file 'Splines.cpp' do |cpp|
|
|
41
41
|
<<~EOS + cpp
|
|
42
42
|
#include <cstdint>
|
|
43
43
|
EOS
|
|
@@ -54,6 +54,6 @@ default_tasks :ext
|
|
|
54
54
|
use_bundler
|
|
55
55
|
build_native_library
|
|
56
56
|
build_ruby_extension
|
|
57
|
-
test_ruby_extension
|
|
57
|
+
test_ruby_extension
|
|
58
58
|
generate_documents
|
|
59
59
|
build_ruby_gem
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.5.0
|