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
data/ext/rays/bitmap.cpp CHANGED
@@ -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
 
@@ -323,23 +323,23 @@ set_pixels (Rays::Bitmap* bmp, Value pixels)
323
323
  }
324
324
  }
325
325
 
326
- static inline Value
327
- to_rgb_value (uint8_t r, uint8_t g, uint8_t b)
326
+ static inline uint32_t
327
+ to_rgb (uint8_t r, uint8_t g, uint8_t b)
328
328
  {
329
- return value(
330
- ((uint) r) << 16 |
331
- ((uint) g) << 8 |
332
- ((uint) b));
329
+ return
330
+ ((uint32_t) r) << 16 |
331
+ ((uint32_t) g) << 8 |
332
+ ((uint32_t) b);
333
333
  }
334
334
 
335
- static inline Value
336
- to_argb_value (uint8_t r, uint8_t g, uint8_t b, uint8_t a)
335
+ static inline uint32_t
336
+ to_argb (uint8_t r, uint8_t g, uint8_t b, uint8_t a)
337
337
  {
338
- return value(
339
- ((uint) a) << 24 |
340
- ((uint) r) << 16 |
341
- ((uint) g) << 8 |
342
- ((uint) b));
338
+ return
339
+ ((uint32_t) a) << 24 |
340
+ ((uint32_t) r) << 16 |
341
+ ((uint32_t) g) << 8 |
342
+ ((uint32_t) b);
343
343
  }
344
344
 
345
345
  static void
@@ -398,7 +398,7 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
398
398
  {
399
399
  const auto* p = bmp.at<uint8_t>(0, y);
400
400
  for (int x = 0; x < w; ++x, p += 3)
401
- pixels->push_back(to_rgb_value(p[0], p[1], p[2]));
401
+ pixels->push_back(value(to_rgb(p[0], p[1], p[2])));
402
402
  }
403
403
  break;
404
404
 
@@ -408,7 +408,7 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
408
408
  {
409
409
  const auto* p = bmp.at<uint8_t>(0, y);
410
410
  for (int x = 0; x < w; ++x, p += 4)
411
- pixels->push_back(to_argb_value(p[0], p[1], p[2], p[3]));
411
+ pixels->push_back(value(to_argb(p[0], p[1], p[2], p[3])));
412
412
  }
413
413
  break;
414
414
 
@@ -418,7 +418,7 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
418
418
  {
419
419
  const auto* p = bmp.at<uint8_t>(0, y);
420
420
  for (int x = 0; x < w; ++x, p += 4)
421
- pixels->push_back(to_argb_value(p[1], p[2], p[3], p[0]));
421
+ pixels->push_back(value(to_argb(p[1], p[2], p[3], p[0])));
422
422
  }
423
423
  break;
424
424
 
@@ -427,7 +427,7 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
427
427
  {
428
428
  const auto* p = bmp.at<uint8_t>(0, y);
429
429
  for (int x = 0; x < w; ++x, p += 3)
430
- pixels->push_back(to_rgb_value(p[2], p[1], p[0]));
430
+ pixels->push_back(value(to_rgb(p[2], p[1], p[0])));
431
431
  }
432
432
  break;
433
433
 
@@ -437,7 +437,7 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
437
437
  {
438
438
  const auto* p = bmp.at<uint8_t>(0, y);
439
439
  for (int x = 0; x < w; ++x, p += 4)
440
- pixels->push_back(to_argb_value(p[2], p[1], p[0], p[3]));
440
+ pixels->push_back(value(to_argb(p[2], p[1], p[0], p[3])));
441
441
  }
442
442
  break;
443
443
 
@@ -447,7 +447,7 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
447
447
  {
448
448
  const auto* p = bmp.at<uint8_t>(0, y);
449
449
  for (int x = 0; x < w; ++x, p += 4)
450
- pixels->push_back(to_argb_value(p[3], p[2], p[1], p[0]));
450
+ pixels->push_back(value(to_argb(p[3], p[2], p[1], p[0])));
451
451
  }
452
452
  break;
453
453
 
@@ -538,17 +538,85 @@ get_pixels (auto* pixels, const Rays::Bitmap& bmp)
538
538
  }
539
539
  }
540
540
 
541
- static
542
- RUCY_DEF1(set_pixels, pixels)
541
+ static Value
542
+ get_32bit_pixels_string (const Rays::Bitmap& bmp)
543
543
  {
544
- CHECK;
544
+ // avoid SEGV caused by 32bit argb value on 'x64-mingw-ucrt' platform.
545
+
546
+ const auto& cs = bmp.color_space();
547
+ if (cs.bpp() != 32) return nil();
548
+
549
+ int w = bmp.width(), h = bmp.height();
545
550
 
546
- if (sizeof(VALUE) <= 4)
551
+ std::vector<uint32_t> pixels;
552
+ pixels.reserve(w * h);
553
+
554
+ switch (cs.type())
547
555
  {
548
- not_implemented_error(
549
- __FILE__, __LINE__, "Bitmap#pixels=() does not support 32-bit platforms");
556
+ case Rays::GRAY_32:
557
+ case Rays::ALPHA_32:
558
+ for (int y = 0; y < h; ++y)
559
+ {
560
+ const auto* p = bmp.at<uint32_t>(0, y);
561
+ for (int x = 0; x < w; ++x, ++p)
562
+ pixels.push_back(*p);
563
+ }
564
+ break;
565
+
566
+ case Rays::RGBA_8888:
567
+ case Rays::RGBX_8888:
568
+ for (int y = 0; y < h; ++y)
569
+ {
570
+ const auto* p = bmp.at<uint8_t>(0, y);
571
+ for (int x = 0; x < w; ++x, p += 4)
572
+ pixels.push_back(to_argb(p[0], p[1], p[2], p[3]));
573
+ }
574
+ break;
575
+
576
+ case Rays::ARGB_8888:
577
+ case Rays::XRGB_8888:
578
+ for (int y = 0; y < h; ++y)
579
+ {
580
+ const auto* p = bmp.at<uint8_t>(0, y);
581
+ for (int x = 0; x < w; ++x, p += 4)
582
+ pixels.push_back(to_argb(p[1], p[2], p[3], p[0]));
583
+ }
584
+ break;
585
+
586
+ case Rays::BGRA_8888:
587
+ case Rays::BGRX_8888:
588
+ for (int y = 0; y < h; ++y)
589
+ {
590
+ const auto* p = bmp.at<uint8_t>(0, y);
591
+ for (int x = 0; x < w; ++x, p += 4)
592
+ pixels.push_back(to_argb(p[2], p[1], p[0], p[3]));
593
+ }
594
+ break;
595
+
596
+ case Rays::ABGR_8888:
597
+ case Rays::XBGR_8888:
598
+ for (int y = 0; y < h; ++y)
599
+ {
600
+ const auto* p = bmp.at<uint8_t>(0, y);
601
+ for (int x = 0; x < w; ++x, p += 4)
602
+ pixels.push_back(to_argb(p[3], p[2], p[1], p[0]));
603
+ }
604
+ break;
605
+
606
+ default:
607
+ return nil();
550
608
  }
551
609
 
610
+ return value(
611
+ (const char*) &pixels[0], pixels.size() * sizeof(uint32_t),
612
+ rb_ascii8bit_encoding());
613
+ }
614
+
615
+ static
616
+ RUCY_DEF1(set_pixels, pixels)
617
+ {
618
+ CHECK;
619
+
552
620
  set_pixels(THIS, pixels);
553
621
  return pixels;
554
622
  }
@@ -559,11 +627,10 @@ RUCY_DEF0(get_pixels)
559
627
  {
560
628
  CHECK;
561
629
 
562
- if (sizeof(VALUE) <= 4)
563
- {
564
- not_implemented_error(
565
- __FILE__, __LINE__, "Bitmap#pixels() does not support 32-bit platforms");
566
- }
630
+ #ifdef RAYS_32BIT_PIXELS_STRING
631
+ Value str = get_32bit_pixels_string(*THIS);
632
+ if (str) return str;
633
+ #endif
567
634
 
568
635
  std::vector<VALUE> pixels;
569
636
  get_pixels(&pixels, *THIS);
@@ -613,7 +680,7 @@ Init_rays_bitmap ()
613
680
  cBitmap.define_method("height", height);
614
681
  cBitmap.define_method("color_space", color_space);
615
682
  cBitmap.define_method("pixels=", set_pixels);
616
- cBitmap.define_method("pixels", get_pixels);
683
+ cBitmap.define_method("pixels!", get_pixels);
617
684
  cBitmap.define_method("[]=", set_at);
618
685
  cBitmap.define_method("[]", get_at);
619
686
  }
data/ext/rays/bounds.cpp CHANGED
@@ -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
 
@@ -629,7 +629,7 @@ namespace Rucy
629
629
  {
630
630
 
631
631
 
632
- template <> Rays::Bounds
632
+ template <> RAYS_EXPORT Rays::Bounds
633
633
  value_to<Rays::Bounds> (int argc, const Value* argv, bool convert)
634
634
  {
635
635
  if (argc == 1 && argv->is_array())
data/ext/rays/camera.cpp CHANGED
@@ -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
 
data/ext/rays/color.cpp CHANGED
@@ -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
 
@@ -344,7 +344,7 @@ namespace Rucy
344
344
  return find_color(str_.c_str());
345
345
  }
346
346
 
347
- template <> Rays::Color
347
+ template <> RAYS_EXPORT Rays::Color
348
348
  value_to<Rays::Color> (int argc, const Value*argv, bool convert)
349
349
  {
350
350
  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
 
@@ -219,7 +219,7 @@ namespace Rucy
219
219
  {
220
220
 
221
221
 
222
- template <> Rays::ColorSpace
222
+ template <> RAYS_EXPORT Rays::ColorSpace
223
223
  value_to<Rays::ColorSpace> (int argc, const Value* argv, bool convert)
224
224
  {
225
225
  if (argc == 1 && argv->is_array())
@@ -247,7 +247,7 @@ namespace Rucy
247
247
  }
248
248
 
249
249
 
250
- template <> Rays::ColorSpaceType
250
+ template <> RAYS_EXPORT Rays::ColorSpaceType
251
251
  value_to<Rays::ColorSpaceType> (Value value, bool convert)
252
252
  {
253
253
  if (convert)
data/ext/rays/defs.h CHANGED
@@ -12,6 +12,8 @@
12
12
  #include "rays/ruby/defs.h"
13
13
 
14
14
 
15
+ using namespace Xot::Types;
16
+
15
17
  using namespace Rucy;
16
18
 
17
19
  using Rays::coord;
data/ext/rays/extconf.rb CHANGED
@@ -12,9 +12,11 @@ require 'rays/extension'
12
12
  Xot::ExtConf.new Xot, Rucy, Rays do
13
13
  setup do
14
14
  headers << 'ruby.h'
15
- libs.unshift 'gdi21', 'opengl32' if win32?
15
+ libs.unshift 'gdi32', 'opengl32', 'glew32' if win32?
16
16
  frameworks << 'AppKit' << 'OpenGL' << 'AVFoundation' if osx?
17
- $LDFLAGS << ' -Wl,--out-implib=native.dll.a' if cygwin?
17
+ $LDFLAGS << ' -Wl,--out-implib=native.dll.a' if mingw? || cygwin?
18
+
19
+ $CPPFLAGS << ' -DRAYS_32BIT_PIXELS_STRING' if RUBY_PLATFORM == 'x64-mingw-ucrt'
18
20
  end
19
21
 
20
22
  create_makefile 'rays/native'
data/ext/rays/font.cpp CHANGED
@@ -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
 
@@ -169,7 +169,7 @@ namespace Rucy
169
169
  {
170
170
 
171
171
 
172
- template <> Rays::Font
172
+ template <> RAYS_EXPORT Rays::Font
173
173
  value_to<Rays::Font> (int argc, const Value* argv, bool convert)
174
174
  {
175
175
  if (argc == 1 && argv->is_array())
@@ -185,7 +185,8 @@ namespace Rucy
185
185
  if (argc == 0)
186
186
  return Rays::get_default_font();
187
187
 
188
- coord size = argc >= 2 ? to<coord>(argv[1]) : Rays::Font::DEFAULT_SIZE;
188
+ coord size =
189
+ argc >= 2 ? to<coord>(argv[1]) : (coord) Rays::Font::DEFAULT_SIZE;
189
190
  if (argv->is_nil())
190
191
  return Rays::Font(NULL, size);
191
192
  else if (argv->is_s() || argv->is_sym())
data/ext/rays/image.cpp CHANGED
@@ -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
 
data/ext/rays/matrix.cpp CHANGED
@@ -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
 
@@ -232,10 +232,10 @@ RUCY_DEFN(s_ortho)
232
232
  RUCY_END
233
233
 
234
234
  static
235
- RUCY_DEF4(s_perspective, fov_y, aspect_ratio, near, far)
235
+ RUCY_DEF4(s_perspective, fov_y, aspect_ratio, near_, far_)
236
236
  {
237
237
  return value(Rays::perspective(
238
- to<float>(fov_y), to<float>(aspect_ratio), to<coord>(near), to<coord>(far)));
238
+ to<float>(fov_y), to<float>(aspect_ratio), to<coord>(near_), to<coord>(far_)));
239
239
  }
240
240
  RUCY_END
241
241
 
@@ -301,7 +301,7 @@ namespace Rucy
301
301
  {
302
302
 
303
303
 
304
- template <> Rays::Matrix
304
+ template <> RAYS_EXPORT Rays::Matrix
305
305
  value_to<Rays::Matrix> (int argc, const Value* argv, bool convert)
306
306
  {
307
307
  if (argc == 1 && argv->is_array())
data/ext/rays/painter.cpp CHANGED
@@ -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
 
data/ext/rays/point.cpp CHANGED
@@ -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
 
@@ -299,7 +299,7 @@ namespace Rucy
299
299
  {
300
300
 
301
301
 
302
- template <> Rays::Point
302
+ template <> RAYS_EXPORT Rays::Point
303
303
  value_to<Rays::Point> (int argc, const Value* argv, bool convert)
304
304
  {
305
305
  if (argc == 1 && argv->is_array())
data/ext/rays/polygon.cpp CHANGED
@@ -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
 
@@ -48,7 +48,7 @@ RUCY_DEFN(expand)
48
48
  coord width = to<coord> (argv[0]);
49
49
  Rays::CapType cap = argc >= 2 ? to<Rays::CapType> (argv[1]) : Rays::CAP_DEFAULT;
50
50
  Rays::JoinType join = argc >= 3 ? to<Rays::JoinType>(argv[2]) : Rays::JOIN_DEFAULT;
51
- coord ml = argc >= 4 ? to<coord> (argv[3]) : Rays::JOIN_DEFAULT_MITER_LIMIT;
51
+ coord ml = argc >= 4 ? to<coord> (argv[3]) : (coord) Rays::JOIN_DEFAULT_MITER_LIMIT;
52
52
 
53
53
  Rays::Polygon polygon;
54
54
  THIS->expand(&polygon, width, cap, join, ml);
@@ -400,7 +400,7 @@ namespace Rucy
400
400
  {
401
401
 
402
402
 
403
- template <> Rays::Polygon
403
+ template <> RAYS_EXPORT Rays::Polygon
404
404
  value_to<Rays::Polygon> (int argc, const Value* argv, bool convert)
405
405
  {
406
406
  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
 
@@ -46,7 +46,7 @@ RUCY_DEFN(expand)
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);
@@ -222,7 +222,7 @@ namespace Rucy
222
222
  {
223
223
 
224
224
 
225
- template <> Rays::Polyline
225
+ template <> RAYS_EXPORT Rays::Polyline
226
226
  value_to<Rays::Polyline> (int argc, const Value* argv, bool convert)
227
227
  {
228
228
  assert(argc == 0 || (argc > 0 && argv));
data/ext/rays/rays.cpp CHANGED
@@ -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>
@@ -104,7 +104,7 @@ namespace Rucy
104
104
  {
105
105
 
106
106
 
107
- template <> Rays::CapType
107
+ template <> RAYS_EXPORT Rays::CapType
108
108
  value_to<Rays::CapType> (int argc, const Value* argv, bool convert)
109
109
  {
110
110
  assert(argc > 0 && argv);
@@ -135,7 +135,7 @@ namespace Rucy
135
135
  }
136
136
 
137
137
 
138
- template <> Rays::JoinType
138
+ template <> RAYS_EXPORT Rays::JoinType
139
139
  value_to<Rays::JoinType> (int argc, const Value* argv, bool convert)
140
140
  {
141
141
  assert(argc > 0 && argv);
@@ -166,7 +166,7 @@ namespace Rucy
166
166
  }
167
167
 
168
168
 
169
- template <> Rays::BlendMode
169
+ template <> RAYS_EXPORT Rays::BlendMode
170
170
  value_to<Rays::BlendMode> (int argc, const Value* argv, bool convert)
171
171
  {
172
172
  assert(argc > 0 && argv);
@@ -197,7 +197,7 @@ namespace Rucy
197
197
  }
198
198
 
199
199
 
200
- template <> Rays::TexCoordMode
200
+ template <> RAYS_EXPORT Rays::TexCoordMode
201
201
  value_to<Rays::TexCoordMode> (int argc, const Value* argv, bool convert)
202
202
  {
203
203
  assert(argc > 0 && argv);
@@ -228,7 +228,7 @@ namespace Rucy
228
228
  }
229
229
 
230
230
 
231
- template <> Rays::TexCoordWrap
231
+ template <> RAYS_EXPORT Rays::TexCoordWrap
232
232
  value_to<Rays::TexCoordWrap> (int argc, const Value* argv, bool convert)
233
233
  {
234
234
  assert(argc > 0 && argv);
data/ext/rays/shader.cpp CHANGED
@@ -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
 
@@ -194,7 +194,7 @@ namespace Rucy
194
194
  {
195
195
 
196
196
 
197
- template <> Rays::Shader
197
+ template <> RAYS_EXPORT Rays::Shader
198
198
  value_to<Rays::Shader> (int argc, const Value* argv, bool convert)
199
199
  {
200
200
  if (argc == 1 && argv->is_array())
data/include/rays/defs.h CHANGED
@@ -11,6 +11,13 @@
11
11
  #include <xot/string.h>
12
12
 
13
13
 
14
+ #if defined(WIN32) && defined(GCC) && defined(RAYS)
15
+ #define RAYS_EXPORT __declspec(dllexport)
16
+ #else
17
+ #define RAYS_EXPORT
18
+ #endif
19
+
20
+
14
21
  namespace Rays
15
22
  {
16
23
 
@@ -9,14 +9,14 @@
9
9
  #include <rays/bitmap.h>
10
10
 
11
11
 
12
- RUCY_DECLARE_VALUE_FROM_TO(Rays::Bitmap)
12
+ RUCY_DECLARE_VALUE_FROM_TO(RAYS_EXPORT, Rays::Bitmap)
13
13
 
14
14
 
15
15
  namespace Rays
16
16
  {
17
17
 
18
18
 
19
- Rucy::Class bitmap_class ();
19
+ RAYS_EXPORT Rucy::Class bitmap_class ();
20
20
  // class Rays::Bitmap
21
21
 
22
22
 
@@ -10,14 +10,14 @@
10
10
  #include <rays/ruby/point.h>
11
11
 
12
12
 
13
- RUCY_DECLARE_VALUE_OR_ARRAY_FROM_TO(Rays::Bounds)
13
+ RUCY_DECLARE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Bounds)
14
14
 
15
15
 
16
16
  namespace Rays
17
17
  {
18
18
 
19
19
 
20
- Rucy::Class bounds_class ();
20
+ RAYS_EXPORT Rucy::Class bounds_class ();
21
21
  // class Rays::Bounds
22
22
 
23
23
 
@@ -9,14 +9,14 @@
9
9
  #include <rays/camera.h>
10
10
 
11
11
 
12
- RUCY_DECLARE_VALUE_FROM_TO(Rays::Camera)
12
+ RUCY_DECLARE_VALUE_FROM_TO(RAYS_EXPORT, Rays::Camera)
13
13
 
14
14
 
15
15
  namespace Rays
16
16
  {
17
17
 
18
18
 
19
- Rucy::Class camera_class ();
19
+ RAYS_EXPORT Rucy::Class camera_class ();
20
20
  // class Rays::Camera
21
21
 
22
22
 
@@ -9,14 +9,14 @@
9
9
  #include <rays/color.h>
10
10
 
11
11
 
12
- RUCY_DECLARE_VALUE_OR_ARRAY_FROM_TO(Rays::Color)
12
+ RUCY_DECLARE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Color)
13
13
 
14
14
 
15
15
  namespace Rays
16
16
  {
17
17
 
18
18
 
19
- Rucy::Class color_class ();
19
+ RAYS_EXPORT Rucy::Class color_class ();
20
20
  // class Rays::Color
21
21
 
22
22
 
@@ -9,14 +9,14 @@
9
9
  #include <rays/color_space.h>
10
10
 
11
11
 
12
- RUCY_DECLARE_VALUE_OR_ARRAY_FROM_TO(Rays::ColorSpace)
12
+ RUCY_DECLARE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::ColorSpace)
13
13
 
14
14
 
15
15
  namespace Rays
16
16
  {
17
17
 
18
18
 
19
- Rucy::Class color_space_class ();
19
+ RAYS_EXPORT Rucy::Class color_space_class ();
20
20
  // class Rays::ColorSpace
21
21
 
22
22
 
@@ -12,13 +12,13 @@ namespace Rays
12
12
  {
13
13
 
14
14
 
15
- Rucy::Class rays_error_class ();
15
+ RAYS_EXPORT Rucy::Class rays_error_class ();
16
16
  // class Rays::RaysError
17
17
 
18
- Rucy::Class opengl_error_class ();
18
+ RAYS_EXPORT Rucy::Class opengl_error_class ();
19
19
  // class Rays::OpenGLError
20
20
 
21
- Rucy::Class shader_error_class ();
21
+ RAYS_EXPORT Rucy::Class shader_error_class ();
22
22
  // class Rays::ShaderError
23
23
 
24
24
 
@@ -9,14 +9,14 @@
9
9
  #include <rays/font.h>
10
10
 
11
11
 
12
- RUCY_DECLARE_VALUE_OR_ARRAY_FROM_TO(Rays::Font)
12
+ RUCY_DECLARE_VALUE_OR_ARRAY_FROM_TO(RAYS_EXPORT, Rays::Font)
13
13
 
14
14
 
15
15
  namespace Rays
16
16
  {
17
17
 
18
18
 
19
- Rucy::Class font_class ();
19
+ RAYS_EXPORT Rucy::Class font_class ();
20
20
  // class Rays::Font
21
21
 
22
22