rays 0.1.11 → 0.1.16

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.
Files changed (168) hide show
  1. checksums.yaml +5 -5
  2. data/.doc/ext/rays/bitmap.cpp +22 -76
  3. data/.doc/ext/rays/bounds.cpp +95 -125
  4. data/.doc/ext/rays/camera.cpp +88 -0
  5. data/.doc/ext/rays/color.cpp +223 -45
  6. data/.doc/ext/rays/color_space.cpp +146 -46
  7. data/.doc/ext/rays/defs.cpp +183 -0
  8. data/.doc/ext/rays/font.cpp +69 -21
  9. data/.doc/ext/rays/image.cpp +26 -37
  10. data/.doc/ext/rays/matrix.cpp +186 -29
  11. data/.doc/ext/rays/native.cpp +14 -8
  12. data/.doc/ext/rays/noise.cpp +53 -0
  13. data/.doc/ext/rays/painter.cpp +187 -292
  14. data/.doc/ext/rays/point.cpp +96 -77
  15. data/.doc/ext/rays/polygon.cpp +313 -0
  16. data/.doc/ext/rays/polygon_line.cpp +96 -0
  17. data/.doc/ext/rays/polyline.cpp +167 -0
  18. data/.doc/ext/rays/rays.cpp +103 -12
  19. data/.doc/ext/rays/shader.cpp +83 -9
  20. data/LICENSE +21 -0
  21. data/README.md +1 -1
  22. data/Rakefile +24 -9
  23. data/VERSION +1 -1
  24. data/ext/rays/bitmap.cpp +22 -80
  25. data/ext/rays/bounds.cpp +100 -128
  26. data/ext/rays/camera.cpp +94 -0
  27. data/ext/rays/color.cpp +231 -51
  28. data/ext/rays/color_space.cpp +149 -47
  29. data/ext/rays/defs.cpp +183 -0
  30. data/ext/rays/defs.h +26 -2
  31. data/ext/rays/extconf.rb +2 -3
  32. data/ext/rays/font.cpp +74 -24
  33. data/ext/rays/image.cpp +28 -40
  34. data/ext/rays/matrix.cpp +198 -30
  35. data/ext/rays/native.cpp +14 -8
  36. data/ext/rays/noise.cpp +55 -0
  37. data/ext/rays/painter.cpp +203 -298
  38. data/ext/rays/point.cpp +105 -81
  39. data/ext/rays/polygon.cpp +329 -0
  40. data/ext/rays/polygon_line.cpp +99 -0
  41. data/ext/rays/polyline.cpp +176 -0
  42. data/ext/rays/rays.cpp +103 -13
  43. data/ext/rays/shader.cpp +84 -9
  44. data/include/rays.h +10 -2
  45. data/include/rays/bitmap.h +14 -26
  46. data/include/rays/bounds.h +21 -4
  47. data/include/rays/camera.h +49 -0
  48. data/include/rays/color.h +25 -14
  49. data/include/rays/color_space.h +15 -10
  50. data/include/rays/coord.h +114 -0
  51. data/include/rays/debug.h +22 -0
  52. data/include/rays/defs.h +36 -0
  53. data/include/rays/exception.h +6 -2
  54. data/include/rays/font.h +4 -4
  55. data/include/rays/image.h +12 -18
  56. data/include/rays/matrix.h +50 -24
  57. data/include/rays/noise.h +42 -0
  58. data/include/rays/opengl.h +2 -50
  59. data/include/rays/painter.h +89 -93
  60. data/include/rays/point.h +44 -51
  61. data/include/rays/polygon.h +198 -0
  62. data/include/rays/polyline.h +71 -0
  63. data/include/rays/rays.h +3 -0
  64. data/include/rays/ruby.h +7 -1
  65. data/include/rays/ruby/bounds.h +1 -1
  66. data/include/rays/ruby/camera.h +41 -0
  67. data/include/rays/ruby/color.h +1 -1
  68. data/include/rays/ruby/color_space.h +1 -1
  69. data/include/rays/ruby/font.h +1 -1
  70. data/include/rays/ruby/matrix.h +1 -1
  71. data/include/rays/ruby/point.h +1 -1
  72. data/include/rays/ruby/polygon.h +52 -0
  73. data/include/rays/ruby/polyline.h +41 -0
  74. data/include/rays/ruby/rays.h +8 -0
  75. data/include/rays/ruby/shader.h +1 -1
  76. data/include/rays/shader.h +36 -8
  77. data/lib/rays.rb +7 -2
  78. data/lib/rays/bitmap.rb +0 -15
  79. data/lib/rays/bounds.rb +17 -23
  80. data/lib/rays/camera.rb +21 -0
  81. data/lib/rays/color.rb +20 -47
  82. data/lib/rays/color_space.rb +13 -13
  83. data/lib/rays/image.rb +3 -7
  84. data/lib/rays/matrix.rb +28 -0
  85. data/lib/rays/module.rb +4 -19
  86. data/lib/rays/painter.rb +78 -93
  87. data/lib/rays/point.rb +13 -21
  88. data/lib/rays/polygon.rb +58 -0
  89. data/lib/rays/polygon_line.rb +36 -0
  90. data/lib/rays/polyline.rb +32 -0
  91. data/lib/rays/shader.rb +20 -1
  92. data/rays.gemspec +5 -7
  93. data/src/bitmap.h +36 -0
  94. data/src/bounds.cpp +74 -11
  95. data/src/color.cpp +58 -23
  96. data/src/color_space.cpp +52 -34
  97. data/src/color_space.h +22 -0
  98. data/src/coord.cpp +170 -0
  99. data/src/coord.h +35 -0
  100. data/src/font.cpp +118 -0
  101. data/src/font.h +64 -0
  102. data/src/frame_buffer.cpp +37 -71
  103. data/src/frame_buffer.h +4 -4
  104. data/src/image.cpp +172 -98
  105. data/src/image.h +25 -0
  106. data/src/ios/bitmap.h +21 -0
  107. data/src/ios/bitmap.mm +129 -110
  108. data/src/ios/camera.mm +236 -0
  109. data/src/ios/font.mm +50 -62
  110. data/src/ios/helper.h +2 -2
  111. data/src/ios/opengl.mm +19 -4
  112. data/src/ios/rays.mm +3 -0
  113. data/src/matrix.cpp +111 -26
  114. data/src/matrix.h +30 -0
  115. data/src/noise.cpp +74 -0
  116. data/src/opengl.cpp +9 -27
  117. data/src/opengl.h +37 -0
  118. data/src/osx/bitmap.h +21 -0
  119. data/src/osx/bitmap.mm +129 -110
  120. data/src/osx/camera.mm +236 -0
  121. data/src/osx/font.mm +49 -62
  122. data/src/osx/helper.h +2 -2
  123. data/src/osx/opengl.mm +19 -83
  124. data/src/osx/rays.mm +3 -0
  125. data/src/painter.cpp +845 -671
  126. data/src/painter.h +24 -0
  127. data/src/point.cpp +140 -119
  128. data/src/polygon.cpp +1266 -0
  129. data/src/polygon.h +32 -0
  130. data/src/polyline.cpp +160 -0
  131. data/src/polyline.h +69 -0
  132. data/src/render_buffer.cpp +11 -4
  133. data/src/render_buffer.h +2 -2
  134. data/src/shader.cpp +163 -106
  135. data/src/shader.h +38 -0
  136. data/src/shader_program.cpp +533 -0
  137. data/src/{program.h → shader_program.h} +28 -16
  138. data/src/shader_source.cpp +140 -0
  139. data/src/shader_source.h +52 -0
  140. data/src/texture.cpp +136 -160
  141. data/src/texture.h +65 -0
  142. data/src/win32/bitmap.cpp +62 -52
  143. data/src/win32/font.cpp +11 -13
  144. data/src/win32/font.h +24 -0
  145. data/src/win32/gdi.h +6 -6
  146. data/test/helper.rb +0 -3
  147. data/test/test_bitmap.rb +31 -7
  148. data/test/test_bounds.rb +36 -0
  149. data/test/test_color.rb +59 -19
  150. data/test/test_color_space.rb +95 -0
  151. data/test/test_font.rb +5 -0
  152. data/test/test_image.rb +24 -20
  153. data/test/test_matrix.rb +106 -0
  154. data/test/test_painter.rb +157 -51
  155. data/test/test_painter_shape.rb +102 -0
  156. data/test/test_point.rb +29 -0
  157. data/test/test_polygon.rb +234 -0
  158. data/test/test_polygon_line.rb +167 -0
  159. data/test/test_polyline.rb +171 -0
  160. data/test/test_shader.rb +9 -9
  161. metadata +102 -70
  162. data/.doc/ext/rays/texture.cpp +0 -138
  163. data/ext/rays/texture.cpp +0 -149
  164. data/include/rays/ruby/texture.h +0 -41
  165. data/include/rays/texture.h +0 -71
  166. data/lib/rays/texture.rb +0 -24
  167. data/src/program.cpp +0 -648
  168. data/test/test_texture.rb +0 -27
@@ -0,0 +1,22 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __RAYS_DEBUG_H__
4
+ #define __RAYS_DEBUG_H__
5
+
6
+
7
+ #include <xot/debug.h>
8
+
9
+
10
+ namespace Rays
11
+ {
12
+
13
+
14
+ using Xot::dout;
15
+
16
+ using Xot::doutln;
17
+
18
+
19
+ }// Rays
20
+
21
+
22
+ #endif//EOH
@@ -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
 
@@ -31,9 +31,13 @@ namespace Rays
31
31
 
32
32
  using namespace Xot::ErrorFunctions;
33
33
 
34
- void rays_error (const char* file, int line, const char* format = NULL, ...);
34
+ [[noreturn]]
35
+ void rays_error (
36
+ const char* file, int line, const char* format = NULL, ...);
35
37
 
36
- void opengl_error (const char* file, int line, const char* format = NULL, ...);
38
+ [[noreturn]]
39
+ void opengl_error (
40
+ const char* file, int line, const char* format = NULL, ...);
37
41
 
38
42
  }// ErrorFunctions
39
43
 
@@ -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 = NULL, coord* descent = NULL, coord* leading = NULL) const;
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::PImpl<Data, true> self;
43
+ Xot::PSharedImpl<Data> self;
44
44
 
45
45
  };// Font
46
46
 
@@ -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 = RGBA,
32
- bool alpha_only = false);
29
+ int width, int height, const ColorSpace& cs = DEFAULT_COLOR_SPACE,
30
+ float pixel_density = 1);
33
31
 
34
- Image (const Bitmap& bitmap, bool alpha_only = false);
32
+ Image (const Bitmap& bitmap, float pixel_density = 1);
35
33
 
36
34
  ~Image ();
37
35
 
38
- Image copy () const;
39
-
40
- Painter painter ();
36
+ Image dup () const;
41
37
 
42
- int width () const;
38
+ coord width () const;
43
39
 
44
- int height () const;
40
+ coord height () const;
45
41
 
46
42
  const ColorSpace& color_space () const;
47
43
 
48
- bool alpha_only () const;
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::PImpl<Data, true> self;
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
 
@@ -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
- float
22
- a1, a2, a3, a4,
23
- b1, b2, b3, b4,
24
- c1, c2, c3, c4,
25
- d1, d2, d3, d4;
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
- float array[16];
32
+ Coord4 column[NCOLUMN];
33
+ coord array[NELEM];
28
34
  };
29
35
 
30
- Matrix (float value = 1);
36
+ Matrix (coord value = 1);
31
37
 
32
38
  Matrix (
33
- float a1, float a2, float a3, float a4,
34
- float b1, float b2, float b3, float b4,
35
- float c1, float c2, float c3, float c4,
36
- float d1, float d2, float d3, float d4);
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
- Matrix (const float* elements, size_t size);
68
+ This& rotate (float degree, const Coord3& normalized_axis);
39
69
 
40
- Matrix dup () const;
70
+ coord& at (int row, int column);
41
71
 
42
- Matrix& reset (float value = 1);
72
+ coord at (int row, int column) const;
43
73
 
44
- Matrix& reset (
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
- Matrix& reset (const float* elements, size_t size);
76
+ coord& operator [] (int index);
51
77
 
52
- float& at (int row, int column);
78
+ coord operator [] (int index) const;
53
79
 
54
- float at (int row, int column) const;
80
+ This& operator *= (const This& rhs);
55
81
 
56
- float& operator [] (int index);
82
+ Point operator * (const Point& rhs) const;
57
83
 
58
- float operator [] (int index) const;
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
@@ -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
- GLenum get_error ();
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
- void init_offscreen_context ();
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
@@ -6,31 +6,21 @@
6
6
 
7
7
  #include <xot/pimpl.h>
8
8
  #include <rays/defs.h>
9
- #include <rays/opengl.h>
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 Font;
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 (coord x, coord y, coord width, coord height);
36
+ void canvas (
37
+ coord x, coord y, coord width, coord height,
38
+ float pixel_density = 1);
54
39
 
55
- void canvas (coord x, coord y, coord z, coord width, coord height, coord depth);
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 (const Bounds& bounds);
44
+ void canvas (
45
+ const Bounds& bounds,
46
+ float pixel_density = 1);
58
47
 
59
- void bind (const Texture& texture);
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
- // high level drawing methods
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 lines (const Coord2* points, size_t size);
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 polygon (const Coord3* points, size_t size);
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 round_width, coord round_height);
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 round_width, coord round_height);
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
- coord radius_min = 0, uint nsegment = 0);
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
- coord radius_min = 0, uint nsegment = 0);
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, coord radius,
112
- coord radius_min = 0, uint nsegment = 0);
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 arc (
115
- coord x, coord y, coord width, coord height = 0,
116
- float angle_from = 0, float angle_to = 360,
117
- coord radius_min = 0, uint nsegment = 0);
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 arc (
120
- const Bounds& bounds,
121
- float angle_from = 0, float angle_to = 360,
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 arc (
125
- const Point& center, coord radius,
126
- float angle_from = 0, float angle_to = 360,
127
- coord radius_min = 0, uint nsegment = 0);
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
- const char* str, coord x, coord y, coord width, coord height,
169
- const Font* font = NULL);
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
- // attributes
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 set_clip (coord x, coord y, coord width, coord height);
201
+ void set_stroke_width (coord width);
203
202
 
204
- void set_clip (const Bounds& bounds);
203
+ coord stroke_width () const;
205
204
 
206
- void no_clip ();
205
+ void set_stroke_cap (CapType cap);
207
206
 
208
- const Bounds& clip () const;
207
+ CapType stroke_cap () const;
209
208
 
210
- void set_font (const char* name, coord size = 0);
209
+ void set_stroke_join (JoinType join);
211
210
 
212
- void set_font (const Font& font);
211
+ JoinType stroke_join () const;
213
212
 
214
- const Font& font () const;
213
+ void set_miter_limit (coord limit);
215
214
 
216
- void push_attr ();
215
+ coord miter_limit () const;
217
216
 
218
- void pop_attr ();
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 detach (const Shader& shader);
221
+ void set_clip (coord x, coord y, coord width, coord height);
226
222
 
227
- void set_uniform (const char* name, int arg1);
223
+ void set_clip (const Bounds& bounds);
228
224
 
229
- void set_uniform (const char* name, int arg1, int arg2);
225
+ void no_clip ();
230
226
 
231
- void set_uniform (const char* name, int arg1, int arg2, int arg3);
227
+ const Bounds& clip () const;
232
228
 
233
- void set_uniform (const char* name, int arg1, int arg2, int arg3, int arg4);
229
+ void set_font (const char* name, coord size = 0);
234
230
 
235
- void set_uniform (const char* name, const int* args, size_t size);
231
+ void set_font (const Font& font);
236
232
 
237
- void set_uniform (const char* name, float arg1);
233
+ const Font& font () const;
238
234
 
239
- void set_uniform (const char* name, float arg1, float arg2);
235
+ void set_shader (const Shader& shader);
240
236
 
241
- void set_uniform (const char* name, float arg1, float arg2, float arg3);
237
+ void no_shader ();
242
238
 
243
- void set_uniform (const char* name, float arg1, float arg2, float arg3, float arg4);
239
+ const Shader& shader () const;
244
240
 
245
- void set_uniform (const char* name, const float* args, size_t size);
241
+ void push_state ();
246
242
 
247
- void push_shader ();
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 angle, coord x = 0, coord y = 0, coord z = 1);
257
+ void rotate (float degree, coord x = 0, coord y = 0, coord z = 1);
263
258
 
264
- void rotate (float angle, const Point& axis);
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::PImpl<Data, true> self;
287
+ Xot::PSharedImpl<Data> self;
292
288
 
293
289
  };// Painter
294
290