rays 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.doc/ext/rays/bitmap.cpp +6 -6
- data/.doc/ext/rays/bounds.cpp +4 -4
- data/.doc/ext/rays/color.cpp +4 -4
- data/.doc/ext/rays/color_space.cpp +4 -4
- data/.doc/ext/rays/font.cpp +6 -6
- data/.doc/ext/rays/image.cpp +6 -6
- data/.doc/ext/rays/matrix.cpp +4 -4
- data/.doc/ext/rays/painter.cpp +56 -21
- data/.doc/ext/rays/point.cpp +5 -4
- data/.doc/ext/rays/rays.cpp +2 -3
- data/.doc/ext/rays/shader.cpp +5 -5
- data/.doc/ext/rays/texture.cpp +5 -5
- data/README.md +2 -2
- data/VERSION +1 -1
- data/ext/rays/bitmap.cpp +6 -6
- data/ext/rays/bounds.cpp +4 -4
- data/ext/rays/color.cpp +4 -4
- data/ext/rays/color_space.cpp +4 -4
- data/ext/rays/font.cpp +6 -6
- data/ext/rays/image.cpp +6 -6
- data/ext/rays/matrix.cpp +4 -4
- data/ext/rays/painter.cpp +72 -35
- data/ext/rays/point.cpp +5 -4
- data/ext/rays/rays.cpp +2 -3
- data/ext/rays/shader.cpp +5 -5
- data/ext/rays/texture.cpp +5 -5
- data/include/rays/opengl.h +1 -1
- data/include/rays/painter.h +12 -0
- data/include/rays/point.h +35 -9
- data/include/rays/ruby/bitmap.h +14 -0
- data/include/rays/ruby/bounds.h +14 -0
- data/include/rays/ruby/color.h +14 -0
- data/include/rays/ruby/color_space.h +14 -0
- data/include/rays/ruby/font.h +14 -0
- data/include/rays/ruby/image.h +14 -0
- data/include/rays/ruby/matrix.h +14 -0
- data/include/rays/ruby/painter.h +14 -0
- data/include/rays/ruby/point.h +14 -0
- data/include/rays/ruby/shader.h +14 -0
- data/include/rays/ruby/texture.h +14 -0
- data/rays.gemspec +1 -1
- data/src/painter.cpp +132 -43
- data/src/point.cpp +65 -30
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f2deaef2e58ab1e422ce210d1f41f96e7560c1a
|
4
|
+
data.tar.gz: d6d88f2c02d8220016a4091d349aa94d9a185334
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6c083d3c3a6c0243e891f6e20156bf1269eeb27dcbf2c9ecd98d4582c997d31de2acbd7fd0ddf898bc3778ebe3d609c176c0dad11c887b5c01b310cf342816b
|
7
|
+
data.tar.gz: 2e71710878a684da44a4da37dbc9c283e8fbdd6e6dfcd7312ae7d9af4237044f09775f271495b664da2aaad842f5480beb38c899f65aa0a352479b1d6ea02ac2
|
data/.doc/ext/rays/bitmap.cpp
CHANGED
@@ -18,13 +18,11 @@ using Rays::uint;
|
|
18
18
|
using Rays::coord;
|
19
19
|
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
RUCY_DEFINE_VALUE_FROM_TO(Rays::Bitmap, cBitmap)
|
21
|
+
RUCY_DEFINE_VALUE_FROM_TO(Rays::Bitmap)
|
24
22
|
|
25
23
|
#define THIS to<Rays::Bitmap*>(self)
|
26
24
|
|
27
|
-
#define CHECK RUCY_CHECK_OBJECT(Rays::Bitmap,
|
25
|
+
#define CHECK RUCY_CHECK_OBJECT(Rays::Bitmap, self)
|
28
26
|
|
29
27
|
|
30
28
|
static
|
@@ -36,7 +34,7 @@ VALUE alloc(VALUE klass)
|
|
36
34
|
static
|
37
35
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
38
36
|
{
|
39
|
-
RUCY_CHECK_OBJ(Rays::Bitmap,
|
37
|
+
RUCY_CHECK_OBJ(Rays::Bitmap, self);
|
40
38
|
|
41
39
|
*THIS = to<Rays::Bitmap&>(obj).copy();
|
42
40
|
return self;
|
@@ -45,7 +43,7 @@ VALUE initialize_copy(VALUE self, VALUE obj)
|
|
45
43
|
static
|
46
44
|
VALUE setup(VALUE self, VALUE width, VALUE height, VALUE color_space)
|
47
45
|
{
|
48
|
-
RUCY_CHECK_OBJ(Rays::Bitmap,
|
46
|
+
RUCY_CHECK_OBJ(Rays::Bitmap, self);
|
49
47
|
|
50
48
|
Rays::ColorSpace* cs = to<Rays::ColorSpace*>(color_space);
|
51
49
|
if (!cs)
|
@@ -143,6 +141,8 @@ VALUE load(VALUE self, VALUE path)
|
|
143
141
|
}
|
144
142
|
|
145
143
|
|
144
|
+
static Class cBitmap;
|
145
|
+
|
146
146
|
void
|
147
147
|
Init_bitmap ()
|
148
148
|
{
|
data/.doc/ext/rays/bounds.cpp
CHANGED
@@ -11,13 +11,11 @@ using namespace Rucy;
|
|
11
11
|
using Rays::coord;
|
12
12
|
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
RUCY_DEFINE_VALUE_FROM_TO(Rays::Bounds, cBounds)
|
14
|
+
RUCY_DEFINE_VALUE_FROM_TO(Rays::Bounds)
|
17
15
|
|
18
16
|
#define THIS to<Rays::Bounds*>(self)
|
19
17
|
|
20
|
-
#define CHECK RUCY_CHECK_OBJ(Rays::Bounds,
|
18
|
+
#define CHECK RUCY_CHECK_OBJ(Rays::Bounds, self)
|
21
19
|
|
22
20
|
|
23
21
|
static
|
@@ -548,6 +546,8 @@ VALUE inspect(VALUE self)
|
|
548
546
|
}
|
549
547
|
|
550
548
|
|
549
|
+
static Class cBounds;
|
550
|
+
|
551
551
|
void
|
552
552
|
Init_bounds ()
|
553
553
|
{
|
data/.doc/ext/rays/color.cpp
CHANGED
@@ -8,13 +8,11 @@
|
|
8
8
|
using namespace Rucy;
|
9
9
|
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
RUCY_DEFINE_VALUE_FROM_TO(Rays::Color, cColor)
|
11
|
+
RUCY_DEFINE_VALUE_FROM_TO(Rays::Color)
|
14
12
|
|
15
13
|
#define THIS to<Rays::Color*>(self)
|
16
14
|
|
17
|
-
#define CHECK RUCY_CHECK_OBJ(Rays::Color,
|
15
|
+
#define CHECK RUCY_CHECK_OBJ(Rays::Color, self)
|
18
16
|
|
19
17
|
|
20
18
|
static
|
@@ -129,6 +127,8 @@ VALUE get_alpha(VALUE self)
|
|
129
127
|
}
|
130
128
|
|
131
129
|
|
130
|
+
static Class cColor;
|
131
|
+
|
132
132
|
void
|
133
133
|
Init_color ()
|
134
134
|
{
|
@@ -8,13 +8,11 @@
|
|
8
8
|
using namespace Rucy;
|
9
9
|
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
RUCY_DEFINE_VALUE_FROM_TO(Rays::ColorSpace, cColorSpace)
|
11
|
+
RUCY_DEFINE_VALUE_FROM_TO(Rays::ColorSpace)
|
14
12
|
|
15
13
|
#define THIS to<Rays::ColorSpace*>(self)
|
16
14
|
|
17
|
-
#define CHECK RUCY_CHECK_OBJ(Rays::ColorSpace,
|
15
|
+
#define CHECK RUCY_CHECK_OBJ(Rays::ColorSpace, self)
|
18
16
|
|
19
17
|
|
20
18
|
static
|
@@ -107,6 +105,8 @@ VALUE is_premult(VALUE self)
|
|
107
105
|
}
|
108
106
|
|
109
107
|
|
108
|
+
static Class cColorSpace;
|
109
|
+
|
110
110
|
void
|
111
111
|
Init_color_space ()
|
112
112
|
{
|
data/.doc/ext/rays/font.cpp
CHANGED
@@ -10,13 +10,11 @@ using namespace Rucy;
|
|
10
10
|
using Rays::coord;
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
RUCY_DEFINE_VALUE_FROM_TO(Rays::Font, cFont)
|
13
|
+
RUCY_DEFINE_VALUE_FROM_TO(Rays::Font)
|
16
14
|
|
17
15
|
#define THIS to<Rays::Font*>(self)
|
18
16
|
|
19
|
-
#define CHECK RUCY_CHECK_OBJECT(Rays::Font,
|
17
|
+
#define CHECK RUCY_CHECK_OBJECT(Rays::Font, self)
|
20
18
|
|
21
19
|
|
22
20
|
static
|
@@ -28,7 +26,7 @@ VALUE alloc(VALUE klass)
|
|
28
26
|
static
|
29
27
|
VALUE initialize(VALUE self)
|
30
28
|
{
|
31
|
-
RUCY_CHECK_OBJ(Rays::Font,
|
29
|
+
RUCY_CHECK_OBJ(Rays::Font, self);
|
32
30
|
check_arg_count(__FILE__, __LINE__, "Font#initialize", argc, 0, 1, 2);
|
33
31
|
|
34
32
|
const char* name = (argc >= 1) ? argv[0].c_str() : NULL;
|
@@ -41,7 +39,7 @@ VALUE initialize(VALUE self)
|
|
41
39
|
static
|
42
40
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
43
41
|
{
|
44
|
-
RUCY_CHECK_OBJ(Rays::Font,
|
42
|
+
RUCY_CHECK_OBJ(Rays::Font, self);
|
45
43
|
|
46
44
|
*THIS = to<Rays::Font&>(obj).copy();
|
47
45
|
return self;
|
@@ -76,6 +74,8 @@ VALUE height(VALUE self)
|
|
76
74
|
}
|
77
75
|
|
78
76
|
|
77
|
+
static Class cFont;
|
78
|
+
|
79
79
|
void
|
80
80
|
Init_font ()
|
81
81
|
{
|
data/.doc/ext/rays/image.cpp
CHANGED
@@ -14,13 +14,11 @@ using namespace Rucy;
|
|
14
14
|
using Rays::coord;
|
15
15
|
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
RUCY_DEFINE_VALUE_FROM_TO(Rays::Image, cImage)
|
17
|
+
RUCY_DEFINE_VALUE_FROM_TO(Rays::Image)
|
20
18
|
|
21
19
|
#define THIS to<Rays::Image*>(self)
|
22
20
|
|
23
|
-
#define CHECK RUCY_CHECK_OBJECT(Rays::Image,
|
21
|
+
#define CHECK RUCY_CHECK_OBJECT(Rays::Image, self)
|
24
22
|
|
25
23
|
|
26
24
|
static
|
@@ -32,7 +30,7 @@ VALUE alloc(VALUE klass)
|
|
32
30
|
static
|
33
31
|
VALUE initialize(VALUE self)
|
34
32
|
{
|
35
|
-
RUCY_CHECK_OBJ(Rays::Image,
|
33
|
+
RUCY_CHECK_OBJ(Rays::Image, self);
|
36
34
|
check_arg_count(__FILE__, __LINE__, "Image#initialize", argc, 1, 2, 3);
|
37
35
|
|
38
36
|
if (argc == 0) return self;
|
@@ -61,7 +59,7 @@ VALUE initialize(VALUE self)
|
|
61
59
|
static
|
62
60
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
63
61
|
{
|
64
|
-
RUCY_CHECK_OBJ(Rays::Image,
|
62
|
+
RUCY_CHECK_OBJ(Rays::Image, self);
|
65
63
|
|
66
64
|
*THIS = to<Rays::Image&>(obj).copy();
|
67
65
|
return self;
|
@@ -132,6 +130,8 @@ VALUE load(VALUE self, VALUE path, VALUE alpha_only)
|
|
132
130
|
}
|
133
131
|
|
134
132
|
|
133
|
+
static Class cImage;
|
134
|
+
|
135
135
|
void
|
136
136
|
Init_image ()
|
137
137
|
{
|
data/.doc/ext/rays/matrix.cpp
CHANGED
@@ -8,13 +8,11 @@
|
|
8
8
|
using namespace Rucy;
|
9
9
|
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
RUCY_DEFINE_VALUE_FROM_TO(Rays::Matrix, cMatrix)
|
11
|
+
RUCY_DEFINE_VALUE_FROM_TO(Rays::Matrix)
|
14
12
|
|
15
13
|
#define THIS to<Rays::Matrix*>(self)
|
16
14
|
|
17
|
-
#define CHECK RUCY_CHECK_OBJ(Rays::Matrix,
|
15
|
+
#define CHECK RUCY_CHECK_OBJ(Rays::Matrix, self)
|
18
16
|
|
19
17
|
|
20
18
|
static
|
@@ -93,6 +91,8 @@ VALUE at(VALUE self, VALUE row, VALUE column)
|
|
93
91
|
}
|
94
92
|
|
95
93
|
|
94
|
+
static Class cMatrix;
|
95
|
+
|
96
96
|
void
|
97
97
|
Init_matrix ()
|
98
98
|
{
|
data/.doc/ext/rays/painter.cpp
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#include "rays/ruby/painter.h"
|
2
2
|
|
3
3
|
|
4
|
+
#include <vector>
|
4
5
|
#include <rucy.h>
|
5
6
|
#include "rays/ruby/point.h"
|
6
7
|
#include "rays/ruby/bounds.h"
|
@@ -17,13 +18,11 @@ using namespace Rucy;
|
|
17
18
|
using Rays::coord;
|
18
19
|
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
RUCY_DEFINE_VALUE_FROM_TO(Rays::Painter, cPainter)
|
21
|
+
RUCY_DEFINE_VALUE_FROM_TO(Rays::Painter)
|
23
22
|
|
24
23
|
#define THIS to<Rays::Painter*>(self)
|
25
24
|
|
26
|
-
#define CHECK RUCY_CHECK_OBJECT(Rays::Painter,
|
25
|
+
#define CHECK RUCY_CHECK_OBJECT(Rays::Painter, self)
|
27
26
|
|
28
27
|
|
29
28
|
static
|
@@ -46,6 +45,14 @@ VALUE canvas(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
|
|
46
45
|
return self;
|
47
46
|
}
|
48
47
|
|
48
|
+
static
|
49
|
+
VALUE bounds(VALUE self)
|
50
|
+
{
|
51
|
+
CHECK;
|
52
|
+
return value(THIS->bounds());
|
53
|
+
}
|
54
|
+
|
55
|
+
|
49
56
|
static
|
50
57
|
VALUE begin_paint(VALUE self)
|
51
58
|
{
|
@@ -62,6 +69,12 @@ VALUE end_paint(VALUE self)
|
|
62
69
|
return self;
|
63
70
|
}
|
64
71
|
|
72
|
+
static
|
73
|
+
VALUE clear(VALUE self)
|
74
|
+
{
|
75
|
+
CHECK;
|
76
|
+
THIS->clear();
|
77
|
+
}
|
65
78
|
|
66
79
|
static
|
67
80
|
VALUE line(VALUE self)
|
@@ -83,6 +96,38 @@ VALUE line(VALUE self)
|
|
83
96
|
return self;
|
84
97
|
}
|
85
98
|
|
99
|
+
static
|
100
|
+
VALUE lines(VALUE self)
|
101
|
+
{
|
102
|
+
CHECK;
|
103
|
+
if (argc <= 0)
|
104
|
+
argument_error(__FILE__, __LINE__, "Painter#lines");
|
105
|
+
|
106
|
+
std::vector<Rays::Coord3> points;
|
107
|
+
points.reserve(argc);
|
108
|
+
for (int i = 0; i < argc; ++i)
|
109
|
+
points.push_back(to<Rays::Point&>(argv[i]));
|
110
|
+
|
111
|
+
THIS->lines((Rays::Point*) &points[0], points.size());
|
112
|
+
return self;
|
113
|
+
}
|
114
|
+
|
115
|
+
static
|
116
|
+
VALUE polygon(VALUE self)
|
117
|
+
{
|
118
|
+
CHECK;
|
119
|
+
if (argc <= 0)
|
120
|
+
argument_error(__FILE__, __LINE__, "Painter#polygon");
|
121
|
+
|
122
|
+
std::vector<Rays::Coord3> points;
|
123
|
+
points.reserve(argc);
|
124
|
+
for (int i = 0; i < argc; ++i)
|
125
|
+
points.push_back(to<Rays::Point&>(argv[i]));
|
126
|
+
|
127
|
+
THIS->polygon((Rays::Point*) &points[0], points.size());
|
128
|
+
return self;
|
129
|
+
}
|
130
|
+
|
86
131
|
static
|
87
132
|
VALUE rect(VALUE self)
|
88
133
|
{
|
@@ -246,20 +291,6 @@ VALUE text(VALUE self)
|
|
246
291
|
return self;
|
247
292
|
}
|
248
293
|
|
249
|
-
static
|
250
|
-
VALUE clear(VALUE self)
|
251
|
-
{
|
252
|
-
CHECK;
|
253
|
-
THIS->clear();
|
254
|
-
}
|
255
|
-
|
256
|
-
static
|
257
|
-
VALUE bounds(VALUE self)
|
258
|
-
{
|
259
|
-
CHECK;
|
260
|
-
return value(THIS->bounds());
|
261
|
-
}
|
262
|
-
|
263
294
|
static
|
264
295
|
VALUE set_background(VALUE self)
|
265
296
|
{
|
@@ -619,6 +650,8 @@ VALUE pop_matrix(VALUE self)
|
|
619
650
|
}
|
620
651
|
|
621
652
|
|
653
|
+
static Class cPainter;
|
654
|
+
|
622
655
|
void
|
623
656
|
Init_painter ()
|
624
657
|
{
|
@@ -628,18 +661,20 @@ Init_painter ()
|
|
628
661
|
rb_define_alloc_func(cPainter, alloc);
|
629
662
|
|
630
663
|
rb_define_method(cPainter, "canvas", RUBY_METHOD_FUNC(canvas), 4);
|
664
|
+
rb_define_method(cPainter, "bounds", RUBY_METHOD_FUNC(bounds), 0);
|
665
|
+
|
631
666
|
rb_define_private_method(cPainter, "begin_paint", RUBY_METHOD_FUNC(begin_paint), 0);
|
632
667
|
rb_define_private_method(cPainter, "end_paint", RUBY_METHOD_FUNC(end_paint), 0);
|
633
|
-
|
668
|
+
rb_define_method(cPainter, "clear", RUBY_METHOD_FUNC(clear), 0);
|
634
669
|
rb_define_method(cPainter, "line", RUBY_METHOD_FUNC(line), -1);
|
670
|
+
rb_define_method(cPainter, "lines", RUBY_METHOD_FUNC(lines), -1);
|
671
|
+
rb_define_method(cPainter, "polygon", RUBY_METHOD_FUNC(polygon), -1);
|
635
672
|
rb_define_method(cPainter, "rect", RUBY_METHOD_FUNC(rect), -1);
|
636
673
|
rb_define_method(cPainter, "ellipse", RUBY_METHOD_FUNC(ellipse), -1);
|
637
674
|
rb_define_method(cPainter, "arc", RUBY_METHOD_FUNC(arc), -1);
|
638
675
|
rb_define_method(cPainter, "image", RUBY_METHOD_FUNC(image), -1);
|
639
676
|
rb_define_method(cPainter, "text", RUBY_METHOD_FUNC(text), -1);
|
640
677
|
|
641
|
-
rb_define_method(cPainter, "clear", RUBY_METHOD_FUNC(clear), 0);
|
642
|
-
rb_define_method(cPainter, "bounds", RUBY_METHOD_FUNC(bounds), 0);
|
643
678
|
rb_define_private_method(cPainter, "set_background", RUBY_METHOD_FUNC(set_background), -1);
|
644
679
|
rb_define_private_method(cPainter, "get_background", RUBY_METHOD_FUNC(get_background), 0);
|
645
680
|
rb_define_method(cPainter, "no_background", RUBY_METHOD_FUNC(no_background), 0);
|
data/.doc/ext/rays/point.cpp
CHANGED
@@ -10,13 +10,11 @@ using namespace Rucy;
|
|
10
10
|
using Rays::coord;
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
RUCY_DEFINE_VALUE_FROM_TO(Rays::Point, cPoint)
|
13
|
+
RUCY_DEFINE_VALUE_FROM_TO(Rays::Point)
|
16
14
|
|
17
15
|
#define THIS to<Rays::Point*>(self)
|
18
16
|
|
19
|
-
#define CHECK RUCY_CHECK_OBJ(Rays::Point,
|
17
|
+
#define CHECK RUCY_CHECK_OBJ(Rays::Point, self)
|
20
18
|
|
21
19
|
|
22
20
|
static
|
@@ -211,6 +209,9 @@ VALUE inspect(VALUE self)
|
|
211
209
|
return value(Xot::stringf("#<Rays::Point %s>", THIS->inspect().c_str()));
|
212
210
|
}
|
213
211
|
|
212
|
+
|
213
|
+
static Class cPoint;
|
214
|
+
|
214
215
|
void
|
215
216
|
Init_point ()
|
216
217
|
{
|
data/.doc/ext/rays/rays.cpp
CHANGED
data/.doc/ext/rays/shader.cpp
CHANGED
@@ -8,13 +8,11 @@
|
|
8
8
|
using namespace Rucy;
|
9
9
|
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
RUCY_DEFINE_VALUE_FROM_TO(Rays::Shader, cShader)
|
11
|
+
RUCY_DEFINE_VALUE_FROM_TO(Rays::Shader)
|
14
12
|
|
15
13
|
#define THIS to<Rays::Shader*>(self)
|
16
14
|
|
17
|
-
#define CHECK RUCY_CHECK_OBJECT(Rays::Shader,
|
15
|
+
#define CHECK RUCY_CHECK_OBJECT(Rays::Shader, self)
|
18
16
|
|
19
17
|
|
20
18
|
static
|
@@ -26,7 +24,7 @@ VALUE alloc(VALUE klass)
|
|
26
24
|
static
|
27
25
|
VALUE initialize(VALUE self, VALUE source)
|
28
26
|
{
|
29
|
-
RUCY_CHECK_OBJ(Rays::Shader,
|
27
|
+
RUCY_CHECK_OBJ(Rays::Shader, self);
|
30
28
|
|
31
29
|
if (!source.is_s())
|
32
30
|
argument_error(__FILE__, __LINE__);
|
@@ -36,6 +34,8 @@ VALUE initialize(VALUE self, VALUE source)
|
|
36
34
|
}
|
37
35
|
|
38
36
|
|
37
|
+
static Class cShader;
|
38
|
+
|
39
39
|
void
|
40
40
|
Init_shader ()
|
41
41
|
{
|