rays 0.1.12 → 0.1.13
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 +5 -5
- data/.doc/ext/rays/bitmap.cpp +22 -76
- data/.doc/ext/rays/bounds.cpp +95 -125
- data/.doc/ext/rays/color.cpp +224 -45
- data/.doc/ext/rays/color_space.cpp +137 -45
- data/.doc/ext/rays/defs.cpp +183 -0
- data/.doc/ext/rays/font.cpp +39 -21
- data/.doc/ext/rays/image.cpp +26 -37
- data/.doc/ext/rays/matrix.cpp +186 -29
- data/.doc/ext/rays/native.cpp +12 -6
- data/.doc/ext/rays/noise.cpp +53 -0
- data/.doc/ext/rays/painter.cpp +120 -308
- data/.doc/ext/rays/point.cpp +82 -77
- data/.doc/ext/rays/polygon.cpp +287 -0
- data/.doc/ext/rays/polygon_line.cpp +96 -0
- data/.doc/ext/rays/polyline.cpp +161 -0
- data/.doc/ext/rays/rays.cpp +0 -13
- data/.doc/ext/rays/shader.cpp +83 -9
- data/README.md +1 -1
- data/Rakefile +21 -9
- data/VERSION +1 -1
- data/ext/rays/bitmap.cpp +22 -80
- data/ext/rays/bounds.cpp +100 -128
- data/ext/rays/color.cpp +232 -51
- data/ext/rays/color_space.cpp +140 -46
- data/ext/rays/defs.cpp +183 -0
- data/ext/rays/defs.h +26 -2
- data/ext/rays/extconf.rb +1 -2
- data/ext/rays/font.cpp +39 -22
- data/ext/rays/image.cpp +27 -39
- data/ext/rays/matrix.cpp +198 -30
- data/ext/rays/native.cpp +12 -6
- data/ext/rays/noise.cpp +55 -0
- data/ext/rays/painter.cpp +129 -315
- data/ext/rays/point.cpp +89 -81
- data/ext/rays/polygon.cpp +301 -0
- data/ext/rays/polygon_line.cpp +99 -0
- data/ext/rays/polyline.cpp +170 -0
- data/ext/rays/rays.cpp +0 -14
- data/ext/rays/shader.cpp +84 -9
- data/include/rays.h +10 -2
- data/include/rays/bitmap.h +14 -26
- data/include/rays/bounds.h +21 -4
- data/include/rays/color.h +25 -14
- data/include/rays/color_space.h +11 -8
- data/include/rays/coord.h +114 -0
- data/include/rays/debug.h +22 -0
- data/include/rays/defs.h +3 -0
- data/include/rays/font.h +4 -4
- data/include/rays/image.h +11 -17
- data/include/rays/matrix.h +50 -24
- data/include/rays/noise.h +42 -0
- data/include/rays/opengl.h +2 -50
- data/include/rays/painter.h +57 -99
- data/include/rays/point.h +44 -51
- data/include/rays/polygon.h +164 -0
- data/include/rays/polyline.h +65 -0
- data/include/rays/rays.h +3 -0
- data/include/rays/ruby.h +7 -1
- data/include/rays/ruby/bounds.h +1 -1
- data/include/rays/ruby/color.h +1 -1
- data/include/rays/ruby/color_space.h +1 -1
- data/include/rays/ruby/font.h +1 -1
- data/include/rays/ruby/matrix.h +1 -1
- data/include/rays/ruby/point.h +1 -1
- data/include/rays/ruby/polygon.h +52 -0
- data/include/rays/ruby/polyline.h +41 -0
- data/include/rays/ruby/shader.h +1 -1
- data/include/rays/shader.h +36 -8
- data/lib/rays.rb +6 -1
- data/lib/rays/bitmap.rb +0 -15
- data/lib/rays/bounds.rb +17 -23
- data/lib/rays/color.rb +20 -47
- data/lib/rays/color_space.rb +13 -13
- data/lib/rays/image.rb +2 -6
- data/lib/rays/matrix.rb +28 -0
- data/lib/rays/module.rb +4 -19
- data/lib/rays/painter.rb +60 -97
- data/lib/rays/point.rb +13 -21
- data/lib/rays/polygon.rb +50 -0
- data/lib/rays/polygon_line.rb +36 -0
- data/lib/rays/polyline.rb +32 -0
- data/lib/rays/shader.rb +20 -1
- data/rays.gemspec +5 -7
- data/src/bitmap.h +36 -0
- data/src/bounds.cpp +74 -11
- data/src/color.cpp +58 -23
- data/src/color_space.cpp +50 -32
- data/src/color_space.h +22 -0
- data/src/coord.cpp +170 -0
- data/src/coord.h +35 -0
- data/src/font.cpp +118 -0
- data/src/font.h +64 -0
- data/src/frame_buffer.cpp +37 -71
- data/src/frame_buffer.h +4 -4
- data/src/image.cpp +171 -97
- data/src/image.h +25 -0
- data/src/ios/bitmap.mm +107 -105
- data/src/ios/font.mm +48 -60
- data/src/ios/helper.h +2 -2
- data/src/ios/opengl.mm +19 -4
- data/src/ios/rays.mm +3 -0
- data/src/matrix.cpp +111 -26
- data/src/matrix.h +30 -0
- data/src/noise.cpp +74 -0
- data/src/opengl.cpp +9 -27
- data/src/opengl.h +37 -0
- data/src/osx/bitmap.mm +111 -106
- data/src/osx/font.mm +48 -61
- data/src/osx/helper.h +2 -2
- data/src/osx/opengl.mm +19 -83
- data/src/osx/rays.mm +3 -0
- data/src/painter.cpp +780 -696
- data/src/painter.h +24 -0
- data/src/point.cpp +140 -119
- data/src/polygon.cpp +1100 -0
- data/src/polygon.h +32 -0
- data/src/polyline.cpp +158 -0
- data/src/polyline.h +67 -0
- data/src/render_buffer.cpp +11 -4
- data/src/render_buffer.h +2 -2
- data/src/shader.cpp +163 -106
- data/src/shader.h +38 -0
- data/src/shader_program.cpp +533 -0
- data/src/{program.h → shader_program.h} +28 -16
- data/src/shader_source.cpp +140 -0
- data/src/shader_source.h +52 -0
- data/src/texture.cpp +136 -160
- data/src/texture.h +65 -0
- data/src/win32/bitmap.cpp +62 -52
- data/src/win32/font.cpp +11 -13
- data/src/win32/font.h +24 -0
- data/src/win32/gdi.h +6 -6
- data/test/helper.rb +0 -3
- data/test/test_bitmap.rb +31 -7
- data/test/test_bounds.rb +36 -0
- data/test/test_color.rb +59 -19
- data/test/test_color_space.rb +95 -0
- data/test/test_image.rb +24 -20
- data/test/test_matrix.rb +106 -0
- data/test/test_painter.rb +92 -46
- data/test/test_painter_shape.rb +57 -0
- data/test/test_point.rb +21 -0
- data/test/test_polygon.rb +234 -0
- data/test/test_polygon_line.rb +167 -0
- data/test/test_polyline.rb +145 -0
- data/test/test_shader.rb +9 -9
- metadata +88 -67
- data/.doc/ext/rays/texture.cpp +0 -138
- data/ext/rays/texture.cpp +0 -149
- data/include/rays/ruby/texture.h +0 -41
- data/include/rays/texture.h +0 -71
- data/lib/rays/texture.rb +0 -24
- data/src/program.cpp +0 -648
- data/test/test_texture.rb +0 -27
data/ext/rays/matrix.cpp
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
#include "rays/ruby/matrix.h"
|
2
2
|
|
3
3
|
|
4
|
-
#include
|
4
|
+
#include "rays/ruby/point.h"
|
5
5
|
#include "defs.h"
|
6
6
|
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
RUCY_DEFINE_VALUE_FROM_TO(Rays::Matrix)
|
8
|
+
RUCY_DEFINE_VALUE_OR_ARRAY_FROM_TO(Rays::Matrix)
|
12
9
|
|
13
10
|
#define THIS to<Rays::Matrix*>(self)
|
14
11
|
|
@@ -28,22 +25,8 @@ RUCY_DEFN(initialize)
|
|
28
25
|
CHECK;
|
29
26
|
check_arg_count(__FILE__, __LINE__, "Matrix#initialize", argc, 0, 1, 16);
|
30
27
|
|
31
|
-
if (argc
|
32
|
-
|
33
|
-
switch (argc)
|
34
|
-
{
|
35
|
-
case 1:
|
36
|
-
*THIS = Rays::Matrix(to<float>(argv[0]));
|
37
|
-
break;
|
38
|
-
|
39
|
-
case 16:
|
40
|
-
*THIS = Rays::Matrix(
|
41
|
-
to<float>(argv[0]), to<float>(argv[1]), to<float>(argv[2]), to<float>(argv[3]),
|
42
|
-
to<float>(argv[4]), to<float>(argv[5]), to<float>(argv[6]), to<float>(argv[7]),
|
43
|
-
to<float>(argv[8]), to<float>(argv[9]), to<float>(argv[10]), to<float>(argv[11]),
|
44
|
-
to<float>(argv[12]), to<float>(argv[13]), to<float>(argv[14]), to<float>(argv[15]));
|
45
|
-
break;
|
46
|
-
}
|
28
|
+
if (argc > 0)
|
29
|
+
*THIS = to<Rays::Matrix>(argc, argv);
|
47
30
|
|
48
31
|
return self;
|
49
32
|
}
|
@@ -59,23 +42,23 @@ RUCY_DEF1(initialize_copy, obj)
|
|
59
42
|
RUCY_END
|
60
43
|
|
61
44
|
static
|
62
|
-
RUCY_DEFN(
|
45
|
+
RUCY_DEFN(reset)
|
63
46
|
{
|
64
47
|
CHECK;
|
65
|
-
check_arg_count(__FILE__, __LINE__, "Matrix#
|
48
|
+
check_arg_count(__FILE__, __LINE__, "Matrix#reset", argc, 0, 1, 16);
|
66
49
|
|
67
50
|
switch (argc)
|
68
51
|
{
|
69
52
|
case 0:
|
70
|
-
|
53
|
+
THIS->reset();
|
71
54
|
break;
|
72
55
|
|
73
56
|
case 1:
|
74
|
-
|
57
|
+
THIS->reset(to<float>(argv[0]));
|
75
58
|
break;
|
76
59
|
|
77
60
|
case 16:
|
78
|
-
|
61
|
+
THIS->reset(
|
79
62
|
to<float>(argv[0]), to<float>(argv[1]), to<float>(argv[2]), to<float>(argv[3]),
|
80
63
|
to<float>(argv[4]), to<float>(argv[5]), to<float>(argv[6]), to<float>(argv[7]),
|
81
64
|
to<float>(argv[8]), to<float>(argv[9]), to<float>(argv[10]), to<float>(argv[11]),
|
@@ -88,13 +71,140 @@ RUCY_DEFN(set)
|
|
88
71
|
RUCY_END
|
89
72
|
|
90
73
|
static
|
91
|
-
|
74
|
+
RUCY_DEFN(translate)
|
75
|
+
{
|
76
|
+
CHECK;
|
77
|
+
check_arg_count(__FILE__, __LINE__, "Matrix#translate", argc, 1, 2, 3);
|
78
|
+
|
79
|
+
THIS->translate(to<Rays::Point>(argc, argv));
|
80
|
+
return self;
|
81
|
+
}
|
82
|
+
RUCY_END
|
83
|
+
|
84
|
+
static
|
85
|
+
RUCY_DEFN(scale)
|
86
|
+
{
|
87
|
+
CHECK;
|
88
|
+
check_arg_count(__FILE__, __LINE__, "Matrix#scale", argc, 1, 2, 3);
|
89
|
+
|
90
|
+
THIS->scale(to<Rays::Point>(argc, argv));
|
91
|
+
return self;
|
92
|
+
}
|
93
|
+
RUCY_END
|
94
|
+
|
95
|
+
static
|
96
|
+
RUCY_DEFN(rotate)
|
97
|
+
{
|
98
|
+
CHECK;
|
99
|
+
check_arg_count(__FILE__, __LINE__, "Matrix#rotate", argc, 1, 2, 4);
|
100
|
+
|
101
|
+
float degree = to<float>(argv[0]);
|
102
|
+
|
103
|
+
if (argc == 1)
|
104
|
+
THIS->rotate(degree);
|
105
|
+
else
|
106
|
+
THIS->rotate(degree, to<Rays::Point>(argc - 1, argv + 1));
|
107
|
+
|
108
|
+
return self;
|
109
|
+
}
|
110
|
+
RUCY_END
|
111
|
+
|
112
|
+
static
|
113
|
+
RUCY_DEF0(to_a)
|
114
|
+
{
|
115
|
+
CHECK;
|
116
|
+
return array(
|
117
|
+
THIS->x0, THIS->y0, THIS->z0, THIS->w0,
|
118
|
+
THIS->x1, THIS->y1, THIS->z1, THIS->w1,
|
119
|
+
THIS->x2, THIS->y2, THIS->z2, THIS->w2,
|
120
|
+
THIS->x3, THIS->y3, THIS->z3, THIS->w3);
|
121
|
+
}
|
122
|
+
RUCY_END
|
123
|
+
|
124
|
+
static
|
125
|
+
RUCY_DEF1(mult, val)
|
126
|
+
{
|
127
|
+
CHECK;
|
128
|
+
|
129
|
+
if (val.is_kind_of(Rays::matrix_class()))
|
130
|
+
return value(*THIS * to<Rays::Matrix&>(val));
|
131
|
+
|
132
|
+
if (val.is_kind_of(Rays::point_class()))
|
133
|
+
return value(*THIS * to<Rays::Point&>(val));
|
134
|
+
|
135
|
+
if (val.is_array())
|
136
|
+
{
|
137
|
+
if (val.size() == 16)
|
138
|
+
return value(*THIS * to<Rays::Matrix>(val));
|
139
|
+
else
|
140
|
+
return value(*THIS * to<Rays::Point>(val));
|
141
|
+
}
|
142
|
+
|
143
|
+
argument_error(__FILE__, __LINE__);
|
144
|
+
}
|
145
|
+
RUCY_END
|
146
|
+
|
147
|
+
static
|
148
|
+
RUCY_DEF3(set_at, row, column, val)
|
149
|
+
{
|
150
|
+
CHECK;
|
151
|
+
return value(THIS->at(row.as_i(), column.as_i()) = to<float>(val));
|
152
|
+
}
|
153
|
+
RUCY_END
|
154
|
+
|
155
|
+
static
|
156
|
+
RUCY_DEF2(get_at, row, column)
|
92
157
|
{
|
93
158
|
CHECK;
|
94
159
|
return value(THIS->at(row.as_i(), column.as_i()));
|
95
160
|
}
|
96
161
|
RUCY_END
|
97
162
|
|
163
|
+
static
|
164
|
+
RUCY_DEF1(compare, other)
|
165
|
+
{
|
166
|
+
CHECK;
|
167
|
+
|
168
|
+
const Rays::Matrix& a = *THIS;
|
169
|
+
const Rays::Matrix& b = to<const Rays::Matrix&>(other);
|
170
|
+
for (int i = 0; i < Rays::Matrix::NELEM; ++i)
|
171
|
+
{
|
172
|
+
if (a[i] == b[i]) continue;
|
173
|
+
return value(a[i] < b[i] ? -1 : +1);
|
174
|
+
}
|
175
|
+
return value(0);
|
176
|
+
}
|
177
|
+
RUCY_END
|
178
|
+
|
179
|
+
static
|
180
|
+
RUCY_DEF0(inspect)
|
181
|
+
{
|
182
|
+
CHECK;
|
183
|
+
return value(Xot::stringf("#<Rays::Matrix %s>", THIS->inspect().c_str()));
|
184
|
+
}
|
185
|
+
RUCY_END
|
186
|
+
|
187
|
+
static
|
188
|
+
RUCY_DEFN(s_translate)
|
189
|
+
{
|
190
|
+
return translate(argc, argv, value(Rays::Matrix()));
|
191
|
+
}
|
192
|
+
RUCY_END
|
193
|
+
|
194
|
+
static
|
195
|
+
RUCY_DEFN(s_scale)
|
196
|
+
{
|
197
|
+
return scale(argc, argv, value(Rays::Matrix()));
|
198
|
+
}
|
199
|
+
RUCY_END
|
200
|
+
|
201
|
+
static
|
202
|
+
RUCY_DEFN(s_rotate)
|
203
|
+
{
|
204
|
+
return rotate(argc, argv, value(Rays::Matrix()));
|
205
|
+
}
|
206
|
+
RUCY_END
|
207
|
+
|
98
208
|
|
99
209
|
static Class cMatrix;
|
100
210
|
|
@@ -105,13 +215,71 @@ Init_matrix ()
|
|
105
215
|
|
106
216
|
cMatrix = mRays.define_class("Matrix");
|
107
217
|
cMatrix.define_alloc_func(alloc);
|
108
|
-
cMatrix.define_private_method("initialize",
|
218
|
+
cMatrix.define_private_method("initialize", initialize);
|
109
219
|
cMatrix.define_private_method("initialize_copy", initialize_copy);
|
110
|
-
cMatrix.define_method("
|
111
|
-
cMatrix.define_method("
|
220
|
+
cMatrix.define_method("reset", reset);
|
221
|
+
cMatrix.define_method("translate", translate);
|
222
|
+
cMatrix.define_method("scale", scale);
|
223
|
+
cMatrix.define_method("rotate", rotate);
|
224
|
+
cMatrix.define_method("to_a", to_a);
|
225
|
+
cMatrix.define_method("*", mult);
|
226
|
+
cMatrix.define_method("[]=", set_at);
|
227
|
+
cMatrix.define_method("[]", get_at);
|
228
|
+
cMatrix.define_method("<=>", compare);
|
229
|
+
cMatrix.define_method("inspect", inspect);
|
230
|
+
|
231
|
+
cMatrix.define_singleton_method("translate", s_translate);
|
232
|
+
cMatrix.define_singleton_method("scale", s_scale);
|
233
|
+
cMatrix.define_singleton_method("rotate", s_rotate);
|
112
234
|
}
|
113
235
|
|
114
236
|
|
237
|
+
namespace Rucy
|
238
|
+
{
|
239
|
+
|
240
|
+
|
241
|
+
template <> Rays::Matrix
|
242
|
+
value_to<Rays::Matrix> (int argc, const Value* argv, bool convert)
|
243
|
+
{
|
244
|
+
if (argc == 1 && argv->is_array())
|
245
|
+
{
|
246
|
+
argc = argv->size();
|
247
|
+
argv = argv->as_array();
|
248
|
+
}
|
249
|
+
|
250
|
+
assert(argc == 0 || (argc > 0 && argv));
|
251
|
+
|
252
|
+
if (convert)
|
253
|
+
{
|
254
|
+
if (argc == 0)
|
255
|
+
return Rays::Matrix();
|
256
|
+
else if (argv->is_num())
|
257
|
+
{
|
258
|
+
switch (argc)
|
259
|
+
{
|
260
|
+
#define V(i) argv[i].as_f(true)
|
261
|
+
case 1: return Rays::Matrix(V(0));
|
262
|
+
case 16: return Rays::Matrix(
|
263
|
+
V(0), V(1), V(2), V(3),
|
264
|
+
V(4), V(5), V(6), V(7),
|
265
|
+
V(8), V(9), V(10), V(11),
|
266
|
+
V(12), V(13), V(14), V(15));
|
267
|
+
#undef V
|
268
|
+
default: argument_error(__FILE__, __LINE__);
|
269
|
+
}
|
270
|
+
}
|
271
|
+
}
|
272
|
+
|
273
|
+
if (argc != 1)
|
274
|
+
argument_error(__FILE__, __LINE__);
|
275
|
+
|
276
|
+
return value_to<Rays::Matrix&>(*argv, convert);
|
277
|
+
}
|
278
|
+
|
279
|
+
|
280
|
+
}// Rucy
|
281
|
+
|
282
|
+
|
115
283
|
namespace Rays
|
116
284
|
{
|
117
285
|
|
data/ext/rays/native.cpp
CHANGED
@@ -1,25 +1,26 @@
|
|
1
|
-
#include <rucy.h>
|
2
1
|
#include "defs.h"
|
3
2
|
|
4
3
|
|
5
|
-
using namespace Rucy;
|
6
|
-
|
7
|
-
|
8
4
|
void Init_rays ();
|
9
5
|
|
10
6
|
void Init_point ();
|
11
7
|
void Init_bounds ();
|
12
8
|
void Init_color ();
|
13
9
|
void Init_color_space ();
|
10
|
+
void Init_matrix ();
|
14
11
|
|
12
|
+
void Init_polyline ();
|
13
|
+
void Init_polygon_line ();
|
14
|
+
void Init_polygon ();
|
15
15
|
void Init_bitmap ();
|
16
|
-
void Init_texture ();
|
17
16
|
void Init_image ();
|
18
17
|
void Init_font ();
|
19
18
|
void Init_shader ();
|
20
19
|
|
21
20
|
void Init_painter ();
|
22
21
|
|
22
|
+
void Init_noise ();
|
23
|
+
|
23
24
|
|
24
25
|
extern "C" void
|
25
26
|
#ifdef COCOAPODS
|
@@ -38,14 +39,19 @@ extern "C" void
|
|
38
39
|
Init_bounds();
|
39
40
|
Init_color();
|
40
41
|
Init_color_space();
|
42
|
+
Init_matrix();
|
41
43
|
|
44
|
+
Init_polyline();
|
45
|
+
Init_polygon_line();
|
46
|
+
Init_polygon();
|
42
47
|
Init_bitmap();
|
43
|
-
Init_texture();
|
44
48
|
Init_image();
|
45
49
|
Init_font();
|
46
50
|
Init_shader();
|
47
51
|
|
48
52
|
Init_painter();
|
49
53
|
|
54
|
+
Init_noise();
|
55
|
+
|
50
56
|
RUCY_CATCH
|
51
57
|
}
|
data/ext/rays/noise.cpp
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#include "rays/noise.h"
|
2
|
+
#include "rays/ruby/point.h"
|
3
|
+
#include "defs.h"
|
4
|
+
|
5
|
+
|
6
|
+
static
|
7
|
+
RUCY_DEFN(perlin)
|
8
|
+
{
|
9
|
+
check_arg_count(__FILE__, __LINE__, "Rays.perlin", argc, 1, 2, 3, 4);
|
10
|
+
|
11
|
+
coord noise = 0;
|
12
|
+
if (argc == 4)
|
13
|
+
{
|
14
|
+
noise = Rays::perlin(
|
15
|
+
to<coord>(argv[0]),
|
16
|
+
to<coord>(argv[1]),
|
17
|
+
to<coord>(argv[2]),
|
18
|
+
to<coord>(argv[3]));
|
19
|
+
}
|
20
|
+
else
|
21
|
+
noise = Rays::perlin(to<Rays::Point>(argc, argv));
|
22
|
+
|
23
|
+
return value(noise);
|
24
|
+
}
|
25
|
+
RUCY_END
|
26
|
+
|
27
|
+
static
|
28
|
+
RUCY_DEFN(simplex)
|
29
|
+
{
|
30
|
+
check_arg_count(__FILE__, __LINE__, "Rays.simplex", argc, 1, 2, 3, 4);
|
31
|
+
|
32
|
+
coord noise = 0;
|
33
|
+
if (argc == 4)
|
34
|
+
{
|
35
|
+
noise = Rays::simplex(
|
36
|
+
to<coord>(argv[0]),
|
37
|
+
to<coord>(argv[1]),
|
38
|
+
to<coord>(argv[2]),
|
39
|
+
to<coord>(argv[3]));
|
40
|
+
}
|
41
|
+
else
|
42
|
+
noise = Rays::simplex(to<Rays::Point>(argc, argv));
|
43
|
+
|
44
|
+
return value(noise);
|
45
|
+
}
|
46
|
+
RUCY_END
|
47
|
+
|
48
|
+
|
49
|
+
void
|
50
|
+
Init_noise ()
|
51
|
+
{
|
52
|
+
Module mRays = define_module("Rays");
|
53
|
+
mRays.define_singleton_method("perlin", perlin);
|
54
|
+
mRays.define_singleton_method("simplex", simplex);
|
55
|
+
}
|
data/ext/rays/painter.cpp
CHANGED
@@ -2,22 +2,16 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
#include <vector>
|
5
|
-
#include <rucy.h>
|
6
5
|
#include "rays/ruby/point.h"
|
7
6
|
#include "rays/ruby/bounds.h"
|
8
7
|
#include "rays/ruby/color.h"
|
9
8
|
#include "rays/ruby/matrix.h"
|
10
|
-
#include "rays/ruby/font.h"
|
11
9
|
#include "rays/ruby/image.h"
|
10
|
+
#include "rays/ruby/font.h"
|
12
11
|
#include "rays/ruby/shader.h"
|
13
12
|
#include "defs.h"
|
14
13
|
|
15
14
|
|
16
|
-
using namespace Rucy;
|
17
|
-
|
18
|
-
using Rays::coord;
|
19
|
-
|
20
|
-
|
21
15
|
RUCY_DEFINE_VALUE_FROM_TO(Rays::Painter)
|
22
16
|
|
23
17
|
#define THIS to<Rays::Painter*>(self)
|
@@ -55,6 +49,14 @@ RUCY_DEF0(bounds)
|
|
55
49
|
}
|
56
50
|
RUCY_END
|
57
51
|
|
52
|
+
static
|
53
|
+
RUCY_DEF0(pixel_density)
|
54
|
+
{
|
55
|
+
CHECK;
|
56
|
+
return value(THIS->pixel_density());
|
57
|
+
}
|
58
|
+
RUCY_END
|
59
|
+
|
58
60
|
|
59
61
|
static
|
60
62
|
RUCY_DEF0(begin_paint)
|
@@ -83,144 +85,70 @@ RUCY_DEF0(clear)
|
|
83
85
|
RUCY_END
|
84
86
|
|
85
87
|
static
|
86
|
-
|
87
|
-
{
|
88
|
-
CHECK;
|
89
|
-
check_arg_count(__FILE__, __LINE__, "Painter#line", argc, 2, 4);
|
90
|
-
|
91
|
-
if (argc == 2)
|
92
|
-
THIS->line(to<Rays::Point&>(argv[0]), to<Rays::Point&>(argv[1]));
|
93
|
-
else
|
94
|
-
{
|
95
|
-
coord x1 = to<coord>(argv[0]);
|
96
|
-
coord y1 = to<coord>(argv[1]);
|
97
|
-
coord x2 = to<coord>(argv[2]);
|
98
|
-
coord y2 = to<coord>(argv[3]);
|
99
|
-
THIS->line(x1, y1, x2, y2);
|
100
|
-
}
|
101
|
-
|
102
|
-
return self;
|
103
|
-
}
|
104
|
-
RUCY_END
|
105
|
-
|
106
|
-
static
|
107
|
-
RUCY_DEFN(lines)
|
88
|
+
RUCY_DEF1(polygon, poly)
|
108
89
|
{
|
109
90
|
CHECK;
|
110
|
-
if (argc <= 0)
|
111
|
-
argument_error(__FILE__, __LINE__, "Painter#lines");
|
112
|
-
|
113
|
-
std::vector<Rays::Coord3> points;
|
114
|
-
points.reserve(argc);
|
115
|
-
for (int i = 0; i < argc; ++i)
|
116
|
-
points.push_back(to<Rays::Point&>(argv[i]));
|
117
91
|
|
118
|
-
THIS->
|
92
|
+
THIS->polygon(to<Rays::Polygon&>(poly));
|
119
93
|
return self;
|
120
94
|
}
|
121
95
|
RUCY_END
|
122
96
|
|
123
97
|
static
|
124
|
-
|
98
|
+
RUCY_DEF2(line, args, loop)
|
125
99
|
{
|
126
100
|
CHECK;
|
127
|
-
if (argc <= 0)
|
128
|
-
argument_error(__FILE__, __LINE__, "Painter#polygon");
|
129
101
|
|
130
|
-
std::vector<Rays::
|
131
|
-
points.
|
132
|
-
for (int i = 0; i < argc; ++i)
|
133
|
-
points.push_back(to<Rays::Point&>(argv[i]));
|
102
|
+
std::vector<Rays::Point> points;
|
103
|
+
get_line_args(&points, args.size(), args.as_array());
|
134
104
|
|
135
|
-
THIS->
|
105
|
+
THIS->line(&points[0], points.size(), loop);
|
136
106
|
return self;
|
137
107
|
}
|
138
108
|
RUCY_END
|
139
109
|
|
140
110
|
static
|
141
|
-
|
111
|
+
RUCY_DEF1(polyline, poly)
|
142
112
|
{
|
143
113
|
CHECK;
|
144
|
-
check_arg_count(__FILE__, __LINE__, "Painter#rect", argc, 1, 2, 3, 4, 5, 6);
|
145
|
-
|
146
|
-
if (argc <= 3)
|
147
|
-
{
|
148
|
-
Rays::Bounds& b = to<Rays::Bounds&>(argv[0]);
|
149
|
-
coord rw = argc >= 2 ? to<coord>(argv[1]) : 0;
|
150
|
-
coord rh = argc >= 3 ? to<coord>(argv[2]) : rw;
|
151
|
-
THIS->rect(b, rw, rh);
|
152
|
-
}
|
153
|
-
else
|
154
|
-
{
|
155
|
-
coord x = to<coord>(argv[0]);
|
156
|
-
coord y = to<coord>(argv[1]);
|
157
|
-
coord w = to<coord>(argv[2]);
|
158
|
-
coord h = to<coord>(argv[3]);
|
159
|
-
coord rw = argc >= 5 ? to<coord>(argv[4]) : 0;
|
160
|
-
coord rh = argc >= 6 ? to<coord>(argv[5]) : rw;
|
161
|
-
THIS->rect(x, y, w, h, rw, rh);
|
162
|
-
}
|
163
114
|
|
115
|
+
THIS->line(to<Rays::Polyline&>(poly));
|
164
116
|
return self;
|
165
117
|
}
|
166
118
|
RUCY_END
|
167
119
|
|
168
120
|
static
|
169
|
-
|
121
|
+
RUCY_DEF6(rect, args, round, lefttop, righttop, leftbottom, rightbottom)
|
170
122
|
{
|
171
123
|
CHECK;
|
172
|
-
check_arg_count(__FILE__, __LINE__, "Painter#ellipse", argc, 1, 2, 3, 4, 5, 6);
|
173
124
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
}
|
181
|
-
else
|
182
|
-
{
|
183
|
-
coord x = to<coord>(argv[0]);
|
184
|
-
coord y = to<coord>(argv[1]);
|
185
|
-
coord w = to<coord>(argv[2]);
|
186
|
-
coord h = (argc >= 4) ? to<coord>(argv[3]) : 0;
|
187
|
-
coord min_ = (argc >= 5) ? to<coord>(argv[4]) : 0;
|
188
|
-
uint nseg = (argc >= 6) ? to<uint> (argv[5]) : 0;
|
189
|
-
THIS->ellipse(x, y, w, h, min_, nseg);
|
190
|
-
}
|
125
|
+
coord x, y, w, h, lt, rt, lb, rb;
|
126
|
+
uint _;
|
127
|
+
get_rect_args(
|
128
|
+
&x, &y, &w, &h, <, &rt, &lb, &rb, &_,
|
129
|
+
args.size(), args.as_array(),
|
130
|
+
round, lefttop, righttop, leftbottom, rightbottom, nil());
|
191
131
|
|
132
|
+
THIS->rect(x, y, w, h, lt, rt, lb, rb);
|
192
133
|
return self;
|
193
134
|
}
|
194
135
|
RUCY_END
|
195
136
|
|
196
137
|
static
|
197
|
-
|
138
|
+
RUCY_DEF6(ellipse, args, center, radius, hole, angle_from, angle_to)
|
198
139
|
{
|
199
140
|
CHECK;
|
200
|
-
check_arg_count(__FILE__, __LINE__, "Painter#ellipse", argc, 1, 2, 3, 4, 5, 6, 7, 8);
|
201
141
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
}
|
211
|
-
else
|
212
|
-
{
|
213
|
-
coord x = to<coord>(argv[0]);
|
214
|
-
coord y = to<coord>(argv[1]);
|
215
|
-
coord w = to<coord>(argv[2]);
|
216
|
-
coord h = (argc >= 4) ? to<coord>(argv[3]) : 0;
|
217
|
-
float begin = (argc >= 5) ? to<float>(argv[4]) : 0;
|
218
|
-
float end = (argc >= 6) ? to<float>(argv[5]) : 360;
|
219
|
-
coord min_ = (argc >= 7) ? to<coord>(argv[6]) : 0;
|
220
|
-
uint nseg = (argc >= 8) ? to<uint> (argv[7]) : 0;
|
221
|
-
THIS->arc(x, y, w, h, begin, end, min_, nseg);
|
222
|
-
}
|
142
|
+
coord x, y, w, h;
|
143
|
+
Rays::Point hole_size;
|
144
|
+
float from, to_;
|
145
|
+
uint _;
|
146
|
+
get_ellipse_args(
|
147
|
+
&x, &y, &w, &h, &hole_size, &from, &to_, &_,
|
148
|
+
args.size(), args.as_array(),
|
149
|
+
center, radius, hole, angle_from, angle_to, nil());
|
223
150
|
|
151
|
+
THIS->ellipse(x, y, w, h, hole_size, from, to_);
|
224
152
|
return self;
|
225
153
|
}
|
226
154
|
RUCY_END
|
@@ -273,7 +201,7 @@ static
|
|
273
201
|
RUCY_DEFN(text)
|
274
202
|
{
|
275
203
|
CHECK;
|
276
|
-
check_arg_count(__FILE__, __LINE__, "Painter#text", argc, 1, 3,
|
204
|
+
check_arg_count(__FILE__, __LINE__, "Painter#text", argc, 1, 3, 5);
|
277
205
|
|
278
206
|
if (argc == 1)
|
279
207
|
THIS->text(argv[0].c_str());
|
@@ -282,63 +210,35 @@ RUCY_DEFN(text)
|
|
282
210
|
coord x = to<coord>(argv[1]), y = to<coord>(argv[2]);
|
283
211
|
THIS->text(argv[0].c_str(), x, y);
|
284
212
|
}
|
285
|
-
else if (argc == 4)
|
286
|
-
{
|
287
|
-
const Rays::Font* font = to<Rays::Font*>(argv[3]);
|
288
|
-
if (!font || !*font)
|
289
|
-
rays_error(__FILE__, __LINE__, "Painter#text: invalid font.");
|
290
|
-
|
291
|
-
coord x = to<coord>(argv[1]), y = to<coord>(argv[2]);
|
292
|
-
THIS->text(argv[0].c_str(), x, y, font);
|
293
|
-
}
|
294
213
|
else if (argc == 5)
|
295
214
|
{
|
296
215
|
coord x = to<coord>(argv[1]), w = to<coord>(argv[3]);
|
297
216
|
coord y = to<coord>(argv[2]), h = to<coord>(argv[4]);
|
298
217
|
THIS->text(argv[0].c_str(), x, y, w, h);
|
299
218
|
}
|
300
|
-
else if (argc == 7)
|
301
|
-
{
|
302
|
-
const Rays::Font* font = to<Rays::Font*>(argv[3]);
|
303
|
-
if (!font || !*font)
|
304
|
-
rays_error(__FILE__, __LINE__, "Painter#text: invalid font.");
|
305
|
-
|
306
|
-
coord x = to<coord>(argv[1]), w = to<coord>(argv[3]);
|
307
|
-
coord y = to<coord>(argv[2]), h = to<coord>(argv[4]);
|
308
|
-
THIS->text(argv[0].c_str(), x, y, w, h, font);
|
309
|
-
}
|
310
219
|
|
311
220
|
return self;
|
312
221
|
}
|
313
222
|
RUCY_END
|
314
223
|
|
224
|
+
|
315
225
|
static
|
316
226
|
RUCY_DEFN(set_background)
|
317
227
|
{
|
318
228
|
CHECK;
|
319
|
-
|
320
|
-
|
321
|
-
if (argc == 1 && argv[0].is_kind_of(Rays::color_class()))
|
322
|
-
THIS->set_background(to<Rays::Color&>(argv[0]));
|
323
|
-
else if (argc == 1 || argc == 2)
|
324
|
-
{
|
325
|
-
float v = to<float>(argv[0]);
|
326
|
-
float a = (argc >= 2) ? to<float>(argv[1]) : 1;
|
327
|
-
THIS->set_background(v, v, v, a);
|
328
|
-
}
|
329
|
-
else
|
330
|
-
{
|
331
|
-
float r = to<float>(argv[0]);
|
332
|
-
float g = to<float>(argv[1]);
|
333
|
-
float b = to<float>(argv[2]);
|
334
|
-
float a = (argc == 4) ? to<float>(argv[3]) : 1;
|
335
|
-
THIS->set_background(r, g, b, a);
|
336
|
-
}
|
337
|
-
|
229
|
+
THIS->set_background(to<Rays::Color>(argc, argv));
|
338
230
|
return self;
|
339
231
|
}
|
340
232
|
RUCY_END
|
341
233
|
|
234
|
+
static
|
235
|
+
RUCY_DEF0(get_background)
|
236
|
+
{
|
237
|
+
CHECK;
|
238
|
+
return value(THIS->background());
|
239
|
+
}
|
240
|
+
RUCY_END
|
241
|
+
|
342
242
|
static
|
343
243
|
RUCY_DEF0(no_background)
|
344
244
|
{
|
@@ -349,37 +249,19 @@ RUCY_DEF0(no_background)
|
|
349
249
|
RUCY_END
|
350
250
|
|
351
251
|
static
|
352
|
-
|
252
|
+
RUCY_DEFN(set_fill)
|
353
253
|
{
|
354
254
|
CHECK;
|
355
|
-
|
255
|
+
THIS->set_fill(to<Rays::Color>(argc, argv));
|
256
|
+
return self;
|
356
257
|
}
|
357
258
|
RUCY_END
|
358
259
|
|
359
260
|
static
|
360
|
-
|
261
|
+
RUCY_DEF0(get_fill)
|
361
262
|
{
|
362
263
|
CHECK;
|
363
|
-
|
364
|
-
|
365
|
-
if (argc == 1 && argv[0].is_kind_of(Rays::color_class()))
|
366
|
-
THIS->set_fill(to<Rays::Color&>(argv[0]));
|
367
|
-
else if (argc == 1 || argc == 2)
|
368
|
-
{
|
369
|
-
float v = to<float>(argv[0]);
|
370
|
-
float a = (argc >= 2) ? to<float>(argv[1]) : 1;
|
371
|
-
THIS->set_fill(v, v, v, a);
|
372
|
-
}
|
373
|
-
else
|
374
|
-
{
|
375
|
-
float r = to<float>(argv[0]);
|
376
|
-
float g = to<float>(argv[1]);
|
377
|
-
float b = to<float>(argv[2]);
|
378
|
-
float a = (argc == 4) ? to<float>(argv[3]) : 1;
|
379
|
-
THIS->set_fill(r, g, b, a);
|
380
|
-
}
|
381
|
-
|
382
|
-
return self;
|
264
|
+
return value(THIS->fill());
|
383
265
|
}
|
384
266
|
RUCY_END
|
385
267
|
|
@@ -393,37 +275,19 @@ RUCY_DEF0(no_fill)
|
|
393
275
|
RUCY_END
|
394
276
|
|
395
277
|
static
|
396
|
-
|
278
|
+
RUCY_DEFN(set_stroke)
|
397
279
|
{
|
398
280
|
CHECK;
|
399
|
-
|
281
|
+
THIS->set_stroke(to<Rays::Color>(argc, argv));
|
282
|
+
return self;
|
400
283
|
}
|
401
284
|
RUCY_END
|
402
285
|
|
403
286
|
static
|
404
|
-
|
287
|
+
RUCY_DEF0(get_stroke)
|
405
288
|
{
|
406
289
|
CHECK;
|
407
|
-
|
408
|
-
|
409
|
-
if (argc == 1 && argv[0].is_kind_of(Rays::color_class()))
|
410
|
-
THIS->set_stroke(to<Rays::Color&>(argv[0]));
|
411
|
-
else if (argc == 1 || argc == 2)
|
412
|
-
{
|
413
|
-
float v = to<float>(argv[0]);
|
414
|
-
float a = (argc >= 2) ? to<float>(argv[1]) : 1;
|
415
|
-
THIS->set_stroke(v, v, v, a);
|
416
|
-
}
|
417
|
-
else
|
418
|
-
{
|
419
|
-
float r = to<float>(argv[0]);
|
420
|
-
float g = to<float>(argv[1]);
|
421
|
-
float b = to<float>(argv[2]);
|
422
|
-
float a = (argc == 4) ? to<float>(argv[3]) : 1;
|
423
|
-
THIS->set_stroke(r, g, b, a);
|
424
|
-
}
|
425
|
-
|
426
|
-
return self;
|
290
|
+
return value(THIS->stroke());
|
427
291
|
}
|
428
292
|
RUCY_END
|
429
293
|
|
@@ -437,177 +301,126 @@ RUCY_DEF0(no_stroke)
|
|
437
301
|
RUCY_END
|
438
302
|
|
439
303
|
static
|
440
|
-
|
304
|
+
RUCY_DEF1(set_stroke_width, width)
|
441
305
|
{
|
442
306
|
CHECK;
|
443
|
-
|
307
|
+
THIS->set_stroke_width(to<coord>(width));
|
308
|
+
return self;
|
444
309
|
}
|
445
310
|
RUCY_END
|
446
311
|
|
447
312
|
static
|
448
|
-
|
313
|
+
RUCY_DEF0(get_stroke_width)
|
449
314
|
{
|
450
315
|
CHECK;
|
451
|
-
|
452
|
-
|
453
|
-
if (argc == 1)
|
454
|
-
THIS->set_clip(to<Rays::Bounds&>(argv[0]));
|
455
|
-
else
|
456
|
-
{
|
457
|
-
coord x = to<coord>(argv[0]);
|
458
|
-
coord y = to<coord>(argv[1]);
|
459
|
-
coord w = to<coord>(argv[2]);
|
460
|
-
coord h = to<coord>(argv[3]);
|
461
|
-
THIS->set_clip(x, y, w, h);
|
462
|
-
}
|
463
|
-
|
464
|
-
return self;
|
316
|
+
return value(THIS->stroke_width());
|
465
317
|
}
|
466
318
|
RUCY_END
|
467
319
|
|
468
320
|
static
|
469
|
-
|
321
|
+
RUCY_DEF1(set_nsegment, nsegment)
|
470
322
|
{
|
471
323
|
CHECK;
|
472
|
-
THIS->
|
324
|
+
THIS->set_nsegment(nsegment ? to<int>(nsegment) : 0);
|
473
325
|
return self;
|
474
326
|
}
|
475
327
|
RUCY_END
|
476
328
|
|
477
329
|
static
|
478
|
-
RUCY_DEF0(
|
330
|
+
RUCY_DEF0(get_nsegment)
|
479
331
|
{
|
480
332
|
CHECK;
|
481
|
-
return value(THIS->
|
333
|
+
return value(THIS->nsegment());
|
482
334
|
}
|
483
335
|
RUCY_END
|
484
336
|
|
485
337
|
static
|
486
|
-
RUCY_DEFN(
|
338
|
+
RUCY_DEFN(set_clip)
|
487
339
|
{
|
488
340
|
CHECK;
|
489
|
-
|
490
|
-
|
491
|
-
if (argc == 0 || argv[0].is_kind_of(Rays::font_class()))
|
492
|
-
{
|
493
|
-
const Rays::Font* f = argc == 0
|
494
|
-
? &Rays::default_font()
|
495
|
-
: to<Rays::Font*>(argv[0]);
|
496
|
-
if (!f || !*f)
|
497
|
-
argument_error(__FILE__, __LINE__);
|
498
|
-
|
499
|
-
THIS->set_font(*f);
|
500
|
-
}
|
501
|
-
else
|
502
|
-
{
|
503
|
-
const char* name = argv[0].c_str();
|
504
|
-
coord size = argc >= 2 ? to<coord>(argv[1]) : 0;
|
505
|
-
THIS->set_font(name, size);
|
506
|
-
}
|
507
|
-
|
341
|
+
THIS->set_clip(to<Rays::Bounds>(argc, argv));
|
508
342
|
return self;
|
509
343
|
}
|
510
344
|
RUCY_END
|
511
345
|
|
512
346
|
static
|
513
|
-
RUCY_DEF0(
|
347
|
+
RUCY_DEF0(get_clip)
|
514
348
|
{
|
515
349
|
CHECK;
|
516
|
-
return value(THIS->
|
350
|
+
return value(THIS->clip());
|
517
351
|
}
|
518
352
|
RUCY_END
|
519
353
|
|
520
354
|
static
|
521
|
-
RUCY_DEF0(
|
355
|
+
RUCY_DEF0(no_clip)
|
522
356
|
{
|
523
357
|
CHECK;
|
524
|
-
THIS->
|
358
|
+
THIS->no_clip();
|
525
359
|
return self;
|
526
360
|
}
|
527
361
|
RUCY_END
|
528
362
|
|
529
363
|
static
|
530
|
-
|
364
|
+
RUCY_DEFN(set_font)
|
531
365
|
{
|
532
366
|
CHECK;
|
533
|
-
|
367
|
+
check_arg_count(__FILE__, __LINE__, "Painter#set_font", argc, 0, 1, 2);
|
368
|
+
|
369
|
+
THIS->set_font(to<Rays::Font>(argc, argv));
|
534
370
|
return self;
|
535
371
|
}
|
536
372
|
RUCY_END
|
537
373
|
|
538
|
-
|
539
374
|
static
|
540
|
-
|
375
|
+
RUCY_DEF0(get_font)
|
541
376
|
{
|
542
377
|
CHECK;
|
543
|
-
THIS->
|
544
|
-
return self;
|
378
|
+
return value(THIS->font());
|
545
379
|
}
|
546
380
|
RUCY_END
|
547
381
|
|
548
382
|
static
|
549
|
-
|
383
|
+
RUCY_DEFN(set_shader)
|
550
384
|
{
|
551
385
|
CHECK;
|
552
|
-
|
386
|
+
check_arg_count(__FILE__, __LINE__, "Painter#set_shader", argc, 1);
|
387
|
+
|
388
|
+
THIS->set_shader(to<Rays::Shader>(argc, argv));
|
553
389
|
return self;
|
554
390
|
}
|
555
391
|
RUCY_END
|
556
392
|
|
557
393
|
static
|
558
|
-
|
394
|
+
RUCY_DEF0(get_shader)
|
559
395
|
{
|
560
396
|
CHECK;
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
#define Af(n) ((float) argv[n].as_f())
|
565
|
-
|
566
|
-
const char* name = argv[0].c_str();
|
567
|
-
if (argv[1].is_i())
|
568
|
-
{
|
569
|
-
switch (argc)
|
570
|
-
{
|
571
|
-
case 2: THIS->set_uniform(name, Ai(1)); break;
|
572
|
-
case 3: THIS->set_uniform(name, Ai(1), Ai(2)); break;
|
573
|
-
case 4: THIS->set_uniform(name, Ai(1), Ai(2), Ai(3)); break;
|
574
|
-
case 5: THIS->set_uniform(name, Ai(1), Ai(2), Ai(3), Ai(4)); break;
|
575
|
-
}
|
576
|
-
}
|
577
|
-
else if (argv[1].is_f())
|
578
|
-
{
|
579
|
-
switch (argc)
|
580
|
-
{
|
581
|
-
case 2: THIS->set_uniform(name, Af(1)); break;
|
582
|
-
case 3: THIS->set_uniform(name, Af(1), Af(2)); break;
|
583
|
-
case 4: THIS->set_uniform(name, Af(1), Af(2), Af(3)); break;
|
584
|
-
case 5: THIS->set_uniform(name, Af(1), Af(2), Af(3), Af(4)); break;
|
585
|
-
}
|
586
|
-
}
|
587
|
-
else
|
588
|
-
argument_error(__FILE__, __LINE__);
|
589
|
-
|
590
|
-
#undef Ai
|
591
|
-
#undef Af
|
397
|
+
return value(THIS->shader());
|
398
|
+
}
|
399
|
+
RUCY_END
|
592
400
|
|
401
|
+
static
|
402
|
+
RUCY_DEF0(no_shader)
|
403
|
+
{
|
404
|
+
CHECK;
|
405
|
+
THIS->no_shader();
|
593
406
|
return self;
|
594
407
|
}
|
595
408
|
RUCY_END
|
596
409
|
|
597
410
|
static
|
598
|
-
RUCY_DEF0(
|
411
|
+
RUCY_DEF0(push_state)
|
599
412
|
{
|
600
413
|
CHECK;
|
601
|
-
THIS->
|
414
|
+
THIS->push_state();
|
602
415
|
return self;
|
603
416
|
}
|
604
417
|
RUCY_END
|
605
418
|
|
606
419
|
static
|
607
|
-
RUCY_DEF0(
|
420
|
+
RUCY_DEF0(pop_state)
|
608
421
|
{
|
609
422
|
CHECK;
|
610
|
-
THIS->
|
423
|
+
THIS->pop_state();
|
611
424
|
return self;
|
612
425
|
}
|
613
426
|
RUCY_END
|
@@ -667,8 +480,8 @@ static
|
|
667
480
|
RUCY_DEFN(set_matrix)
|
668
481
|
{
|
669
482
|
CHECK;
|
670
|
-
THIS->set_matrix();
|
671
|
-
return
|
483
|
+
THIS->set_matrix(to<Rays::Matrix>(argc, argv));
|
484
|
+
return value(THIS->matrix());
|
672
485
|
}
|
673
486
|
RUCY_END
|
674
487
|
|
@@ -711,47 +524,48 @@ Init_painter ()
|
|
711
524
|
|
712
525
|
cPainter.define_method("canvas", canvas);
|
713
526
|
cPainter.define_method("bounds", bounds);
|
527
|
+
cPainter.define_method("pixel_density", pixel_density);
|
714
528
|
|
715
529
|
cPainter.define_private_method("begin_paint", begin_paint);
|
716
530
|
cPainter.define_private_method( "end_paint", end_paint);
|
717
531
|
cPainter.define_method("clear", clear);
|
718
|
-
cPainter.define_method("line", line);
|
719
|
-
cPainter.define_method("lines", lines);
|
720
532
|
cPainter.define_method("polygon", polygon);
|
721
|
-
cPainter.
|
722
|
-
cPainter.
|
723
|
-
cPainter.
|
724
|
-
cPainter.
|
725
|
-
cPainter.define_method("
|
726
|
-
|
727
|
-
|
728
|
-
cPainter.
|
729
|
-
cPainter.define_method(
|
730
|
-
cPainter.
|
731
|
-
cPainter.
|
732
|
-
cPainter.define_method(
|
733
|
-
cPainter.
|
734
|
-
cPainter.
|
735
|
-
cPainter.define_method(
|
736
|
-
cPainter.
|
737
|
-
cPainter.
|
738
|
-
cPainter.define_method(
|
739
|
-
cPainter.
|
740
|
-
cPainter.
|
741
|
-
cPainter.define_method("
|
742
|
-
cPainter.define_method(
|
743
|
-
|
744
|
-
cPainter.
|
745
|
-
cPainter.
|
746
|
-
cPainter.define_private_method("
|
747
|
-
cPainter.define_method("
|
748
|
-
cPainter.define_method(
|
533
|
+
cPainter.define_private_method("draw_line", line);
|
534
|
+
cPainter.define_private_method("draw_polyline", polyline);
|
535
|
+
cPainter.define_private_method("draw_rect", rect);
|
536
|
+
cPainter.define_private_method("draw_ellipse", ellipse);
|
537
|
+
cPainter.define_method("image", image);
|
538
|
+
cPainter.define_method("text", text);
|
539
|
+
|
540
|
+
cPainter.define_method( "background=", set_background);
|
541
|
+
cPainter.define_method( "background", get_background);
|
542
|
+
cPainter.define_method("no_background", no_background);
|
543
|
+
cPainter.define_method( "fill=", set_fill);
|
544
|
+
cPainter.define_method( "fill", get_fill);
|
545
|
+
cPainter.define_method("no_fill", no_fill);
|
546
|
+
cPainter.define_method( "stroke=", set_stroke);
|
547
|
+
cPainter.define_method( "stroke", get_stroke);
|
548
|
+
cPainter.define_method("no_stroke", no_stroke);
|
549
|
+
cPainter.define_method( "stroke_width=", set_stroke_width);
|
550
|
+
cPainter.define_method( "stroke_width", get_stroke_width);
|
551
|
+
cPainter.define_method("nsegment=", set_nsegment);
|
552
|
+
cPainter.define_method("nsegment", get_nsegment);
|
553
|
+
cPainter.define_method( "clip=", set_clip);
|
554
|
+
cPainter.define_method( "clip", get_clip);
|
555
|
+
cPainter.define_method("no_clip", no_clip);
|
556
|
+
cPainter.define_method("font=", set_font);
|
557
|
+
cPainter.define_method("font", get_font);
|
558
|
+
cPainter.define_private_method("set_shader", set_shader);
|
559
|
+
cPainter.define_method( "shader", get_shader);
|
560
|
+
cPainter.define_method( "no_shader", no_shader);
|
561
|
+
cPainter.define_method("push_state", push_state);
|
562
|
+
cPainter.define_method( "pop_state", pop_state);
|
749
563
|
|
750
564
|
cPainter.define_method("translate", translate);
|
751
565
|
cPainter.define_method("scale", scale);
|
752
566
|
cPainter.define_method("rotate", rotate);
|
753
|
-
cPainter.
|
754
|
-
cPainter.
|
567
|
+
cPainter.define_method("matrix=", set_matrix);
|
568
|
+
cPainter.define_method("matrix", get_matrix);
|
755
569
|
cPainter.define_method("push_matrix", push_matrix);
|
756
570
|
cPainter.define_method( "pop_matrix", pop_matrix);
|
757
571
|
}
|