rays 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +5 -5
  2. data/.doc/ext/rays/bitmap.cpp +22 -76
  3. data/.doc/ext/rays/bounds.cpp +95 -125
  4. data/.doc/ext/rays/color.cpp +224 -45
  5. data/.doc/ext/rays/color_space.cpp +137 -45
  6. data/.doc/ext/rays/defs.cpp +183 -0
  7. data/.doc/ext/rays/font.cpp +39 -21
  8. data/.doc/ext/rays/image.cpp +26 -37
  9. data/.doc/ext/rays/matrix.cpp +186 -29
  10. data/.doc/ext/rays/native.cpp +12 -6
  11. data/.doc/ext/rays/noise.cpp +53 -0
  12. data/.doc/ext/rays/painter.cpp +120 -308
  13. data/.doc/ext/rays/point.cpp +82 -77
  14. data/.doc/ext/rays/polygon.cpp +287 -0
  15. data/.doc/ext/rays/polygon_line.cpp +96 -0
  16. data/.doc/ext/rays/polyline.cpp +161 -0
  17. data/.doc/ext/rays/rays.cpp +0 -13
  18. data/.doc/ext/rays/shader.cpp +83 -9
  19. data/README.md +1 -1
  20. data/Rakefile +21 -9
  21. data/VERSION +1 -1
  22. data/ext/rays/bitmap.cpp +22 -80
  23. data/ext/rays/bounds.cpp +100 -128
  24. data/ext/rays/color.cpp +232 -51
  25. data/ext/rays/color_space.cpp +140 -46
  26. data/ext/rays/defs.cpp +183 -0
  27. data/ext/rays/defs.h +26 -2
  28. data/ext/rays/extconf.rb +1 -2
  29. data/ext/rays/font.cpp +39 -22
  30. data/ext/rays/image.cpp +27 -39
  31. data/ext/rays/matrix.cpp +198 -30
  32. data/ext/rays/native.cpp +12 -6
  33. data/ext/rays/noise.cpp +55 -0
  34. data/ext/rays/painter.cpp +129 -315
  35. data/ext/rays/point.cpp +89 -81
  36. data/ext/rays/polygon.cpp +301 -0
  37. data/ext/rays/polygon_line.cpp +99 -0
  38. data/ext/rays/polyline.cpp +170 -0
  39. data/ext/rays/rays.cpp +0 -14
  40. data/ext/rays/shader.cpp +84 -9
  41. data/include/rays.h +10 -2
  42. data/include/rays/bitmap.h +14 -26
  43. data/include/rays/bounds.h +21 -4
  44. data/include/rays/color.h +25 -14
  45. data/include/rays/color_space.h +11 -8
  46. data/include/rays/coord.h +114 -0
  47. data/include/rays/debug.h +22 -0
  48. data/include/rays/defs.h +3 -0
  49. data/include/rays/font.h +4 -4
  50. data/include/rays/image.h +11 -17
  51. data/include/rays/matrix.h +50 -24
  52. data/include/rays/noise.h +42 -0
  53. data/include/rays/opengl.h +2 -50
  54. data/include/rays/painter.h +57 -99
  55. data/include/rays/point.h +44 -51
  56. data/include/rays/polygon.h +164 -0
  57. data/include/rays/polyline.h +65 -0
  58. data/include/rays/rays.h +3 -0
  59. data/include/rays/ruby.h +7 -1
  60. data/include/rays/ruby/bounds.h +1 -1
  61. data/include/rays/ruby/color.h +1 -1
  62. data/include/rays/ruby/color_space.h +1 -1
  63. data/include/rays/ruby/font.h +1 -1
  64. data/include/rays/ruby/matrix.h +1 -1
  65. data/include/rays/ruby/point.h +1 -1
  66. data/include/rays/ruby/polygon.h +52 -0
  67. data/include/rays/ruby/polyline.h +41 -0
  68. data/include/rays/ruby/shader.h +1 -1
  69. data/include/rays/shader.h +36 -8
  70. data/lib/rays.rb +6 -1
  71. data/lib/rays/bitmap.rb +0 -15
  72. data/lib/rays/bounds.rb +17 -23
  73. data/lib/rays/color.rb +20 -47
  74. data/lib/rays/color_space.rb +13 -13
  75. data/lib/rays/image.rb +2 -6
  76. data/lib/rays/matrix.rb +28 -0
  77. data/lib/rays/module.rb +4 -19
  78. data/lib/rays/painter.rb +60 -97
  79. data/lib/rays/point.rb +13 -21
  80. data/lib/rays/polygon.rb +50 -0
  81. data/lib/rays/polygon_line.rb +36 -0
  82. data/lib/rays/polyline.rb +32 -0
  83. data/lib/rays/shader.rb +20 -1
  84. data/rays.gemspec +5 -7
  85. data/src/bitmap.h +36 -0
  86. data/src/bounds.cpp +74 -11
  87. data/src/color.cpp +58 -23
  88. data/src/color_space.cpp +50 -32
  89. data/src/color_space.h +22 -0
  90. data/src/coord.cpp +170 -0
  91. data/src/coord.h +35 -0
  92. data/src/font.cpp +118 -0
  93. data/src/font.h +64 -0
  94. data/src/frame_buffer.cpp +37 -71
  95. data/src/frame_buffer.h +4 -4
  96. data/src/image.cpp +171 -97
  97. data/src/image.h +25 -0
  98. data/src/ios/bitmap.mm +107 -105
  99. data/src/ios/font.mm +48 -60
  100. data/src/ios/helper.h +2 -2
  101. data/src/ios/opengl.mm +19 -4
  102. data/src/ios/rays.mm +3 -0
  103. data/src/matrix.cpp +111 -26
  104. data/src/matrix.h +30 -0
  105. data/src/noise.cpp +74 -0
  106. data/src/opengl.cpp +9 -27
  107. data/src/opengl.h +37 -0
  108. data/src/osx/bitmap.mm +111 -106
  109. data/src/osx/font.mm +48 -61
  110. data/src/osx/helper.h +2 -2
  111. data/src/osx/opengl.mm +19 -83
  112. data/src/osx/rays.mm +3 -0
  113. data/src/painter.cpp +780 -696
  114. data/src/painter.h +24 -0
  115. data/src/point.cpp +140 -119
  116. data/src/polygon.cpp +1100 -0
  117. data/src/polygon.h +32 -0
  118. data/src/polyline.cpp +158 -0
  119. data/src/polyline.h +67 -0
  120. data/src/render_buffer.cpp +11 -4
  121. data/src/render_buffer.h +2 -2
  122. data/src/shader.cpp +163 -106
  123. data/src/shader.h +38 -0
  124. data/src/shader_program.cpp +533 -0
  125. data/src/{program.h → shader_program.h} +28 -16
  126. data/src/shader_source.cpp +140 -0
  127. data/src/shader_source.h +52 -0
  128. data/src/texture.cpp +136 -160
  129. data/src/texture.h +65 -0
  130. data/src/win32/bitmap.cpp +62 -52
  131. data/src/win32/font.cpp +11 -13
  132. data/src/win32/font.h +24 -0
  133. data/src/win32/gdi.h +6 -6
  134. data/test/helper.rb +0 -3
  135. data/test/test_bitmap.rb +31 -7
  136. data/test/test_bounds.rb +36 -0
  137. data/test/test_color.rb +59 -19
  138. data/test/test_color_space.rb +95 -0
  139. data/test/test_image.rb +24 -20
  140. data/test/test_matrix.rb +106 -0
  141. data/test/test_painter.rb +92 -46
  142. data/test/test_painter_shape.rb +57 -0
  143. data/test/test_point.rb +21 -0
  144. data/test/test_polygon.rb +234 -0
  145. data/test/test_polygon_line.rb +167 -0
  146. data/test/test_polyline.rb +145 -0
  147. data/test/test_shader.rb +9 -9
  148. metadata +88 -67
  149. data/.doc/ext/rays/texture.cpp +0 -138
  150. data/ext/rays/texture.cpp +0 -149
  151. data/include/rays/ruby/texture.h +0 -41
  152. data/include/rays/texture.h +0 -71
  153. data/lib/rays/texture.rb +0 -24
  154. data/src/program.cpp +0 -648
  155. data/test/test_texture.rb +0 -27
@@ -0,0 +1,183 @@
1
+ #include "defs.h"
2
+
3
+
4
+ #include <assert.h>
5
+ #include "rays/ruby/bounds.h"
6
+ #include "rays/ruby/point.h"
7
+
8
+
9
+ void
10
+ get_line_args (std::vector<Rays::Point>* points, int argc, const Value* argv)
11
+ {
12
+ assert(points && argv);
13
+
14
+ points->clear();
15
+
16
+ if (argc <= 0)
17
+ return;
18
+
19
+ if (argv[0].is_num())
20
+ {
21
+ if (argc % 2 != 0)
22
+ argument_error(__FILE__, __LINE__);
23
+
24
+ points->reserve(argc / 2);
25
+ for (int i = 0; i < argc; i += 2)
26
+ {
27
+ coord x = to<coord>(argv[i + 0]);
28
+ coord y = to<coord>(argv[i + 1]);
29
+ points->emplace_back(Rays::Point(x, y));
30
+ }
31
+ }
32
+ else
33
+ {
34
+ points->reserve(argc);
35
+ for (int i = 0; i < argc; ++i)
36
+ points->emplace_back(to<Rays::Point>(argv[i]));
37
+ }
38
+ }
39
+
40
+ static uint
41
+ get_nsegment (Value nsegment)
42
+ {
43
+ int value = nsegment ? to<int>(nsegment) : 0;
44
+ if (value < 0) value = 0;
45
+ return (uint) value;
46
+ }
47
+
48
+ void get_rect_args (
49
+ coord* x, coord* y, coord* w, coord* h,
50
+ coord* lt, coord* rt, coord* lb, coord* rb,
51
+ uint* nseg,
52
+ int argc, const Value* argv,
53
+ Value round, Value lefttop, Value righttop, Value leftbottom, Value rightbottom,
54
+ Value nsegment)
55
+ {
56
+ assert(x && y && w && h && lt && rt && lb && rb && nseg && argv);
57
+
58
+ if (argc <= 0)
59
+ argument_error(__FILE__, __LINE__);
60
+
61
+ if (argv[0].is_kind_of(Rays::bounds_class()))
62
+ {
63
+ Rays::Bounds& b = to<Rays::Bounds&>(argv[0]);
64
+ *x = b.x;
65
+ *y = b.y;
66
+ *w = b.w;
67
+ *h = b.h;
68
+ *lt = argc >= 2 ? to<coord>(argv[1]) : 0;
69
+ *rt = argc >= 3 ? to<coord>(argv[2]) : *lt;
70
+ *lb = argc >= 4 ? to<coord>(argv[3]) : *lt;
71
+ *rb = argc >= 5 ? to<coord>(argv[4]) : *lt;
72
+ }
73
+ else if (argv[0].is_kind_of(Rays::point_class()))
74
+ {
75
+ if (argc < 2)
76
+ argument_error(__FILE__, __LINE__);
77
+
78
+ Rays::Point& p = to<Rays::Point&>(argv[0]);
79
+ *x = p.x;
80
+ *y = p.y;
81
+ *w = to<coord>(argv[1]);
82
+ *h = argc >= 3 ? to<coord>(argv[2]) : *w;
83
+ *lt = argc >= 4 ? to<coord>(argv[3]) : 0;
84
+ *rt = argc >= 5 ? to<coord>(argv[4]) : *lt;
85
+ *lb = argc >= 6 ? to<coord>(argv[5]) : *lt;
86
+ *rb = argc >= 7 ? to<coord>(argv[6]) : *lt;
87
+ }
88
+ else if (argc <= 2)
89
+ {
90
+ *x = *y = *lt = *rt = *lb = *rb = 0;
91
+ *w = to<coord>(argv[0]);
92
+ *h = argc >= 2 ? to<coord>(argv[1]) : *w;
93
+ }
94
+ else
95
+ {
96
+ *x = to<coord>(argv[0]);
97
+ *y = to<coord>(argv[1]);
98
+ *w = to<coord>(argv[2]);
99
+ *h = argc >= 4 ? to<coord>(argv[3]) : *w;
100
+ *lt = argc >= 5 ? to<coord>(argv[4]) : 0;
101
+ *rt = argc >= 6 ? to<coord>(argv[5]) : *lt;
102
+ *lb = argc >= 7 ? to<coord>(argv[6]) : *lt;
103
+ *rb = argc >= 8 ? to<coord>(argv[7]) : *lt;
104
+ }
105
+
106
+ if (! lefttop) lefttop = round;
107
+ if (!righttop) righttop = round;
108
+ if (! leftbottom) leftbottom = round;
109
+ if (!rightbottom) rightbottom = round;
110
+
111
+ if ( lefttop) *lt = to<coord>( lefttop);
112
+ if (righttop) *rt = to<coord>(righttop);
113
+ if ( leftbottom) *lb = to<coord>( leftbottom);
114
+ if (rightbottom) *rb = to<coord>(rightbottom);
115
+
116
+ *nseg = get_nsegment(nsegment);
117
+ }
118
+
119
+ void get_ellipse_args (
120
+ coord* x, coord* y, coord* w, coord* h,
121
+ Rays::Point* hole_size, float* from, float* to_,
122
+ uint* nseg,
123
+ int argc, const Value* argv,
124
+ Value center, Value radius, Value hole, Value angle_from, Value angle_to,
125
+ Value nsegment)
126
+ {
127
+ assert(x && y && w && h && hole_size && from && to_ && nseg && argv);
128
+
129
+ if (argc <= 0)
130
+ argument_error(__FILE__, __LINE__);
131
+
132
+ if (argv[0].is_kind_of(Rays::bounds_class()))
133
+ {
134
+ const Rays::Bounds& b = to<Rays::Bounds&>(argv[0]);
135
+ *x = b.x;
136
+ *y = b.y;
137
+ *w = b.w;
138
+ *h = b.h;
139
+ }
140
+ else if (argv[0].is_kind_of(Rays::point_class()))
141
+ {
142
+ if (argc < 2)
143
+ argument_error(__FILE__, __LINE__);
144
+
145
+ const Rays::Point& p = to<Rays::Point&>(argv[0]);
146
+ *x = p.x;
147
+ *y = p.y;
148
+ *w = to<coord>(argv[1]);
149
+ *h = argc >= 3 ? to<coord>(argv[2]) : *w;
150
+ }
151
+ else if (argc <= 2)
152
+ {
153
+ *x = *y = 0;
154
+ *w = to<coord>(argv[0]);
155
+ *h = argc >= 2 ? to<coord>(argv[1]) : *w;
156
+ }
157
+ else
158
+ {
159
+ *x = to<coord>(argv[0]);
160
+ *y = to<coord>(argv[1]);
161
+ *w = to<coord>(argv[2]);
162
+ *h = argc >= 4 ? to<coord>(argv[3]) : *w;
163
+ }
164
+
165
+ if (center)
166
+ {
167
+ Rays::Point p = to<Rays::Point>(center);
168
+ *x = p.x;
169
+ *y = p.y;
170
+ }
171
+
172
+ if (radius)
173
+ {
174
+ Rays::Point p = to<Rays::Point>(radius);
175
+ *w = p.x * 2;
176
+ *h = p.y * 2;
177
+ }
178
+
179
+ *hole_size = hole ? to<Rays::Point>(hole) : 0;
180
+ *from = angle_from ? to<float>(angle_from) : 0;
181
+ *to_ = angle_to ? to<float>(angle_to) : 360;
182
+ *nseg = get_nsegment(nsegment);
183
+ }
@@ -4,10 +4,34 @@
4
4
  #define __RAYS_EXT_DEFS_H__
5
5
 
6
6
 
7
- #include <rays/exception.h>
7
+ #include <vector>
8
+ #include <rucy.h>
9
+ #include <rays/defs.h>
10
+ #include <rays/point.h>
8
11
 
9
12
 
10
- using Rays::rays_error;
13
+ using namespace Rucy;
14
+
15
+ using Rays::coord;
16
+
17
+
18
+ void get_line_args (
19
+ std::vector<Rays::Point>* points,
20
+ int argc, const Value* argv);
21
+
22
+ void get_rect_args (
23
+ coord* x, coord* y, coord* w, coord* h,
24
+ coord* lt, coord* rt, coord* lb, coord* rb, uint* nseg,
25
+ int argc, const Value* argv,
26
+ Value round, Value lefttop, Value righttop, Value leftbottom, Value rightbottom,
27
+ Value nsegment);
28
+
29
+ void get_ellipse_args (
30
+ coord* x, coord* y, coord* w, coord* h,
31
+ Rays::Point* hole_size, float* from, float* to, uint* nseg,
32
+ int argc, const Value* argv,
33
+ Value center, Value radius, Value hole, Value angel_from, Value angle_to,
34
+ Value nsegment);
11
35
 
12
36
 
13
37
  #endif//EOH
@@ -14,13 +14,12 @@ require 'rays/module'
14
14
 
15
15
  Xot::ExtConf.new Xot, Rucy, Rays do
16
16
  setup do
17
- headers << 'boost/noncopyable.hpp' << 'ruby.h'
17
+ headers << 'ruby.h'
18
18
  local_libs << 'rucy'
19
19
  libs.unshift 'gdi21', 'opengl32' if win32?
20
20
  frameworks << 'AppKit' << 'OpenGL' if osx?
21
21
  $LDFLAGS << ' -Wl,--out-implib=native.dll.a' if cygwin?
22
22
  end
23
23
 
24
- dir_config 'boost'
25
24
  create_makefile 'rays/native'
26
25
  end
@@ -1,16 +1,10 @@
1
1
  #include "rays/ruby/font.h"
2
2
 
3
3
 
4
- #include <rucy.h>
5
4
  #include "defs.h"
6
5
 
7
6
 
8
- using namespace Rucy;
9
-
10
- using Rays::coord;
11
-
12
-
13
- RUCY_DEFINE_VALUE_FROM_TO(Rays::Font)
7
+ RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(Rays::Font)
14
8
 
15
9
  #define THIS to<Rays::Font*>(self)
16
10
 
@@ -30,20 +24,7 @@ RUCY_DEFN(initialize)
30
24
  RUCY_CHECK_OBJ(Rays::Font, self);
31
25
  check_arg_count(__FILE__, __LINE__, "Font#initialize", argc, 0, 1, 2);
32
26
 
33
- const char* name = (argc >= 1) ? argv[0].c_str() : NULL;
34
- float size = (argc >= 2) ? to<float>(argv[1]) : 0;
35
- *THIS = Rays::Font(name, size);
36
-
37
- return self;
38
- }
39
- RUCY_END
40
-
41
- static
42
- RUCY_DEF1(initialize_copy, obj)
43
- {
44
- RUCY_CHECK_OBJ(Rays::Font, self);
45
-
46
- *THIS = to<Rays::Font&>(obj).copy();
27
+ *THIS = to<Rays::Font>(argc, argv);
47
28
  return self;
48
29
  }
49
30
  RUCY_END
@@ -91,7 +72,6 @@ Init_font ()
91
72
  cFont = mRays.define_class("Font");
92
73
  cFont.define_alloc_func(alloc);
93
74
  cFont.define_private_method("initialize", initialize);
94
- cFont.define_private_method("initialize_copy", initialize_copy);
95
75
  cFont.define_method("name", name);
96
76
  cFont.define_method("size", size);
97
77
  cFont.define_method("width", width);
@@ -99,6 +79,43 @@ Init_font ()
99
79
  }
100
80
 
101
81
 
82
+ namespace Rucy
83
+ {
84
+
85
+
86
+ template <> Rays::Font
87
+ value_to<Rays::Font> (int argc, const Value* argv, bool convert)
88
+ {
89
+ if (argc == 1 && argv->is_array())
90
+ {
91
+ argc = argv->size();
92
+ argv = argv->as_array();
93
+ }
94
+
95
+ assert(argc == 0 || (argc > 0 && argv));
96
+
97
+ if (convert)
98
+ {
99
+ if (argc == 0)
100
+ return Rays::default_font();
101
+
102
+ coord size = argc >= 2 ? to<coord>(argv[1]) : 0;
103
+ if (argv->is_nil())
104
+ return Rays::Font(NULL, size);
105
+ else if (argv->is_s() || argv->is_sym())
106
+ return Rays::Font(argv[0].c_str(), size);
107
+ }
108
+
109
+ if (argc != 1)
110
+ argument_error(__FILE__, __LINE__);
111
+
112
+ return value_to<Rays::Font&>(*argv, convert);
113
+ }
114
+
115
+
116
+ }// Rucy
117
+
118
+
102
119
  namespace Rays
103
120
  {
104
121
 
@@ -1,19 +1,12 @@
1
1
  #include "rays/ruby/image.h"
2
2
 
3
3
 
4
- #include <rucy.h>
5
4
  #include "rays/ruby/color_space.h"
6
5
  #include "rays/ruby/bitmap.h"
7
- #include "rays/ruby/texture.h"
8
6
  #include "rays/ruby/painter.h"
9
7
  #include "defs.h"
10
8
 
11
9
 
12
- using namespace Rucy;
13
-
14
- using Rays::coord;
15
-
16
-
17
10
  RUCY_DEFINE_VALUE_FROM_TO(Rays::Image)
18
11
 
19
12
  #define THIS to<Rays::Image*>(self)
@@ -32,26 +25,28 @@ static
32
25
  RUCY_DEFN(initialize)
33
26
  {
34
27
  RUCY_CHECK_OBJ(Rays::Image, self);
35
- check_arg_count(__FILE__, __LINE__, "Image#initialize", argc, 1, 2, 3);
36
-
37
- if (argc == 0) return self;
28
+ check_arg_count(__FILE__, __LINE__, "Image#initialize", argc, 1, 2, 3, 4);
38
29
 
39
30
  if (argv[0].is_kind_of(Rays::bitmap_class()))
40
31
  {
41
32
  check_arg_count(__FILE__, __LINE__, "Image#initialize", argc, 1, 2);
42
33
 
43
34
  const Rays::Bitmap* bitmap = to<Rays::Bitmap*>(argv[0]);
44
- if (!bitmap) argument_error(__FILE__, __LINE__);
35
+ if (!bitmap)
36
+ argument_error(__FILE__, __LINE__);
45
37
 
46
- bool alpha_only = (argc == 2) ? to<bool>(argv[1]) : false;
47
- *THIS = Rays::Image(*bitmap, alpha_only);
38
+ float pixel_density = (argc >= 2) ? to<float>(argv[1]) : 1;
39
+ *THIS = Rays::Image(*bitmap, pixel_density);
48
40
  }
49
41
  else
50
42
  {
51
- int width = to<int>(argv[0]);
52
- int height = to<int>(argv[1]);
53
- uint colorspace = (argc == 3) ? to<uint>(argv[2]) : (uint) Rays::RGBA;
54
- *THIS = Rays::Image(width, height, (Rays::ColorSpaceType) colorspace);
43
+ check_arg_count(__FILE__, __LINE__, "Image#initialize", argc, 2, 3, 4);
44
+
45
+ int width = to<int>(argv[0]);
46
+ int height = to<int>(argv[1]);
47
+ Rays::ColorSpace cs = (argc >= 3) ? to<Rays::ColorSpace>(argv[2]) : Rays::RGBA;
48
+ float pixel_density = (argc >= 4) ? to<float>(argv[3]) : 1;
49
+ *THIS = Rays::Image(width, height, cs, pixel_density);
55
50
  }
56
51
 
57
52
  return self;
@@ -63,19 +58,11 @@ RUCY_DEF1(initialize_copy, obj)
63
58
  {
64
59
  RUCY_CHECK_OBJ(Rays::Image, self);
65
60
 
66
- *THIS = to<Rays::Image&>(obj).copy();
61
+ *THIS = to<Rays::Image&>(obj).dup();
67
62
  return self;
68
63
  }
69
64
  RUCY_END
70
65
 
71
- static
72
- RUCY_DEF0(painter)
73
- {
74
- CHECK;
75
- return value(THIS->painter());
76
- }
77
- RUCY_END
78
-
79
66
  static
80
67
  RUCY_DEF0(width)
81
68
  {
@@ -101,26 +88,26 @@ RUCY_DEF0(color_space)
101
88
  RUCY_END
102
89
 
103
90
  static
104
- RUCY_DEF0(alpha_only)
91
+ RUCY_DEF0(pixel_density)
105
92
  {
106
93
  CHECK;
107
- return value(THIS->alpha_only());
94
+ return value(THIS->pixel_density());
108
95
  }
109
96
  RUCY_END
110
97
 
111
98
  static
112
- RUCY_DEF0(bitmap)
99
+ RUCY_DEF0(painter)
113
100
  {
114
101
  CHECK;
115
- return value(THIS->bitmap());
102
+ return value(THIS->painter());
116
103
  }
117
104
  RUCY_END
118
105
 
119
106
  static
120
- RUCY_DEF0(texture)
107
+ RUCY_DEF0(bitmap)
121
108
  {
122
109
  CHECK;
123
- return value(THIS->texture());
110
+ return value(THIS->bitmap());
124
111
  }
125
112
  RUCY_END
126
113
 
@@ -135,9 +122,11 @@ RUCY_END
135
122
 
136
123
 
137
124
  static
138
- RUCY_DEF2(load, path, alpha_only)
125
+ RUCY_DEFN(load)
139
126
  {
140
- return value(Rays::load_image(path.c_str(), to<bool>(alpha_only)));
127
+ check_arg_count(__FILE__, __LINE__, "Image.load", argc, 1);
128
+
129
+ return value(Rays::load_image(argv[0].c_str()));
141
130
  }
142
131
  RUCY_END
143
132
 
@@ -151,17 +140,16 @@ Init_image ()
151
140
 
152
141
  cImage = mRays.define_class("Image");
153
142
  cImage.define_alloc_func(alloc);
154
- cImage.define_private_method("initialize", initialize);
143
+ cImage.define_private_method("initialize", initialize);
155
144
  cImage.define_private_method("initialize_copy", initialize_copy);
156
- cImage.define_method("painter", painter);
157
145
  cImage.define_method("width", width);
158
146
  cImage.define_method("height", height);
159
147
  cImage.define_method("color_space", color_space);
160
- cImage.define_method("alpha_only", alpha_only);
148
+ cImage.define_method("pixel_density", pixel_density);
149
+ cImage.define_method("painter", painter);
161
150
  cImage.define_method("bitmap", bitmap);
162
- cImage.define_method("texture", texture);
163
151
  cImage.define_method("save", save);
164
- cImage.define_function("load_image", load);
152
+ cImage.define_function("load", load);
165
153
  }
166
154
 
167
155