rays 0.2.1 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.doc/ext/rays/bitmap.cpp +99 -32
  3. data/.doc/ext/rays/bounds.cpp +2 -2
  4. data/.doc/ext/rays/camera.cpp +1 -1
  5. data/.doc/ext/rays/color.cpp +2 -2
  6. data/.doc/ext/rays/color_space.cpp +3 -3
  7. data/.doc/ext/rays/font.cpp +4 -3
  8. data/.doc/ext/rays/image.cpp +1 -1
  9. data/.doc/ext/rays/matrix.cpp +4 -4
  10. data/.doc/ext/rays/painter.cpp +1 -1
  11. data/.doc/ext/rays/point.cpp +2 -2
  12. data/.doc/ext/rays/polygon.cpp +3 -3
  13. data/.doc/ext/rays/polyline.cpp +3 -3
  14. data/.doc/ext/rays/rays.cpp +10 -10
  15. data/.doc/ext/rays/shader.cpp +2 -2
  16. data/.github/workflows/release-gem.yml +1 -1
  17. data/.github/workflows/test.yml +3 -0
  18. data/ChangeLog.md +5 -0
  19. data/Rakefile +17 -2
  20. data/VERSION +1 -1
  21. data/ext/rays/bitmap.cpp +99 -32
  22. data/ext/rays/bounds.cpp +2 -2
  23. data/ext/rays/camera.cpp +1 -1
  24. data/ext/rays/color.cpp +2 -2
  25. data/ext/rays/color_space.cpp +3 -3
  26. data/ext/rays/defs.h +2 -0
  27. data/ext/rays/extconf.rb +4 -2
  28. data/ext/rays/font.cpp +4 -3
  29. data/ext/rays/image.cpp +1 -1
  30. data/ext/rays/matrix.cpp +4 -4
  31. data/ext/rays/painter.cpp +1 -1
  32. data/ext/rays/point.cpp +2 -2
  33. data/ext/rays/polygon.cpp +3 -3
  34. data/ext/rays/polyline.cpp +3 -3
  35. data/ext/rays/rays.cpp +10 -10
  36. data/ext/rays/shader.cpp +2 -2
  37. data/include/rays/defs.h +7 -0
  38. data/include/rays/ruby/bitmap.h +2 -2
  39. data/include/rays/ruby/bounds.h +2 -2
  40. data/include/rays/ruby/camera.h +2 -2
  41. data/include/rays/ruby/color.h +2 -2
  42. data/include/rays/ruby/color_space.h +2 -2
  43. data/include/rays/ruby/exception.h +3 -3
  44. data/include/rays/ruby/font.h +2 -2
  45. data/include/rays/ruby/image.h +2 -2
  46. data/include/rays/ruby/matrix.h +2 -2
  47. data/include/rays/ruby/painter.h +2 -2
  48. data/include/rays/ruby/point.h +2 -2
  49. data/include/rays/ruby/polygon.h +2 -2
  50. data/include/rays/ruby/polyline.h +2 -2
  51. data/include/rays/ruby/rays.h +6 -6
  52. data/include/rays/ruby/shader.h +2 -2
  53. data/lib/rays/bitmap.rb +7 -0
  54. data/lib/rays/extension.rb +4 -0
  55. data/rays.gemspec +2 -2
  56. data/src/coord.h +2 -2
  57. data/src/font.cpp +1 -0
  58. data/src/ios/bitmap.mm +23 -30
  59. data/src/ios/font.mm +4 -1
  60. data/src/ios/rays.mm +2 -2
  61. data/src/matrix.h +1 -1
  62. data/src/opengl.h +1 -2
  63. data/src/osx/bitmap.mm +23 -30
  64. data/src/osx/font.mm +4 -1
  65. data/src/osx/rays.mm +2 -2
  66. data/src/painter.cpp +1 -0
  67. data/src/shader.cpp +3 -0
  68. data/src/win32/bitmap.cpp +167 -65
  69. data/src/win32/camera.cpp +119 -0
  70. data/src/win32/font.cpp +179 -40
  71. data/src/win32/gdi.h +1 -1
  72. data/src/win32/opengl.cpp +127 -0
  73. data/src/win32/rays.cpp +16 -9
  74. data/test/helper.rb +2 -0
  75. data/test/test_bitmap.rb +3 -1
  76. data/test/test_image.rb +8 -14
  77. data/test/test_painter.rb +4 -4
  78. metadata +7 -6
  79. data/src/win32/font.h +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a7045b85aab21570ba6c4f816ea00a7638f39645d0b3393ae9ba93d14110be1
4
- data.tar.gz: 8492b40089c9a7da4336b72e059b4e189739d4510a0abc2a76ec775a9297bc80
3
+ metadata.gz: 9cb95796a8c672691ee51529359a2f4fbe5476dd7a3edf27d03ac79f40a045e3
4
+ data.tar.gz: 3f28f201cffc7d1a021846791ba10ab637ef33aa70618a7fce00085a73438ac4
5
5
  SHA512:
6
- metadata.gz: 3d48296b01c547a877506077fba4c3b30dae52d74589b947877e8ffc3cf62113619041e7d47d3073222af2ce5dfdc1559004ad08477b5c117c30fbae76a03f68
7
- data.tar.gz: 73b031ed35d8519e3ebcf4745d18868fe3ac61559d6159f10aa2e0a2a267051ba5d76bd7f61b28b7427cbc4b1b64da2e4e3f8cf5a066c3bb98d578a69adb64a0
6
+ metadata.gz: bae41d0c790c9b9e766f5c28849ce91de22be9a27434b1713103cf1a4f93c11b4b2f78c2f4ce6fe7132c44c9baea78c09bb7b6f578bffc87c2b0e706c27398b2
7
+ data.tar.gz: 48b7ba9a9b3a8bacd70913b1caa6cf5aaea4eea4397eaea6408278999ccb848720e44f0f6b5c7b851cff7ee987407851a8dc463f8df6cfbefc58cf71e94d25cc
@@ -7,7 +7,7 @@
7
7
  #include "defs.h"
8
8
 
9
9
 
10
- RUCY_DEFINE_VALUE_FROM_TO(Rays::Bitmap)
10
+ RUCY_DEFINE_VALUE_FROM_TO(RAYS_EXPORT, Rays::Bitmap)
11
11
 
12
12
  #define THIS to<Rays::Bitmap*>(self)
13
13
 
@@ -317,23 +317,23 @@ set_pixels (Rays::Bitmap* bmp, Value pixels)
317
317
  }
318
318
  }
319
319
 
320
- static inline Value
321
- to_rgb_value (uint8_t r, uint8_t g, uint8_t b)
320
+ static inline uint32_t
321
+ to_rgb (uint8_t r, uint8_t g, uint8_t b)
322
322
  {
323
- return value(
324
- ((uint) r) << 16 |
325
- ((uint) g) << 8 |
326
- ((uint) b));
323
+ return
324
+ ((uint32_t) r) << 16 |
325
+ ((uint32_t) g) << 8 |
326
+ ((uint32_t) b);
327
327
  }
328
328
 
329
- static inline Value
330
- to_argb_value (uint8_t r, uint8_t g, uint8_t b, uint8_t a)
329
+ static inline uint32_t
330
+ to_argb (uint8_t r, uint8_t g, uint8_t b, uint8_t a)
331
331
  {
332
- return value(
333
- ((uint) a) << 24 |
334
- ((uint) r) << 16 |
335
- ((uint) g) << 8 |
336
- ((uint) b));
332
+ return
333
+ ((uint32_t) a) << 24 |
334
+ ((uint32_t) r) << 16 |
335
+ ((uint32_t) g) << 8 |
336
+ ((uint32_t) b);
337
337
  }
338
338
 
339
339
  static void
@@ -392,7 +392,7 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
392
392
  {
393
393
  const auto* p = bmp.at<uint8_t>(0, y);
394
394
  for (int x = 0; x < w; ++x, p += 3)
395
- pixels->push_back(to_rgb_value(p[0], p[1], p[2]));
395
+ pixels->push_back(value(to_rgb(p[0], p[1], p[2])));
396
396
  }
397
397
  break;
398
398
 
@@ -402,7 +402,7 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
402
402
  {
403
403
  const auto* p = bmp.at<uint8_t>(0, y);
404
404
  for (int x = 0; x < w; ++x, p += 4)
405
- pixels->push_back(to_argb_value(p[0], p[1], p[2], p[3]));
405
+ pixels->push_back(value(to_argb(p[0], p[1], p[2], p[3])));
406
406
  }
407
407
  break;
408
408
 
@@ -412,7 +412,7 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
412
412
  {
413
413
  const auto* p = bmp.at<uint8_t>(0, y);
414
414
  for (int x = 0; x < w; ++x, p += 4)
415
- pixels->push_back(to_argb_value(p[1], p[2], p[3], p[0]));
415
+ pixels->push_back(value(to_argb(p[1], p[2], p[3], p[0])));
416
416
  }
417
417
  break;
418
418
 
@@ -421,7 +421,7 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
421
421
  {
422
422
  const auto* p = bmp.at<uint8_t>(0, y);
423
423
  for (int x = 0; x < w; ++x, p += 3)
424
- pixels->push_back(to_rgb_value(p[2], p[1], p[0]));
424
+ pixels->push_back(value(to_rgb(p[2], p[1], p[0])));
425
425
  }
426
426
  break;
427
427
 
@@ -431,7 +431,7 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
431
431
  {
432
432
  const auto* p = bmp.at<uint8_t>(0, y);
433
433
  for (int x = 0; x < w; ++x, p += 4)
434
- pixels->push_back(to_argb_value(p[2], p[1], p[0], p[3]));
434
+ pixels->push_back(value(to_argb(p[2], p[1], p[0], p[3])));
435
435
  }
436
436
  break;
437
437
 
@@ -441,7 +441,7 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
441
441
  {
442
442
  const auto* p = bmp.at<uint8_t>(0, y);
443
443
  for (int x = 0; x < w; ++x, p += 4)
444
- pixels->push_back(to_argb_value(p[3], p[2], p[1], p[0]));
444
+ pixels->push_back(value(to_argb(p[3], p[2], p[1], p[0])));
445
445
  }
446
446
  break;
447
447
 
@@ -532,17 +532,85 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
532
532
  }
533
533
  }
534
534
 
535
- static
536
- VALUE set_pixels(VALUE self, VALUE pixels)
535
+ static Value
536
+ get_32bit_pixels_string (const Rays::Bitmap& bmp)
537
537
  {
538
- CHECK;
538
+ // avoid SEGV caused by 32bit argb value on 'x64-mingw-ucrt' platform.
539
+
540
+ const auto& cs = bmp.color_space();
541
+ if (cs.bpp() != 32) return nil();
542
+
543
+ int w = bmp.width(), h = bmp.height();
539
544
 
540
- if (sizeof(VALUE) <= 4)
545
+ std::vector<uint32_t> pixels;
546
+ pixels.reserve(w * h);
547
+
548
+ switch (cs.type())
541
549
  {
542
- not_implemented_error(
543
- __FILE__, __LINE__, "Bitmap#pixels=() does not support 32-bit platforms");
550
+ case Rays::GRAY_32:
551
+ case Rays::ALPHA_32:
552
+ for (int y = 0; y < h; ++y)
553
+ {
554
+ const auto* p = bmp.at<uint32_t>(0, y);
555
+ for (int x = 0; x < w; ++x, ++p)
556
+ pixels.push_back(*p);
557
+ }
558
+ break;
559
+
560
+ case Rays::RGBA_8888:
561
+ case Rays::RGBX_8888:
562
+ for (int y = 0; y < h; ++y)
563
+ {
564
+ const auto* p = bmp.at<uint8_t>(0, y);
565
+ for (int x = 0; x < w; ++x, p += 4)
566
+ pixels.push_back(to_argb(p[0], p[1], p[2], p[3]));
567
+ }
568
+ break;
569
+
570
+ case Rays::ARGB_8888:
571
+ case Rays::XRGB_8888:
572
+ for (int y = 0; y < h; ++y)
573
+ {
574
+ const auto* p = bmp.at<uint8_t>(0, y);
575
+ for (int x = 0; x < w; ++x, p += 4)
576
+ pixels.push_back(to_argb(p[1], p[2], p[3], p[0]));
577
+ }
578
+ break;
579
+
580
+ case Rays::BGRA_8888:
581
+ case Rays::BGRX_8888:
582
+ for (int y = 0; y < h; ++y)
583
+ {
584
+ const auto* p = bmp.at<uint8_t>(0, y);
585
+ for (int x = 0; x < w; ++x, p += 4)
586
+ pixels.push_back(to_argb(p[2], p[1], p[0], p[3]));
587
+ }
588
+ break;
589
+
590
+ case Rays::ABGR_8888:
591
+ case Rays::XBGR_8888:
592
+ for (int y = 0; y < h; ++y)
593
+ {
594
+ const auto* p = bmp.at<uint8_t>(0, y);
595
+ for (int x = 0; x < w; ++x, p += 4)
596
+ pixels.push_back(to_argb(p[3], p[2], p[1], p[0]));
597
+ }
598
+ break;
599
+
600
+ default:
601
+ return nil();
544
602
  }
545
603
 
604
+ return value(
605
+ (const char*) &pixels[0], pixels.size() * sizeof(uint32_t),
606
+ rb_ascii8bit_encoding());
607
+ }
608
+
609
+ static
610
+ VALUE set_pixels(VALUE self, VALUE pixels)
611
+ {
612
+ CHECK;
613
+
546
614
  set_pixels(THIS, pixels);
547
615
  return pixels;
548
616
  }
@@ -552,11 +620,10 @@ VALUE get_pixels(VALUE self)
552
620
  {
553
621
  CHECK;
554
622
 
555
- if (sizeof(VALUE) <= 4)
556
- {
557
- not_implemented_error(
558
- __FILE__, __LINE__, "Bitmap#pixels() does not support 32-bit platforms");
559
- }
623
+ #ifdef RAYS_32BIT_PIXELS_STRING
624
+ Value str = get_32bit_pixels_string(*THIS);
625
+ if (str) return str;
626
+ #endif
560
627
 
561
628
  std::vector<VALUE> pixels;
562
629
  get_pixels(&pixels, *THIS);
@@ -603,7 +670,7 @@ Init_rays_bitmap ()
603
670
  rb_define_method(cBitmap, "height", RUBY_METHOD_FUNC(height), 0);
604
671
  rb_define_method(cBitmap, "color_space", RUBY_METHOD_FUNC(color_space), 0);
605
672
  rb_define_method(cBitmap, "pixels=", RUBY_METHOD_FUNC(set_pixels), 1);
606
- rb_define_method(cBitmap, "pixels", RUBY_METHOD_FUNC(get_pixels), 0);
673
+ cBitmap.define_method("pixels!", get_pixels);
607
674
  cBitmap.define_method("[]=", set_at);
608
675
  cBitmap.define_method("[]", get_at);
609
676
  }
@@ -6,7 +6,7 @@
6
6
  #include "defs.h"
7
7
 
8
8
 
9
- RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(Rays::Bounds)
9
+ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Bounds)
10
10
 
11
11
  #define THIS to<Rays::Bounds*>(self)
12
12
 
@@ -582,7 +582,7 @@ namespace Rucy
582
582
  {
583
583
 
584
584
 
585
- template <> Rays::Bounds
585
+ template <> RAYS_EXPORT Rays::Bounds
586
586
  value_to<Rays::Bounds> (int argc, const Value* argv, bool convert)
587
587
  {
588
588
  if (argc == 1 && argv->is_array())
@@ -5,7 +5,7 @@
5
5
  #include "defs.h"
6
6
 
7
7
 
8
- RUCY_DEFINE_VALUE_FROM_TO(Rays::Camera)
8
+ RUCY_DEFINE_VALUE_FROM_TO(RAYS_EXPORT, Rays::Camera)
9
9
 
10
10
  #define THIS to<Rays::Camera*>(self)
11
11
 
@@ -6,7 +6,7 @@
6
6
  #include "defs.h"
7
7
 
8
8
 
9
- RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(Rays::Color)
9
+ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Color)
10
10
 
11
11
  #define THIS to<Rays::Color*>(self)
12
12
 
@@ -330,7 +330,7 @@ namespace Rucy
330
330
  return find_color(str_.c_str());
331
331
  }
332
332
 
333
- template <> Rays::Color
333
+ template <> RAYS_EXPORT Rays::Color
334
334
  value_to<Rays::Color> (int argc, const Value*argv, bool convert)
335
335
  {
336
336
  if (argc == 1 && argv->is_array())
@@ -5,7 +5,7 @@
5
5
  #include "defs.h"
6
6
 
7
7
 
8
- RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(Rays::ColorSpace)
8
+ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::ColorSpace)
9
9
 
10
10
  #define THIS to<Rays::ColorSpace*>(self)
11
11
 
@@ -206,7 +206,7 @@ namespace Rucy
206
206
  {
207
207
 
208
208
 
209
- template <> Rays::ColorSpace
209
+ template <> RAYS_EXPORT Rays::ColorSpace
210
210
  value_to<Rays::ColorSpace> (int argc, const Value* argv, bool convert)
211
211
  {
212
212
  if (argc == 1 && argv->is_array())
@@ -234,7 +234,7 @@ namespace Rucy
234
234
  }
235
235
 
236
236
 
237
- template <> Rays::ColorSpaceType
237
+ template <> RAYS_EXPORT Rays::ColorSpaceType
238
238
  value_to<Rays::ColorSpaceType> (Value value, bool convert)
239
239
  {
240
240
  if (convert)
@@ -5,7 +5,7 @@
5
5
  #include "defs.h"
6
6
 
7
7
 
8
- RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(Rays::Font)
8
+ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Font)
9
9
 
10
10
  #define THIS to<Rays::Font*>(self)
11
11
 
@@ -156,7 +156,7 @@ namespace Rucy
156
156
  {
157
157
 
158
158
 
159
- template <> Rays::Font
159
+ template <> RAYS_EXPORT Rays::Font
160
160
  value_to<Rays::Font> (int argc, const Value* argv, bool convert)
161
161
  {
162
162
  if (argc == 1 && argv->is_array())
@@ -172,7 +172,8 @@ namespace Rucy
172
172
  if (argc == 0)
173
173
  return Rays::get_default_font();
174
174
 
175
- coord size = argc >= 2 ? to<coord>(argv[1]) : Rays::Font::DEFAULT_SIZE;
175
+ coord size =
176
+ argc >= 2 ? to<coord>(argv[1]) : (coord) Rays::Font::DEFAULT_SIZE;
176
177
  if (argv->is_nil())
177
178
  return Rays::Font(NULL, size);
178
179
  else if (argv->is_s() || argv->is_sym())
@@ -7,7 +7,7 @@
7
7
  #include "defs.h"
8
8
 
9
9
 
10
- RUCY_DEFINE_VALUE_FROM_TO(Rays::Image)
10
+ RUCY_DEFINE_VALUE_FROM_TO(RAYS_EXPORT, Rays::Image)
11
11
 
12
12
  #define THIS to<Rays::Image*>(self)
13
13
 
@@ -6,7 +6,7 @@
6
6
  #include "defs.h"
7
7
 
8
8
 
9
- RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(Rays::Matrix)
9
+ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Matrix)
10
10
 
11
11
  #define THIS to<Rays::Matrix*>(self)
12
12
 
@@ -214,10 +214,10 @@ VALUE s_ortho(VALUE self)
214
214
  }
215
215
 
216
216
  static
217
- VALUE s_perspective(VALUE self, VALUE fov_y, VALUE aspect_ratio, VALUE near, VALUE far)
217
+ VALUE s_perspective(VALUE self, VALUE fov_y, VALUE aspect_ratio, VALUE near_, VALUE far_)
218
218
  {
219
219
  return value(Rays::perspective(
220
- to<float>(fov_y), to<float>(aspect_ratio), to<coord>(near), to<coord>(far)));
220
+ to<float>(fov_y), to<float>(aspect_ratio), to<coord>(near_), to<coord>(far_)));
221
221
  }
222
222
 
223
223
  static
@@ -281,7 +281,7 @@ namespace Rucy
281
281
  {
282
282
 
283
283
 
284
- template <> Rays::Matrix
284
+ template <> RAYS_EXPORT Rays::Matrix
285
285
  value_to<Rays::Matrix> (int argc, const Value* argv, bool convert)
286
286
  {
287
287
  if (argc == 1 && argv->is_array())
@@ -12,7 +12,7 @@
12
12
  #include "defs.h"
13
13
 
14
14
 
15
- RUCY_DEFINE_VALUE_FROM_TO(Rays::Painter)
15
+ RUCY_DEFINE_VALUE_FROM_TO(RAYS_EXPORT, Rays::Painter)
16
16
 
17
17
  #define THIS to<Rays::Painter*>(self)
18
18
 
@@ -5,7 +5,7 @@
5
5
  #include "defs.h"
6
6
 
7
7
 
8
- RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(Rays::Point)
8
+ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Point)
9
9
 
10
10
  #define THIS to<Rays::Point*>(self)
11
11
 
@@ -275,7 +275,7 @@ namespace Rucy
275
275
  {
276
276
 
277
277
 
278
- template <> Rays::Point
278
+ template <> RAYS_EXPORT Rays::Point
279
279
  value_to<Rays::Point> (int argc, const Value* argv, bool convert)
280
280
  {
281
281
  if (argc == 1 && argv->is_array())
@@ -8,7 +8,7 @@
8
8
  #include "defs.h"
9
9
 
10
10
 
11
- RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(Rays::Polygon)
11
+ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Polygon)
12
12
 
13
13
  #define THIS to<Rays::Polygon*>(self)
14
14
 
@@ -46,7 +46,7 @@ VALUE expand(VALUE self)
46
46
  coord width = to<coord> (argv[0]);
47
47
  Rays::CapType cap = argc >= 2 ? to<Rays::CapType> (argv[1]) : Rays::CAP_DEFAULT;
48
48
  Rays::JoinType join = argc >= 3 ? to<Rays::JoinType>(argv[2]) : Rays::JOIN_DEFAULT;
49
- coord ml = argc >= 4 ? to<coord> (argv[3]) : Rays::JOIN_DEFAULT_MITER_LIMIT;
49
+ coord ml = argc >= 4 ? to<coord> (argv[3]) : (coord) Rays::JOIN_DEFAULT_MITER_LIMIT;
50
50
 
51
51
  Rays::Polygon polygon;
52
52
  THIS->expand(&polygon, width, cap, join, ml);
@@ -375,7 +375,7 @@ namespace Rucy
375
375
  {
376
376
 
377
377
 
378
- template <> Rays::Polygon
378
+ template <> RAYS_EXPORT Rays::Polygon
379
379
  value_to<Rays::Polygon> (int argc, const Value* argv, bool convert)
380
380
  {
381
381
  if (convert)
@@ -10,7 +10,7 @@
10
10
  #include "defs.h"
11
11
 
12
12
 
13
- RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(Rays::Polyline)
13
+ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Polyline)
14
14
 
15
15
  #define THIS to<Rays::Polyline*>(self)
16
16
 
@@ -44,7 +44,7 @@ VALUE expand(VALUE self)
44
44
  coord width = to<coord> (argv[0]);
45
45
  Rays::CapType cap = argc >= 2 ? to<Rays::CapType> (argv[1]) : Rays::CAP_DEFAULT;
46
46
  Rays::JoinType join = argc >= 3 ? to<Rays::JoinType>(argv[2]) : Rays::JOIN_DEFAULT;
47
- coord ml = argc >= 4 ? to<coord> (argv[3]) : Rays::JOIN_DEFAULT_MITER_LIMIT;
47
+ coord ml = argc >= 4 ? to<coord> (argv[3]) : (coord) Rays::JOIN_DEFAULT_MITER_LIMIT;
48
48
 
49
49
  Rays::Polygon polygon;
50
50
  THIS->expand(&polygon, width, cap, join, ml);
@@ -206,7 +206,7 @@ namespace Rucy
206
206
  {
207
207
 
208
208
 
209
- template <> Rays::Polyline
209
+ template <> RAYS_EXPORT Rays::Polyline
210
210
  value_to<Rays::Polyline> (int argc, const Value* argv, bool convert)
211
211
  {
212
212
  assert(argc == 0 || (argc > 0 && argv));
@@ -6,11 +6,11 @@
6
6
  #include "defs.h"
7
7
 
8
8
 
9
- RUCY_DEFINE_CONVERT_TO(Rays::CapType)
10
- RUCY_DEFINE_CONVERT_TO(Rays::JoinType)
11
- RUCY_DEFINE_CONVERT_TO(Rays::BlendMode)
12
- RUCY_DEFINE_CONVERT_TO(Rays::TexCoordMode)
13
- RUCY_DEFINE_CONVERT_TO(Rays::TexCoordWrap)
9
+ RUCY_DEFINE_CONVERT_TO(RAYS_EXPORT, Rays::CapType)
10
+ RUCY_DEFINE_CONVERT_TO(RAYS_EXPORT, Rays::JoinType)
11
+ RUCY_DEFINE_CONVERT_TO(RAYS_EXPORT, Rays::BlendMode)
12
+ RUCY_DEFINE_CONVERT_TO(RAYS_EXPORT, Rays::TexCoordMode)
13
+ RUCY_DEFINE_CONVERT_TO(RAYS_EXPORT, Rays::TexCoordWrap)
14
14
 
15
15
 
16
16
  template <typename T>
@@ -102,7 +102,7 @@ namespace Rucy
102
102
  {
103
103
 
104
104
 
105
- template <> Rays::CapType
105
+ template <> RAYS_EXPORT Rays::CapType
106
106
  value_to<Rays::CapType> (int argc, const Value* argv, bool convert)
107
107
  {
108
108
  assert(argc > 0 && argv);
@@ -133,7 +133,7 @@ namespace Rucy
133
133
  }
134
134
 
135
135
 
136
- template <> Rays::JoinType
136
+ template <> RAYS_EXPORT Rays::JoinType
137
137
  value_to<Rays::JoinType> (int argc, const Value* argv, bool convert)
138
138
  {
139
139
  assert(argc > 0 && argv);
@@ -164,7 +164,7 @@ namespace Rucy
164
164
  }
165
165
 
166
166
 
167
- template <> Rays::BlendMode
167
+ template <> RAYS_EXPORT Rays::BlendMode
168
168
  value_to<Rays::BlendMode> (int argc, const Value* argv, bool convert)
169
169
  {
170
170
  assert(argc > 0 && argv);
@@ -195,7 +195,7 @@ namespace Rucy
195
195
  }
196
196
 
197
197
 
198
- template <> Rays::TexCoordMode
198
+ template <> RAYS_EXPORT Rays::TexCoordMode
199
199
  value_to<Rays::TexCoordMode> (int argc, const Value* argv, bool convert)
200
200
  {
201
201
  assert(argc > 0 && argv);
@@ -226,7 +226,7 @@ namespace Rucy
226
226
  }
227
227
 
228
228
 
229
- template <> Rays::TexCoordWrap
229
+ template <> RAYS_EXPORT Rays::TexCoordWrap
230
230
  value_to<Rays::TexCoordWrap> (int argc, const Value* argv, bool convert)
231
231
  {
232
232
  assert(argc > 0 && argv);
@@ -6,7 +6,7 @@
6
6
  #include "defs.h"
7
7
 
8
8
 
9
- RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(Rays::Shader)
9
+ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Shader)
10
10
 
11
11
  #define THIS to<Rays::Shader*>(self)
12
12
 
@@ -189,7 +189,7 @@ namespace Rucy
189
189
  {
190
190
 
191
191
 
192
- template <> Rays::Shader
192
+ template <> RAYS_EXPORT Rays::Shader
193
193
  value_to<Rays::Shader> (int argc, const Value* argv, bool convert)
194
194
  {
195
195
  if (argc == 1 && argv->is_array())
@@ -24,7 +24,7 @@ jobs:
24
24
  run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
25
25
 
26
26
  - name: test
27
- run: bundle exec rake quiet test
27
+ run: bundle exec rake quiet packages test
28
28
 
29
29
  - name: create gem
30
30
  id: gem
@@ -24,6 +24,9 @@ jobs:
24
24
  - name: setup dependencies
25
25
  run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
26
26
 
27
+ - name: packages
28
+ run: bundle exec rake packages
29
+
27
30
  - name: lib
28
31
  run: bundle exec rake lib
29
32
 
data/ChangeLog.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # rays ChangeLog
2
2
 
3
3
 
4
+ ## [v0.3] - 2024-07-06
5
+
6
+ - Support Windows
7
+
8
+
4
9
  ## [v0.2.1] - 2024-07-05
5
10
 
6
11
  - Add OpenGL_init() and OpenGL_fin()
data/Rakefile CHANGED
@@ -15,6 +15,8 @@ require 'rays/extension'
15
15
  EXTENSIONS = [Xot, Rucy, Rays]
16
16
  TESTS_ALONE = ['test/test_rays_init.rb']
17
17
 
18
+ install_packages win32: %w[MINGW_PACKAGE_PREFIX-glew]
19
+
18
20
  use_external_library 'https://github.com/g-truc/glm',
19
21
  tag: '0.9.9.8',
20
22
  srcdirs: 'NOSRC'
@@ -32,12 +34,25 @@ use_external_library 'https://github.com/mapbox/earcut.hpp',
32
34
 
33
35
  use_external_library 'https://github.com/andrewwillmott/splines-lib',
34
36
  commit: '11e7240d57b0d22871aec3308186a5fcf915ba77',
35
- excludes: 'Test\.cpp'
37
+ excludes: 'Test\.cpp',
38
+ &proc {
39
+ filter_file('Splines.cpp') do |cpp|
40
+ <<~EOS + cpp
41
+ #include <cstdint>
42
+ EOS
43
+ end
44
+ }
45
+
46
+ if win32?
47
+ use_external_library 'https://github.com/nothings/stb',
48
+ commit: 'ae721c50eaf761660b4f90cc590453cdb0c2acd0',
49
+ srcdirs: 'NOSRC'
50
+ end
36
51
 
37
52
  default_tasks :ext
38
53
  use_bundler
39
54
  build_native_library
40
55
  build_ruby_extension
41
- test_ruby_extension
56
+ test_ruby_extension unless github_actions? && win32?
42
57
  generate_documents
43
58
  build_ruby_gem
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3