rays 0.1.47 → 0.1.49
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 +287 -46
- data/.doc/ext/rays/camera.cpp +2 -2
- data/.doc/ext/rays/color.cpp +11 -0
- data/.doc/ext/rays/defs.cpp +32 -8
- data/.doc/ext/rays/font.cpp +50 -2
- data/.doc/ext/rays/image.cpp +3 -3
- data/.doc/ext/rays/matrix.cpp +65 -7
- data/.doc/ext/rays/native.cpp +2 -4
- data/.doc/ext/rays/painter.cpp +117 -9
- data/.doc/ext/rays/point.cpp +1 -11
- data/.doc/ext/rays/polygon.cpp +133 -97
- data/.doc/ext/rays/polyline.cpp +89 -10
- data/.doc/ext/rays/rays.cpp +80 -0
- data/.doc/ext/rays/{noise.cpp → util.cpp} +2 -2
- data/ChangeLog.md +46 -0
- data/VERSION +1 -1
- data/ext/rays/bitmap.cpp +288 -46
- data/ext/rays/camera.cpp +2 -2
- data/ext/rays/color.cpp +13 -1
- data/ext/rays/defs.cpp +32 -8
- data/ext/rays/defs.h +56 -3
- data/ext/rays/font.cpp +56 -4
- data/ext/rays/image.cpp +3 -3
- data/ext/rays/matrix.cpp +69 -7
- data/ext/rays/native.cpp +2 -4
- data/ext/rays/painter.cpp +132 -13
- data/ext/rays/point.cpp +1 -12
- data/ext/rays/polygon.cpp +136 -99
- data/ext/rays/polyline.cpp +95 -9
- data/ext/rays/rays.cpp +80 -0
- data/ext/rays/{noise.cpp → util.cpp} +2 -2
- data/include/rays/color.h +3 -1
- data/include/rays/defs.h +24 -26
- data/include/rays/font.h +17 -3
- data/include/rays/image.h +1 -1
- data/include/rays/matrix.h +24 -0
- data/include/rays/painter.h +24 -0
- data/include/rays/polygon.h +68 -43
- data/include/rays/polyline.h +17 -2
- data/include/rays/ruby/polygon.h +0 -11
- data/include/rays/ruby/rays.h +4 -0
- data/include/rays/{noise.h → util.h} +2 -2
- data/lib/rays/color.rb +7 -1
- data/lib/rays/font.rb +1 -1
- data/lib/rays/image.rb +11 -1
- data/lib/rays/matrix.rb +16 -0
- data/lib/rays/painter.rb +18 -7
- data/lib/rays/point.rb +5 -1
- data/lib/rays/polygon.rb +44 -35
- data/lib/rays/polyline.rb +54 -8
- data/lib/rays.rb +0 -1
- data/rays.gemspec +2 -2
- data/src/color.cpp +11 -2
- data/src/font.cpp +37 -18
- data/src/font.h +6 -5
- data/src/image.cpp +58 -14
- data/src/ios/font.mm +89 -32
- data/src/ios/helper.h +2 -2
- data/src/ios/helper.mm +2 -2
- data/src/matrix.cpp +45 -0
- data/src/osx/font.mm +93 -33
- data/src/osx/helper.h +2 -2
- data/src/osx/helper.mm +2 -2
- data/src/painter.cpp +246 -114
- data/src/painter.h +11 -3
- data/src/polygon.cpp +431 -332
- data/src/polyline.cpp +138 -27
- data/src/polyline.h +3 -5
- data/src/shader.cpp +36 -4
- data/src/shader.h +1 -1
- data/src/texture.cpp +23 -4
- data/src/texture.h +2 -0
- data/src/{noise.cpp → util.cpp} +1 -1
- data/src/win32/font.cpp +1 -1
- data/test/test_bitmap.rb +12 -5
- data/test/test_color.rb +25 -4
- data/test/test_font.rb +23 -2
- data/test/test_image.rb +44 -18
- data/test/test_matrix.rb +22 -0
- data/test/test_painter.rb +27 -0
- data/test/test_point.rb +1 -1
- data/test/test_polygon.rb +52 -45
- data/test/test_polyline.rb +191 -72
- metadata +12 -18
- data/.doc/ext/rays/polygon_line.cpp +0 -97
- data/ext/rays/polygon_line.cpp +0 -100
- data/lib/rays/polygon_line.rb +0 -33
- data/test/test_polygon_line.rb +0 -164
data/include/rays/defs.h
CHANGED
@@ -23,32 +23,6 @@ namespace Rays
|
|
23
23
|
typedef float coord;
|
24
24
|
|
25
25
|
|
26
|
-
enum DrawMode
|
27
|
-
{
|
28
|
-
|
29
|
-
DRAW_POINTS = 0,
|
30
|
-
|
31
|
-
DRAW_LINES,
|
32
|
-
|
33
|
-
DRAW_LINE_STRIP,
|
34
|
-
|
35
|
-
DRAW_TRIANGLES,
|
36
|
-
|
37
|
-
DRAW_TRIANGLE_STRIP,
|
38
|
-
|
39
|
-
DRAW_TRIANGLE_FAN,
|
40
|
-
|
41
|
-
DRAW_QUADS,
|
42
|
-
|
43
|
-
DRAW_QUAD_STRIP,
|
44
|
-
|
45
|
-
DRAW_POLYGON,
|
46
|
-
|
47
|
-
DRAW_MAX,
|
48
|
-
|
49
|
-
};// DrawMode
|
50
|
-
|
51
|
-
|
52
26
|
enum CapType
|
53
27
|
{
|
54
28
|
|
@@ -108,6 +82,30 @@ namespace Rays
|
|
108
82
|
};// BlendMode
|
109
83
|
|
110
84
|
|
85
|
+
enum TexCoordMode
|
86
|
+
{
|
87
|
+
|
88
|
+
TEXCOORD_IMAGE = 0,
|
89
|
+
|
90
|
+
TEXCOORD_NORMAL,
|
91
|
+
|
92
|
+
TEXCOORD_MODE_MAX
|
93
|
+
|
94
|
+
};// TexCoordMode
|
95
|
+
|
96
|
+
|
97
|
+
enum TexCoordWrap
|
98
|
+
{
|
99
|
+
|
100
|
+
TEXCOORD_CLAMP = 0,
|
101
|
+
|
102
|
+
TEXCOORD_REPEAT,
|
103
|
+
|
104
|
+
TEXCOORD_WRAP_MAX
|
105
|
+
|
106
|
+
};// TexCoordWrap
|
107
|
+
|
108
|
+
|
111
109
|
}// Rays
|
112
110
|
|
113
111
|
|
data/include/rays/font.h
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
#define __RAYS_FONT_H__
|
5
5
|
|
6
6
|
|
7
|
+
#include <vector>
|
8
|
+
#include <map>
|
7
9
|
#include <xot/pimpl.h>
|
8
10
|
#include <rays/defs.h>
|
9
11
|
|
@@ -17,15 +19,21 @@ namespace Rays
|
|
17
19
|
|
18
20
|
public:
|
19
21
|
|
22
|
+
enum {DEFAULT_SIZE = 12};
|
23
|
+
|
20
24
|
Font ();
|
21
25
|
|
22
|
-
Font (const char* name, coord size =
|
26
|
+
Font (const char* name, coord size = DEFAULT_SIZE);
|
23
27
|
|
24
28
|
~Font ();
|
25
29
|
|
30
|
+
Font dup () const;
|
31
|
+
|
26
32
|
String name () const;
|
27
33
|
|
28
|
-
coord size
|
34
|
+
void set_size (coord size);
|
35
|
+
|
36
|
+
coord size () const;
|
29
37
|
|
30
38
|
coord get_width (const char* str) const;
|
31
39
|
|
@@ -45,7 +53,13 @@ namespace Rays
|
|
45
53
|
};// Font
|
46
54
|
|
47
55
|
|
48
|
-
|
56
|
+
typedef std::map<String, std::vector<String>> FontFamilyMap;
|
57
|
+
|
58
|
+
const FontFamilyMap& get_font_families ();
|
59
|
+
|
60
|
+
Font load_font (const char* path, coord size = Font::DEFAULT_SIZE);
|
61
|
+
|
62
|
+
const Font& get_default_font ();
|
49
63
|
|
50
64
|
|
51
65
|
}// Rays
|
data/include/rays/image.h
CHANGED
data/include/rays/matrix.h
CHANGED
@@ -57,6 +57,8 @@ namespace Rays
|
|
57
57
|
|
58
58
|
This& reset (const coord* elements, size_t size);
|
59
59
|
|
60
|
+
This& transpose ();
|
61
|
+
|
60
62
|
This& translate (coord x, coord y, coord z = 0);
|
61
63
|
|
62
64
|
This& translate (const Coord3& translate);
|
@@ -92,6 +94,28 @@ namespace Rays
|
|
92
94
|
};// Matrix
|
93
95
|
|
94
96
|
|
97
|
+
Matrix ortho (
|
98
|
+
coord left, coord right,
|
99
|
+
coord top, coord bottom);
|
100
|
+
|
101
|
+
Matrix ortho (
|
102
|
+
coord left, coord right,
|
103
|
+
coord top, coord bottom,
|
104
|
+
coord near, coord far);
|
105
|
+
|
106
|
+
Matrix perspective (float fov_y, float aspect_ratio, coord near, coord far);
|
107
|
+
|
108
|
+
Matrix look_at (
|
109
|
+
coord eye_x, coord eye_y, coord eye_z,
|
110
|
+
coord target_x, coord target_y, coord target_z,
|
111
|
+
coord up_x = 0, coord up_y = 1, coord up_z = 0);
|
112
|
+
|
113
|
+
Matrix look_at (
|
114
|
+
const Point& eye,
|
115
|
+
const Point& target,
|
116
|
+
const Point& up = Point(0, 1, 0));
|
117
|
+
|
118
|
+
|
95
119
|
}// Rays
|
96
120
|
|
97
121
|
|
data/include/rays/painter.h
CHANGED
@@ -77,6 +77,12 @@ namespace Rays
|
|
77
77
|
void polygon (
|
78
78
|
const Polygon& polygon, const Bounds& bounds);
|
79
79
|
|
80
|
+
void point (coord x, coord y);
|
81
|
+
|
82
|
+
void point (const Point& point);
|
83
|
+
|
84
|
+
void points (const Point* points, size_t size);
|
85
|
+
|
80
86
|
void line (coord x1, coord y1, coord x2, coord y2);
|
81
87
|
|
82
88
|
void line (const Point& p1, const Point& p2);
|
@@ -235,6 +241,10 @@ namespace Rays
|
|
235
241
|
|
236
242
|
uint nsegment () const;
|
237
243
|
|
244
|
+
void set_line_height (coord height);
|
245
|
+
|
246
|
+
coord line_height (bool raw = false) const;
|
247
|
+
|
238
248
|
void set_blend_mode (BlendMode mode);
|
239
249
|
|
240
250
|
BlendMode blend_mode () const;
|
@@ -253,6 +263,20 @@ namespace Rays
|
|
253
263
|
|
254
264
|
const Font& font () const;
|
255
265
|
|
266
|
+
void set_texture (const Image& image);
|
267
|
+
|
268
|
+
void no_texture ();
|
269
|
+
|
270
|
+
const Image& texture () const;
|
271
|
+
|
272
|
+
void set_texcoord_mode (TexCoordMode mode);
|
273
|
+
|
274
|
+
TexCoordMode texcoord_mode () const;
|
275
|
+
|
276
|
+
void set_texcoord_wrap (TexCoordWrap wrap);
|
277
|
+
|
278
|
+
TexCoordWrap texcoord_wrap () const;
|
279
|
+
|
256
280
|
void set_shader (const Shader& shader);
|
257
281
|
|
258
282
|
void no_shader ();
|
data/include/rays/polygon.h
CHANGED
@@ -20,50 +20,19 @@ namespace Rays
|
|
20
20
|
|
21
21
|
public:
|
22
22
|
|
23
|
-
|
24
|
-
{
|
23
|
+
typedef std::vector<Polyline> PolylineList;
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
public:
|
29
|
-
|
30
|
-
Line ();
|
31
|
-
|
32
|
-
Line (
|
33
|
-
const Point* points, size_t size,
|
34
|
-
bool loop = true,
|
35
|
-
bool hole = false);
|
36
|
-
|
37
|
-
Line (const Polyline& polyline, bool hole = false);
|
38
|
-
|
39
|
-
bool hole () const;
|
40
|
-
|
41
|
-
operator bool () const;
|
42
|
-
|
43
|
-
bool operator ! () const;
|
44
|
-
|
45
|
-
private:
|
46
|
-
|
47
|
-
bool hole_;
|
48
|
-
|
49
|
-
};// Line
|
50
|
-
|
51
|
-
typedef std::vector<Line> LineList;
|
52
|
-
|
53
|
-
typedef LineList::const_iterator const_iterator;
|
25
|
+
typedef PolylineList::const_iterator const_iterator;
|
54
26
|
|
55
27
|
Polygon ();
|
56
28
|
|
57
29
|
Polygon (
|
58
|
-
const Point* points, size_t size, bool loop = true
|
59
|
-
|
60
|
-
Polygon (
|
61
|
-
DrawMode mode,
|
62
|
-
const Point* points, size_t size, bool loop = true);
|
30
|
+
const Point* points, size_t size, bool loop = true,
|
31
|
+
const Color* colors = NULL, const Coord3* texcoords = NULL);
|
63
32
|
|
64
33
|
Polygon (const Polyline& polyline);
|
65
34
|
|
66
|
-
Polygon (const
|
35
|
+
Polygon (const Polyline* polylines, size_t size);
|
67
36
|
|
68
37
|
~Polygon ();
|
69
38
|
|
@@ -84,12 +53,14 @@ namespace Rays
|
|
84
53
|
|
85
54
|
const_iterator end () const;
|
86
55
|
|
87
|
-
const
|
56
|
+
const Polyline& operator [] (size_t index) const;
|
88
57
|
|
89
58
|
operator bool () const;
|
90
59
|
|
91
60
|
bool operator ! () const;
|
92
61
|
|
62
|
+
friend Polygon operator + (const Polygon& lhs, const Polyline& rhs);
|
63
|
+
|
93
64
|
friend Polygon operator + (const Polygon& lhs, const Polygon& rhs);
|
94
65
|
|
95
66
|
friend Polygon operator - (const Polygon& lhs, const Polygon& rhs);
|
@@ -115,6 +86,13 @@ namespace Rays
|
|
115
86
|
};// Polygon
|
116
87
|
|
117
88
|
|
89
|
+
Polygon create_point (coord x, coord y);
|
90
|
+
|
91
|
+
Polygon create_point (const Point& point);
|
92
|
+
|
93
|
+
Polygon create_points (const Point* points, size_t size);
|
94
|
+
|
95
|
+
|
118
96
|
Polygon create_line (coord x1, coord y1, coord x2, coord y2);
|
119
97
|
|
120
98
|
Polygon create_line (const Point& p1, const Point& p2);
|
@@ -123,6 +101,29 @@ namespace Rays
|
|
123
101
|
|
124
102
|
Polygon create_line (const Polyline& polyline);
|
125
103
|
|
104
|
+
Polygon create_lines (const Point* points, size_t size);
|
105
|
+
|
106
|
+
|
107
|
+
Polygon create_triangle (
|
108
|
+
coord x1, coord y1, coord x2, coord y2, coord x3, coord y3,
|
109
|
+
bool loop = true);
|
110
|
+
|
111
|
+
Polygon create_triangle (
|
112
|
+
const Point& p1, const Point& p2, const Point& p3,
|
113
|
+
bool loop = true);
|
114
|
+
|
115
|
+
Polygon create_triangles (
|
116
|
+
const Point* points, size_t size, bool loop = true,
|
117
|
+
const Color* colors = NULL, const Coord3* texcoords = NULL);
|
118
|
+
|
119
|
+
Polygon create_triangle_strip (
|
120
|
+
const Point* points, size_t size,
|
121
|
+
const Color* colors = NULL, const Coord3* texcoords = NULL);
|
122
|
+
|
123
|
+
Polygon create_triangle_fan (
|
124
|
+
const Point* points, size_t size,
|
125
|
+
const Color* colors = NULL, const Coord3* texcoords = NULL);
|
126
|
+
|
126
127
|
|
127
128
|
Polygon create_rect (
|
128
129
|
coord x, coord y, coord width, coord height,
|
@@ -147,6 +148,24 @@ namespace Rays
|
|
147
148
|
uint nsegment = 0);
|
148
149
|
|
149
150
|
|
151
|
+
Polygon create_quad (
|
152
|
+
coord x1, coord y1, coord x2, coord y2,
|
153
|
+
coord x3, coord y3, coord x4, coord y4,
|
154
|
+
bool loop = true);
|
155
|
+
|
156
|
+
Polygon create_quad (
|
157
|
+
const Point& p1, const Point& p2, const Point& p3, const Point& p4,
|
158
|
+
bool loop = true);
|
159
|
+
|
160
|
+
Polygon create_quads (
|
161
|
+
const Point* points, size_t size, bool loop = true,
|
162
|
+
const Color* colors = NULL, const Coord3* texcoords = NULL);
|
163
|
+
|
164
|
+
Polygon create_quad_strip (
|
165
|
+
const Point* points, size_t size,
|
166
|
+
const Color* colors = NULL, const Coord3* texcoords = NULL);
|
167
|
+
|
168
|
+
|
150
169
|
Polygon create_ellipse (
|
151
170
|
coord x, coord y, coord width, coord height = 0,
|
152
171
|
const Point& hole_size = 0,
|
@@ -172,29 +191,35 @@ namespace Rays
|
|
172
191
|
Polygon create_curve (
|
173
192
|
coord x1, coord y1, coord x2, coord y2,
|
174
193
|
coord x3, coord y3, coord x4, coord y4,
|
175
|
-
bool loop
|
194
|
+
bool loop = false,
|
195
|
+
uint nsegment = 0);
|
176
196
|
|
177
197
|
Polygon create_curve (
|
178
198
|
const Point& p1, const Point& p2, const Point& p3, const Point& p4,
|
179
|
-
bool loop
|
199
|
+
bool loop = false,
|
200
|
+
uint nsegment = 0);
|
180
201
|
|
181
202
|
Polygon create_curve (
|
182
203
|
const Point* points, size_t size,
|
183
|
-
bool loop
|
204
|
+
bool loop = false,
|
205
|
+
uint nsegment = 0);
|
184
206
|
|
185
207
|
|
186
208
|
Polygon create_bezier (
|
187
209
|
coord x1, coord y1, coord x2, coord y2,
|
188
210
|
coord x3, coord y3, coord x4, coord y4,
|
189
|
-
bool loop
|
211
|
+
bool loop = false,
|
212
|
+
uint nsegment = 0);
|
190
213
|
|
191
214
|
Polygon create_bezier (
|
192
215
|
const Point& p1, const Point& p2, const Point& p3, const Point& p4,
|
193
|
-
bool loop
|
216
|
+
bool loop = false,
|
217
|
+
uint nsegment = 0);
|
194
218
|
|
195
219
|
Polygon create_bezier (
|
196
220
|
const Point* points, size_t size,
|
197
|
-
bool loop
|
221
|
+
bool loop = false,
|
222
|
+
uint nsegment = 0);
|
198
223
|
|
199
224
|
|
200
225
|
}// Rays
|
data/include/rays/polyline.h
CHANGED
@@ -15,6 +15,7 @@ namespace Rays
|
|
15
15
|
{
|
16
16
|
|
17
17
|
|
18
|
+
struct Color;
|
18
19
|
class Polygon;
|
19
20
|
|
20
21
|
|
@@ -29,9 +30,15 @@ namespace Rays
|
|
29
30
|
|
30
31
|
Polyline ();
|
31
32
|
|
32
|
-
Polyline (
|
33
|
+
Polyline (
|
34
|
+
const Point* points, size_t size, bool loop = false,
|
35
|
+
const Color* colors = NULL, const Coord3* texcoords = NULL,
|
36
|
+
bool hole = false);
|
33
37
|
|
34
|
-
Polyline (
|
38
|
+
Polyline (
|
39
|
+
const Point* points, size_t size, bool loop, bool fill,
|
40
|
+
const Color* colors = NULL, const Coord3* texcoords = NULL,
|
41
|
+
bool hole = false);
|
35
42
|
|
36
43
|
~Polyline ();
|
37
44
|
|
@@ -48,6 +55,14 @@ namespace Rays
|
|
48
55
|
|
49
56
|
bool fill () const;
|
50
57
|
|
58
|
+
bool hole () const;
|
59
|
+
|
60
|
+
const Point* points () const;
|
61
|
+
|
62
|
+
const Color* colors () const;
|
63
|
+
|
64
|
+
const Coord3* texcoords () const;
|
65
|
+
|
51
66
|
size_t size () const;
|
52
67
|
|
53
68
|
bool empty () const;
|
data/include/rays/ruby/polygon.h
CHANGED
@@ -11,8 +11,6 @@
|
|
11
11
|
|
12
12
|
RUCY_DECLARE_VALUE_OR_ARRAY_FROM_TO(Rays::Polygon)
|
13
13
|
|
14
|
-
RUCY_DECLARE_VALUE_OR_ARRAY_FROM_TO(Rays::Polygon::Line)
|
15
|
-
|
16
14
|
|
17
15
|
namespace Rays
|
18
16
|
{
|
@@ -21,9 +19,6 @@ namespace Rays
|
|
21
19
|
Rucy::Class polygon_class ();
|
22
20
|
// class Rays::Polygon
|
23
21
|
|
24
|
-
Rucy::Class polygon_line_class ();
|
25
|
-
// class Rays::Polygon::Line
|
26
|
-
|
27
22
|
|
28
23
|
}// Rays
|
29
24
|
|
@@ -38,12 +33,6 @@ namespace Rucy
|
|
38
33
|
return Rays::polygon_class();
|
39
34
|
}
|
40
35
|
|
41
|
-
template <> inline Class
|
42
|
-
get_ruby_class<Rays::Polygon::Line> ()
|
43
|
-
{
|
44
|
-
return Rays::polygon_line_class();
|
45
|
-
}
|
46
|
-
|
47
36
|
|
48
37
|
}// Rucy
|
49
38
|
|
data/include/rays/ruby/rays.h
CHANGED
data/lib/rays/color.rb
CHANGED
@@ -21,6 +21,8 @@ module Rays
|
|
21
21
|
alias a= alpha=
|
22
22
|
alias a alpha
|
23
23
|
|
24
|
+
alias to_hsb to_hsv
|
25
|
+
|
24
26
|
def opaque?()
|
25
27
|
alpha >= 1
|
26
28
|
end
|
@@ -82,7 +84,11 @@ module Rays
|
|
82
84
|
end
|
83
85
|
|
84
86
|
def inspect()
|
85
|
-
"#<#{self.class.name} #{
|
87
|
+
"#<#{self.class.name} #{to_a.join ' '}>"
|
88
|
+
end
|
89
|
+
|
90
|
+
class << self
|
91
|
+
alias hsb hsv
|
86
92
|
end
|
87
93
|
|
88
94
|
end# Color
|
data/lib/rays/font.rb
CHANGED
data/lib/rays/image.rb
CHANGED
@@ -9,7 +9,9 @@ module Rays
|
|
9
9
|
|
10
10
|
extend Forwardable
|
11
11
|
|
12
|
-
def_delegators :bitmap,
|
12
|
+
def_delegators :bitmap, :pixels, :[]
|
13
|
+
|
14
|
+
def_delegators :bitmap_for_write, :pixels=, :[]=
|
13
15
|
|
14
16
|
def paint(&block)
|
15
17
|
painter.paint self, &block
|
@@ -24,6 +26,14 @@ module Rays
|
|
24
26
|
Bounds.new 0, 0, width, height
|
25
27
|
end
|
26
28
|
|
29
|
+
def bitmap(modify = false)
|
30
|
+
get_bitmap modify
|
31
|
+
end
|
32
|
+
|
33
|
+
private def bitmap_for_write()
|
34
|
+
get_bitmap true
|
35
|
+
end
|
36
|
+
|
27
37
|
end# Image
|
28
38
|
|
29
39
|
|
data/lib/rays/matrix.rb
CHANGED
@@ -9,6 +9,22 @@ module Rays
|
|
9
9
|
include Comparable
|
10
10
|
include Enumerable
|
11
11
|
|
12
|
+
def transpose()
|
13
|
+
dup.transpose!
|
14
|
+
end
|
15
|
+
|
16
|
+
def translate(*args)
|
17
|
+
dup.translate!(*args)
|
18
|
+
end
|
19
|
+
|
20
|
+
def scale(*args)
|
21
|
+
dup.scale!(*args)
|
22
|
+
end
|
23
|
+
|
24
|
+
def rotate(*args)
|
25
|
+
dup.rotate!(*args)
|
26
|
+
end
|
27
|
+
|
12
28
|
def each(&block)
|
13
29
|
to_a.each(&block)
|
14
30
|
end
|
data/lib/rays/painter.rb
CHANGED
@@ -57,26 +57,26 @@ module Rays
|
|
57
57
|
|
58
58
|
def line(*args, loop: false)
|
59
59
|
if args.first.kind_of?(Polyline)
|
60
|
-
|
60
|
+
polyline! args.first
|
61
61
|
else
|
62
|
-
|
62
|
+
line! args, loop
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
def rect(*args, round: nil, lt: nil, rt: nil, lb: nil, rb: nil)
|
67
|
-
|
67
|
+
rect! args, round, lt, rt, lb, rb
|
68
68
|
end
|
69
69
|
|
70
70
|
def ellipse(*args, center: nil, radius: nil, hole: nil, from: nil, to: nil)
|
71
|
-
|
71
|
+
ellipse! args, center, radius, hole, from, to
|
72
72
|
end
|
73
73
|
|
74
74
|
def curve(*args, loop: false)
|
75
|
-
|
75
|
+
curve! args, loop
|
76
76
|
end
|
77
77
|
|
78
78
|
def bezier(*args, loop: false)
|
79
|
-
|
79
|
+
bezier! args, loop
|
80
80
|
end
|
81
81
|
|
82
82
|
def color=(fill, stroke = nil)
|
@@ -118,9 +118,20 @@ module Rays
|
|
118
118
|
replace: BLEND_REPLACE
|
119
119
|
}
|
120
120
|
|
121
|
+
const_symbol_accessor :texcoord_mode, **{
|
122
|
+
image: TEXCOORD_IMAGE,
|
123
|
+
normal: TEXCOORD_NORMAL
|
124
|
+
}
|
125
|
+
|
126
|
+
const_symbol_accessor :texcoord_wrap, **{
|
127
|
+
clamp: TEXCOORD_CLAMP,
|
128
|
+
repeat: TEXCOORD_REPEAT
|
129
|
+
}
|
130
|
+
|
121
131
|
universal_accessor :background, :fill, :stroke, :color,
|
122
132
|
:stroke_width, :stroke_outset, :stroke_cap, :stroke_join, :miter_limit,
|
123
|
-
:nsegment, :
|
133
|
+
:nsegment, :line_height, :blend_mode, :clip, :font,
|
134
|
+
:texture, :texcoord_mode, :texcoord_wrap, :shader
|
124
135
|
|
125
136
|
private
|
126
137
|
|
data/lib/rays/point.rb
CHANGED
@@ -17,6 +17,10 @@ module Rays
|
|
17
17
|
dup.move_by!(*args)
|
18
18
|
end
|
19
19
|
|
20
|
+
def rotate(degree)
|
21
|
+
dup.rotate!(degree)
|
22
|
+
end
|
23
|
+
|
20
24
|
def zero?()
|
21
25
|
length == 0
|
22
26
|
end
|
@@ -47,7 +51,7 @@ module Rays
|
|
47
51
|
end
|
48
52
|
|
49
53
|
def inspect()
|
50
|
-
"#<Rays::Point #{to_a(3).join '
|
54
|
+
"#<Rays::Point #{to_a(3).join ' '}>"
|
51
55
|
end
|
52
56
|
|
53
57
|
end# Point
|