rays 0.1.12 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.doc/ext/rays/bitmap.cpp +22 -76
- data/.doc/ext/rays/bounds.cpp +95 -125
- data/.doc/ext/rays/camera.cpp +171 -0
- data/.doc/ext/rays/color.cpp +223 -45
- data/.doc/ext/rays/color_space.cpp +146 -46
- data/.doc/ext/rays/defs.cpp +183 -0
- data/.doc/ext/rays/font.cpp +69 -21
- data/.doc/ext/rays/image.cpp +26 -37
- data/.doc/ext/rays/matrix.cpp +186 -29
- data/.doc/ext/rays/native.cpp +14 -8
- data/.doc/ext/rays/noise.cpp +53 -0
- data/.doc/ext/rays/painter.cpp +187 -292
- data/.doc/ext/rays/point.cpp +96 -77
- data/.doc/ext/rays/polygon.cpp +313 -0
- data/.doc/ext/rays/polygon_line.cpp +96 -0
- data/.doc/ext/rays/polyline.cpp +167 -0
- data/.doc/ext/rays/rays.cpp +103 -12
- data/.doc/ext/rays/shader.cpp +83 -9
- data/LICENSE +21 -0
- data/README.md +1 -1
- data/Rakefile +24 -9
- data/VERSION +1 -1
- data/ext/rays/bitmap.cpp +23 -81
- data/ext/rays/bounds.cpp +100 -128
- data/ext/rays/camera.cpp +186 -0
- data/ext/rays/color.cpp +231 -51
- data/ext/rays/color_space.cpp +149 -47
- data/ext/rays/defs.cpp +183 -0
- data/ext/rays/defs.h +26 -2
- data/ext/rays/extconf.rb +2 -3
- data/ext/rays/font.cpp +74 -24
- data/ext/rays/image.cpp +28 -40
- data/ext/rays/matrix.cpp +198 -30
- data/ext/rays/native.cpp +14 -8
- data/ext/rays/noise.cpp +55 -0
- data/ext/rays/painter.cpp +203 -298
- data/ext/rays/point.cpp +105 -81
- data/ext/rays/polygon.cpp +329 -0
- data/ext/rays/polygon_line.cpp +99 -0
- data/ext/rays/polyline.cpp +176 -0
- data/ext/rays/rays.cpp +103 -13
- 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/camera.h +74 -0
- data/include/rays/color.h +25 -14
- data/include/rays/color_space.h +15 -10
- data/include/rays/coord.h +114 -0
- data/include/rays/debug.h +22 -0
- data/include/rays/defs.h +36 -0
- data/include/rays/exception.h +6 -2
- data/include/rays/font.h +4 -4
- data/include/rays/image.h +12 -18
- 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 +89 -93
- data/include/rays/point.h +44 -51
- data/include/rays/polygon.h +198 -0
- data/include/rays/polyline.h +71 -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/camera.h +41 -0
- 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/rays.h +8 -0
- data/include/rays/ruby/shader.h +1 -1
- data/include/rays/shader.h +36 -8
- data/lib/rays.rb +7 -2
- data/lib/rays/bitmap.rb +0 -15
- data/lib/rays/bounds.rb +17 -23
- data/lib/rays/camera.rb +24 -0
- data/lib/rays/color.rb +20 -47
- data/lib/rays/color_space.rb +13 -13
- data/lib/rays/image.rb +3 -7
- data/lib/rays/matrix.rb +28 -0
- data/lib/rays/module.rb +4 -19
- data/lib/rays/painter.rb +78 -93
- data/lib/rays/point.rb +13 -21
- data/lib/rays/polygon.rb +58 -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 +52 -34
- 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 +172 -98
- data/src/image.h +25 -0
- data/src/ios/bitmap.h +23 -0
- data/src/ios/bitmap.mm +133 -110
- data/src/ios/camera.mm +510 -0
- data/src/ios/font.mm +50 -62
- data/src/ios/helper.h +4 -4
- 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.h +23 -0
- data/src/osx/bitmap.mm +133 -110
- data/src/osx/camera.mm +451 -0
- data/src/osx/font.mm +49 -62
- 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 +845 -671
- data/src/painter.h +24 -0
- data/src/point.cpp +140 -119
- data/src/polygon.cpp +1266 -0
- data/src/polygon.h +32 -0
- data/src/polyline.cpp +160 -0
- data/src/polyline.h +69 -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_font.rb +5 -0
- data/test/test_image.rb +24 -20
- data/test/test_matrix.rb +106 -0
- data/test/test_painter.rb +157 -51
- data/test/test_painter_shape.rb +102 -0
- data/test/test_point.rb +29 -0
- data/test/test_polygon.rb +234 -0
- data/test/test_polygon_line.rb +167 -0
- data/test/test_polyline.rb +171 -0
- data/test/test_shader.rb +9 -9
- metadata +102 -70
- 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/include/rays/defs.h
CHANGED
@@ -4,6 +4,9 @@
|
|
4
4
|
#define __RAYS_DEFS_H__
|
5
5
|
|
6
6
|
|
7
|
+
#define GLM_FORCE_CXX03
|
8
|
+
|
9
|
+
|
7
10
|
#include <xot/defs.h>
|
8
11
|
#include <xot/string.h>
|
9
12
|
|
@@ -20,6 +23,39 @@ namespace Rays
|
|
20
23
|
typedef float coord;
|
21
24
|
|
22
25
|
|
26
|
+
enum CapType
|
27
|
+
{
|
28
|
+
|
29
|
+
CAP_BUTT = 0,
|
30
|
+
|
31
|
+
CAP_ROUND,
|
32
|
+
|
33
|
+
CAP_SQUARE,
|
34
|
+
|
35
|
+
CAP_MAX,
|
36
|
+
|
37
|
+
CAP_DEFAULT = CAP_BUTT
|
38
|
+
|
39
|
+
};// CapType
|
40
|
+
|
41
|
+
|
42
|
+
enum JoinType
|
43
|
+
{
|
44
|
+
|
45
|
+
JOIN_MITER = 0,
|
46
|
+
|
47
|
+
JOIN_ROUND,
|
48
|
+
|
49
|
+
JOIN_SQUARE,
|
50
|
+
|
51
|
+
JOIN_MAX,
|
52
|
+
|
53
|
+
JOIN_DEFAULT = JOIN_MITER,
|
54
|
+
JOIN_DEFAULT_MITER_LIMIT = 2
|
55
|
+
|
56
|
+
};// JoinType
|
57
|
+
|
58
|
+
|
23
59
|
}// Rays
|
24
60
|
|
25
61
|
|
data/include/rays/exception.h
CHANGED
@@ -31,9 +31,13 @@ namespace Rays
|
|
31
31
|
|
32
32
|
using namespace Xot::ErrorFunctions;
|
33
33
|
|
34
|
-
|
34
|
+
[[noreturn]]
|
35
|
+
void rays_error (
|
36
|
+
const char* file, int line, const char* format = NULL, ...);
|
35
37
|
|
36
|
-
|
38
|
+
[[noreturn]]
|
39
|
+
void opengl_error (
|
40
|
+
const char* file, int line, const char* format = NULL, ...);
|
37
41
|
|
38
42
|
}// ErrorFunctions
|
39
43
|
|
data/include/rays/font.h
CHANGED
@@ -23,8 +23,6 @@ namespace Rays
|
|
23
23
|
|
24
24
|
~Font ();
|
25
25
|
|
26
|
-
Font copy () const;
|
27
|
-
|
28
26
|
String name () const;
|
29
27
|
|
30
28
|
coord size () const;
|
@@ -32,7 +30,9 @@ namespace Rays
|
|
32
30
|
coord get_width (const char* str) const;
|
33
31
|
|
34
32
|
coord get_height (
|
35
|
-
coord* ascent
|
33
|
+
coord* ascent = NULL,
|
34
|
+
coord* descent = NULL,
|
35
|
+
coord* leading = NULL) const;
|
36
36
|
|
37
37
|
operator bool () const;
|
38
38
|
|
@@ -40,7 +40,7 @@ namespace Rays
|
|
40
40
|
|
41
41
|
struct Data;
|
42
42
|
|
43
|
-
Xot::
|
43
|
+
Xot::PSharedImpl<Data> self;
|
44
44
|
|
45
45
|
};// Font
|
46
46
|
|
data/include/rays/image.h
CHANGED
@@ -15,8 +15,6 @@ namespace Rays
|
|
15
15
|
|
16
16
|
class Bitmap;
|
17
17
|
|
18
|
-
class Texture;
|
19
|
-
|
20
18
|
|
21
19
|
class Image
|
22
20
|
{
|
@@ -28,48 +26,44 @@ namespace Rays
|
|
28
26
|
Image ();
|
29
27
|
|
30
28
|
Image (
|
31
|
-
int width, int height, const ColorSpace& cs =
|
32
|
-
|
29
|
+
int width, int height, const ColorSpace& cs = DEFAULT_COLOR_SPACE,
|
30
|
+
float pixel_density = 1);
|
33
31
|
|
34
|
-
Image (const Bitmap& bitmap,
|
32
|
+
Image (const Bitmap& bitmap, float pixel_density = 1);
|
35
33
|
|
36
34
|
~Image ();
|
37
35
|
|
38
|
-
Image
|
39
|
-
|
40
|
-
Painter painter ();
|
36
|
+
Image dup () const;
|
41
37
|
|
42
|
-
|
38
|
+
coord width () const;
|
43
39
|
|
44
|
-
|
40
|
+
coord height () const;
|
45
41
|
|
46
42
|
const ColorSpace& color_space () const;
|
47
43
|
|
48
|
-
|
44
|
+
float pixel_density () const;
|
45
|
+
|
46
|
+
Painter painter ();
|
49
47
|
|
50
48
|
Bitmap& bitmap ();
|
51
49
|
|
52
50
|
const Bitmap& bitmap () const;
|
53
51
|
|
54
|
-
Texture& texture ();
|
55
|
-
|
56
|
-
const Texture& texture () const;
|
57
|
-
|
58
52
|
operator bool () const;
|
59
53
|
|
60
54
|
bool operator ! () const;
|
61
55
|
|
62
56
|
struct Data;
|
63
57
|
|
64
|
-
Xot::
|
58
|
+
Xot::PSharedImpl<Data> self;
|
65
59
|
|
66
60
|
};// Image
|
67
61
|
|
68
62
|
|
69
|
-
Image load_image (const char* path, bool alphatexture = false);
|
70
|
-
|
71
63
|
void save_image (const Image& image, const char* path);
|
72
64
|
|
65
|
+
Image load_image (const char* path);
|
66
|
+
|
73
67
|
|
74
68
|
}// Rays
|
75
69
|
|
data/include/rays/matrix.h
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
|
7
7
|
#include <rays/defs.h>
|
8
|
+
#include <rays/point.h>
|
8
9
|
|
9
10
|
|
10
11
|
namespace Rays
|
@@ -14,48 +15,73 @@ namespace Rays
|
|
14
15
|
struct Matrix
|
15
16
|
{
|
16
17
|
|
18
|
+
typedef Matrix This;
|
19
|
+
|
20
|
+
enum {NROW = 4, NCOLUMN = 4, NELEM = NROW * NCOLUMN};
|
21
|
+
|
17
22
|
union
|
18
23
|
{
|
19
24
|
struct
|
20
25
|
{
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
+
coord
|
27
|
+
x0, y0, z0, w0,
|
28
|
+
x1, y1, z1, w1,
|
29
|
+
x2, y2, z2, w2,
|
30
|
+
x3, y3, z3, w3;
|
26
31
|
};
|
27
|
-
|
32
|
+
Coord4 column[NCOLUMN];
|
33
|
+
coord array[NELEM];
|
28
34
|
};
|
29
35
|
|
30
|
-
Matrix (
|
36
|
+
Matrix (coord value = 1);
|
31
37
|
|
32
38
|
Matrix (
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
39
|
+
coord x0, coord x1, coord x2, coord x3,
|
40
|
+
coord y0, coord y1, coord y2, coord y3,
|
41
|
+
coord z0, coord z1, coord z2, coord z3,
|
42
|
+
coord w0, coord w1, coord w2, coord w3);
|
43
|
+
|
44
|
+
Matrix (const coord* elements, size_t size);
|
45
|
+
|
46
|
+
This dup () const;
|
47
|
+
|
48
|
+
This& reset (coord value = 1);
|
49
|
+
|
50
|
+
This& reset (
|
51
|
+
coord x0, coord x1, coord x2, coord x3,
|
52
|
+
coord y0, coord y1, coord y2, coord y3,
|
53
|
+
coord z0, coord z1, coord z2, coord z3,
|
54
|
+
coord w0, coord w1, coord w2, coord w3);
|
55
|
+
|
56
|
+
This& reset (const coord* elements, size_t size);
|
57
|
+
|
58
|
+
This& translate (coord x, coord y, coord z = 0);
|
59
|
+
|
60
|
+
This& translate (const Coord3& translate);
|
61
|
+
|
62
|
+
This& scale (coord x, coord y, coord z = 1);
|
63
|
+
|
64
|
+
This& scale (const Coord3& scale);
|
65
|
+
|
66
|
+
This& rotate (float degree, coord x = 0, coord y = 0, coord z = 1);
|
37
67
|
|
38
|
-
|
68
|
+
This& rotate (float degree, const Coord3& normalized_axis);
|
39
69
|
|
40
|
-
|
70
|
+
coord& at (int row, int column);
|
41
71
|
|
42
|
-
|
72
|
+
coord at (int row, int column) const;
|
43
73
|
|
44
|
-
|
45
|
-
float a1, float a2, float a3, float a4,
|
46
|
-
float b1, float b2, float b3, float b4,
|
47
|
-
float c1, float c2, float c3, float c4,
|
48
|
-
float d1, float d2, float d3, float d4);
|
74
|
+
String inspect () const;
|
49
75
|
|
50
|
-
|
76
|
+
coord& operator [] (int index);
|
51
77
|
|
52
|
-
|
78
|
+
coord operator [] (int index) const;
|
53
79
|
|
54
|
-
|
80
|
+
This& operator *= (const This& rhs);
|
55
81
|
|
56
|
-
|
82
|
+
Point operator * (const Point& rhs) const;
|
57
83
|
|
58
|
-
|
84
|
+
This operator * (const This& rhs) const;
|
59
85
|
|
60
86
|
};// Matrix
|
61
87
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __RAYS_NOISE_H__
|
4
|
+
#define __RAYS_NOISE_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <rays/defs.h>
|
8
|
+
|
9
|
+
|
10
|
+
namespace Rays
|
11
|
+
{
|
12
|
+
|
13
|
+
|
14
|
+
struct Coord3;
|
15
|
+
|
16
|
+
|
17
|
+
coord perlin (coord x);
|
18
|
+
|
19
|
+
coord perlin (coord x, coord y);
|
20
|
+
|
21
|
+
coord perlin (coord x, coord y, coord z);
|
22
|
+
|
23
|
+
coord perlin (coord x, coord y, coord z, coord w);
|
24
|
+
|
25
|
+
coord perlin (const Coord3& position);
|
26
|
+
|
27
|
+
|
28
|
+
coord simplex (coord x);
|
29
|
+
|
30
|
+
coord simplex (coord x, coord y);
|
31
|
+
|
32
|
+
coord simplex (coord x, coord y, coord z);
|
33
|
+
|
34
|
+
coord simplex (coord x, coord y, coord z, coord w);
|
35
|
+
|
36
|
+
coord simplex (const Coord3& position);
|
37
|
+
|
38
|
+
|
39
|
+
}// Rays
|
40
|
+
|
41
|
+
|
42
|
+
#endif//EOH
|
data/include/rays/opengl.h
CHANGED
@@ -4,65 +4,17 @@
|
|
4
4
|
#define __RAYS_OPENGL_H__
|
5
5
|
|
6
6
|
|
7
|
-
#if defined(OSX)
|
8
|
-
#include <OpenGL/gl.h>
|
9
|
-
#include <OpenGL/glext.h>
|
10
|
-
#elif defined(IOS)
|
11
|
-
#include <OpenGLES/ES1/gl.h>
|
12
|
-
#include <OpenGLES/ES1/glext.h>
|
13
|
-
#elif defined(WIN32)
|
14
|
-
#include <GL/gl.h>
|
15
|
-
#include <GL/glext.h>
|
16
|
-
#endif
|
17
|
-
|
18
|
-
|
19
7
|
namespace Rays
|
20
8
|
{
|
21
9
|
|
22
10
|
|
23
|
-
|
24
|
-
|
25
|
-
bool no_error ();
|
26
|
-
|
27
|
-
bool is_error (GLenum err);
|
28
|
-
|
29
|
-
void check_error(const char* file, int line);
|
30
|
-
|
31
|
-
void clear_error ();
|
11
|
+
typedef void* Context;
|
32
12
|
|
33
13
|
|
34
|
-
|
14
|
+
Context get_offscreen_context ();
|
35
15
|
|
36
16
|
|
37
17
|
}// Rays
|
38
18
|
|
39
19
|
|
40
|
-
#ifdef IOS
|
41
|
-
|
42
|
-
#define glGenFramebuffers glGenFramebuffersOES
|
43
|
-
#define glGenRenderbuffers glGenRenderbuffersOES
|
44
|
-
#define glDeleteFramebuffers glDeleteFramebuffersOES
|
45
|
-
#define glDeleteRenderbuffers glDeleteRenderbuffersOES
|
46
|
-
#define glBindFramebuffer glBindFramebufferOES
|
47
|
-
#define glBindRenderbuffer glBindRenderbufferOES
|
48
|
-
#define glCheckFramebufferStatus glCheckFramebufferStatusOES
|
49
|
-
#define glFramebufferTexture2D glFramebufferTexture2DOES
|
50
|
-
#define glRenderbufferStorage glRenderbufferStorageOES
|
51
|
-
#define glOrtho glOrthof
|
52
|
-
|
53
|
-
#define GL_UNSIGNED_INT GL_UNSIGNED_INT_OES
|
54
|
-
#define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
|
55
|
-
#define GL_RENDERBUFFER GL_RENDERBUFFER_OES
|
56
|
-
#define GL_DRAW_FRAMEBUFFER GL_DRAW_FRAMEBUFFER_APPLE
|
57
|
-
#define GL_READ_FRAMEBUFFER GL_READ_FRAMEBUFFER_APPLE
|
58
|
-
#define GL_DRAW_FRAMEBUFFER_BINDING GL_DRAW_FRAMEBUFFER_BINDING_APPLE
|
59
|
-
#define GL_READ_FRAMEBUFFER_BINDING GL_READ_FRAMEBUFFER_BINDING_APPLE
|
60
|
-
#define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
|
61
|
-
#define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_OES
|
62
|
-
#define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT24_OES
|
63
|
-
#define GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES
|
64
|
-
|
65
|
-
#endif// IOS
|
66
|
-
|
67
|
-
|
68
20
|
#endif//EOH
|
data/include/rays/painter.h
CHANGED
@@ -6,31 +6,21 @@
|
|
6
6
|
|
7
7
|
#include <xot/pimpl.h>
|
8
8
|
#include <rays/defs.h>
|
9
|
-
#include <rays/
|
9
|
+
#include <rays/point.h>
|
10
10
|
|
11
11
|
|
12
12
|
namespace Rays
|
13
13
|
{
|
14
14
|
|
15
15
|
|
16
|
-
struct Coord2;
|
17
|
-
|
18
|
-
struct Coord3;
|
19
|
-
|
20
|
-
struct Point;
|
21
|
-
|
22
16
|
struct Bounds;
|
23
|
-
|
24
17
|
struct Color;
|
25
|
-
|
26
18
|
struct Matrix;
|
27
19
|
|
28
|
-
class
|
29
|
-
|
20
|
+
class Polyline;
|
21
|
+
class Polygon;
|
30
22
|
class Image;
|
31
|
-
|
32
|
-
class Texture;
|
33
|
-
|
23
|
+
class Font;
|
34
24
|
class Shader;
|
35
25
|
|
36
26
|
|
@@ -39,31 +29,33 @@ namespace Rays
|
|
39
29
|
|
40
30
|
public:
|
41
31
|
|
42
|
-
enum
|
43
|
-
{
|
44
|
-
|
45
|
-
ELLIPSE_NSEGMENT = 32
|
46
|
-
|
47
|
-
};
|
48
|
-
|
49
32
|
Painter ();
|
50
33
|
|
51
34
|
~Painter ();
|
52
35
|
|
53
|
-
void canvas (
|
36
|
+
void canvas (
|
37
|
+
coord x, coord y, coord width, coord height,
|
38
|
+
float pixel_density = 1);
|
54
39
|
|
55
|
-
void canvas (
|
40
|
+
void canvas (
|
41
|
+
coord x, coord y, coord z, coord width, coord height, coord depth,
|
42
|
+
float pixel_density = 1);
|
56
43
|
|
57
|
-
void canvas (
|
44
|
+
void canvas (
|
45
|
+
const Bounds& bounds,
|
46
|
+
float pixel_density = 1);
|
58
47
|
|
59
|
-
void bind (const
|
48
|
+
void bind (const Image& image);
|
60
49
|
|
61
50
|
void unbind ();
|
62
51
|
|
63
52
|
const Bounds& bounds () const;
|
64
53
|
|
54
|
+
float pixel_density () const;
|
55
|
+
|
56
|
+
|
65
57
|
//
|
66
|
-
//
|
58
|
+
// drawing methods
|
67
59
|
//
|
68
60
|
void begin ();
|
69
61
|
|
@@ -71,17 +63,15 @@ namespace Rays
|
|
71
63
|
|
72
64
|
void clear ();
|
73
65
|
|
66
|
+
void polygon (const Polygon& polygon);
|
67
|
+
|
74
68
|
void line (coord x1, coord y1, coord x2, coord y2);
|
75
69
|
|
76
70
|
void line (const Point& p1, const Point& p2);
|
77
71
|
|
78
|
-
void
|
79
|
-
|
80
|
-
void lines (const Coord3* points, size_t size);
|
81
|
-
|
82
|
-
void polygon (const Coord2* points, size_t size);
|
72
|
+
void line (const Point* points, size_t size, bool loop = false);
|
83
73
|
|
84
|
-
void
|
74
|
+
void line (const Polyline& polyline);
|
85
75
|
|
86
76
|
void rect (
|
87
77
|
coord x, coord y, coord width, coord height,
|
@@ -89,7 +79,8 @@ namespace Rays
|
|
89
79
|
|
90
80
|
void rect (
|
91
81
|
coord x, coord y, coord width, coord height,
|
92
|
-
coord
|
82
|
+
coord round_left_top, coord round_right_top,
|
83
|
+
coord round_left_bottom, coord round_right_bottom);
|
93
84
|
|
94
85
|
void rect (
|
95
86
|
const Bounds& bounds,
|
@@ -97,34 +88,49 @@ namespace Rays
|
|
97
88
|
|
98
89
|
void rect (
|
99
90
|
const Bounds& bounds,
|
100
|
-
coord
|
91
|
+
coord round_left_top, coord round_right_top,
|
92
|
+
coord round_left_bottom, coord round_right_bottom);
|
101
93
|
|
102
94
|
void ellipse (
|
103
95
|
coord x, coord y, coord width, coord height = 0,
|
104
|
-
|
96
|
+
const Point& hole_size = 0,
|
97
|
+
float angle_from = 0, float angle_to = 360);
|
105
98
|
|
106
99
|
void ellipse (
|
107
100
|
const Bounds& bounds,
|
108
|
-
|
101
|
+
const Point& hole_size = 0,
|
102
|
+
float angle_from = 0, float angle_to = 360);
|
109
103
|
|
110
104
|
void ellipse (
|
111
|
-
const Point& center,
|
112
|
-
|
105
|
+
const Point& center, const Point& radius,
|
106
|
+
const Point& hole_radius = 0,
|
107
|
+
float angle_from = 0, float angle_to = 360);
|
113
108
|
|
114
|
-
void
|
115
|
-
coord
|
116
|
-
|
117
|
-
|
109
|
+
void curve (
|
110
|
+
coord x1, coord y1, coord x2, coord y2,
|
111
|
+
coord x3, coord y3, coord x4, coord y4,
|
112
|
+
bool loop = false);
|
118
113
|
|
119
|
-
void
|
120
|
-
const
|
121
|
-
|
122
|
-
coord radius_min = 0, uint nsegment = 0);
|
114
|
+
void curve (
|
115
|
+
const Point& p1, const Point& p2, const Point& p3, const Point& p4,
|
116
|
+
bool loop = false);
|
123
117
|
|
124
|
-
void
|
125
|
-
const Point
|
126
|
-
|
127
|
-
|
118
|
+
void curve (
|
119
|
+
const Point* points, size_t size,
|
120
|
+
bool loop = false);
|
121
|
+
|
122
|
+
void bezier (
|
123
|
+
coord x1, coord y1, coord x2, coord y2,
|
124
|
+
coord x3, coord y3, coord x4, coord y4,
|
125
|
+
bool loop = false);
|
126
|
+
|
127
|
+
void bezier (
|
128
|
+
const Point& p1, const Point& p2, const Point& p3, const Point& p4,
|
129
|
+
bool loop = false);
|
130
|
+
|
131
|
+
void bezier (
|
132
|
+
const Point* points, size_t size,
|
133
|
+
bool loop = false);
|
128
134
|
|
129
135
|
void image (
|
130
136
|
const Image& image, coord x = 0, coord y = 0);
|
@@ -156,24 +162,17 @@ namespace Rays
|
|
156
162
|
const Image& image,
|
157
163
|
const Bounds& src_bounds, const Bounds& dest_bounds);
|
158
164
|
|
159
|
-
void text (
|
160
|
-
const char* str, coord x = 0, coord y = 0,
|
161
|
-
const Font* font = NULL);
|
165
|
+
void text (const char* str, coord x = 0, coord y = 0);
|
162
166
|
|
163
|
-
void text (
|
164
|
-
const char* str, const Point& position,
|
165
|
-
const Font* font = NULL);
|
167
|
+
void text (const char* str, const Point& position);
|
166
168
|
|
167
|
-
void text (
|
168
|
-
|
169
|
-
|
169
|
+
void text (const char* str, coord x, coord y, coord width, coord height);
|
170
|
+
|
171
|
+
void text (const char* str, const Bounds& bounds);
|
170
172
|
|
171
|
-
void text (
|
172
|
-
const char* str, const Bounds& bounds,
|
173
|
-
const Font* font = NULL);
|
174
173
|
|
175
174
|
//
|
176
|
-
//
|
175
|
+
// states
|
177
176
|
//
|
178
177
|
void set_background (float red, float green, float blue, float alpha = 1, bool clear = true);
|
179
178
|
|
@@ -199,54 +198,50 @@ namespace Rays
|
|
199
198
|
|
200
199
|
const Color& stroke () const;
|
201
200
|
|
202
|
-
void
|
201
|
+
void set_stroke_width (coord width);
|
203
202
|
|
204
|
-
|
203
|
+
coord stroke_width () const;
|
205
204
|
|
206
|
-
void
|
205
|
+
void set_stroke_cap (CapType cap);
|
207
206
|
|
208
|
-
|
207
|
+
CapType stroke_cap () const;
|
209
208
|
|
210
|
-
void
|
209
|
+
void set_stroke_join (JoinType join);
|
211
210
|
|
212
|
-
|
211
|
+
JoinType stroke_join () const;
|
213
212
|
|
214
|
-
|
213
|
+
void set_miter_limit (coord limit);
|
215
214
|
|
216
|
-
|
215
|
+
coord miter_limit () const;
|
217
216
|
|
218
|
-
void
|
217
|
+
void set_nsegment (int nsegment);
|
219
218
|
|
220
|
-
|
221
|
-
// shader manipulation methods
|
222
|
-
//
|
223
|
-
void attach (const Shader& shader);
|
219
|
+
uint nsegment () const;
|
224
220
|
|
225
|
-
void
|
221
|
+
void set_clip (coord x, coord y, coord width, coord height);
|
226
222
|
|
227
|
-
void
|
223
|
+
void set_clip (const Bounds& bounds);
|
228
224
|
|
229
|
-
void
|
225
|
+
void no_clip ();
|
230
226
|
|
231
|
-
|
227
|
+
const Bounds& clip () const;
|
232
228
|
|
233
|
-
void
|
229
|
+
void set_font (const char* name, coord size = 0);
|
234
230
|
|
235
|
-
void
|
231
|
+
void set_font (const Font& font);
|
236
232
|
|
237
|
-
|
233
|
+
const Font& font () const;
|
238
234
|
|
239
|
-
void
|
235
|
+
void set_shader (const Shader& shader);
|
240
236
|
|
241
|
-
void
|
237
|
+
void no_shader ();
|
242
238
|
|
243
|
-
|
239
|
+
const Shader& shader () const;
|
244
240
|
|
245
|
-
void
|
241
|
+
void push_state ();
|
246
242
|
|
247
|
-
void
|
243
|
+
void pop_state ();
|
248
244
|
|
249
|
-
void pop_shader ();
|
250
245
|
|
251
246
|
//
|
252
247
|
// transformation methods
|
@@ -259,9 +254,9 @@ namespace Rays
|
|
259
254
|
|
260
255
|
void scale (const Point& value);
|
261
256
|
|
262
|
-
void rotate (float
|
257
|
+
void rotate (float degree, coord x = 0, coord y = 0, coord z = 1);
|
263
258
|
|
264
|
-
void rotate (float
|
259
|
+
void rotate (float degree, const Point& normalized_axis);
|
265
260
|
|
266
261
|
void set_matrix (float value = 1);
|
267
262
|
|
@@ -271,7 +266,7 @@ namespace Rays
|
|
271
266
|
float c1, float c2, float c3, float c4,
|
272
267
|
float d1, float d2, float d3, float d4);
|
273
268
|
|
274
|
-
void set_matrix (const float* elements);
|
269
|
+
void set_matrix (const float* elements, size_t size);
|
275
270
|
|
276
271
|
void set_matrix (const Matrix& matrix);
|
277
272
|
|
@@ -286,9 +281,10 @@ namespace Rays
|
|
286
281
|
|
287
282
|
bool operator ! () const;
|
288
283
|
|
284
|
+
|
289
285
|
struct Data;
|
290
286
|
|
291
|
-
Xot::
|
287
|
+
Xot::PSharedImpl<Data> self;
|
292
288
|
|
293
289
|
};// Painter
|
294
290
|
|