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.
Files changed (155) 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/color.cpp +224 -45
  5. data/.doc/ext/rays/color_space.cpp +137 -45
  6. data/.doc/ext/rays/defs.cpp +183 -0
  7. data/.doc/ext/rays/font.cpp +39 -21
  8. data/.doc/ext/rays/image.cpp +26 -37
  9. data/.doc/ext/rays/matrix.cpp +186 -29
  10. data/.doc/ext/rays/native.cpp +12 -6
  11. data/.doc/ext/rays/noise.cpp +53 -0
  12. data/.doc/ext/rays/painter.cpp +120 -308
  13. data/.doc/ext/rays/point.cpp +82 -77
  14. data/.doc/ext/rays/polygon.cpp +287 -0
  15. data/.doc/ext/rays/polygon_line.cpp +96 -0
  16. data/.doc/ext/rays/polyline.cpp +161 -0
  17. data/.doc/ext/rays/rays.cpp +0 -13
  18. data/.doc/ext/rays/shader.cpp +83 -9
  19. data/README.md +1 -1
  20. data/Rakefile +21 -9
  21. data/VERSION +1 -1
  22. data/ext/rays/bitmap.cpp +22 -80
  23. data/ext/rays/bounds.cpp +100 -128
  24. data/ext/rays/color.cpp +232 -51
  25. data/ext/rays/color_space.cpp +140 -46
  26. data/ext/rays/defs.cpp +183 -0
  27. data/ext/rays/defs.h +26 -2
  28. data/ext/rays/extconf.rb +1 -2
  29. data/ext/rays/font.cpp +39 -22
  30. data/ext/rays/image.cpp +27 -39
  31. data/ext/rays/matrix.cpp +198 -30
  32. data/ext/rays/native.cpp +12 -6
  33. data/ext/rays/noise.cpp +55 -0
  34. data/ext/rays/painter.cpp +129 -315
  35. data/ext/rays/point.cpp +89 -81
  36. data/ext/rays/polygon.cpp +301 -0
  37. data/ext/rays/polygon_line.cpp +99 -0
  38. data/ext/rays/polyline.cpp +170 -0
  39. data/ext/rays/rays.cpp +0 -14
  40. data/ext/rays/shader.cpp +84 -9
  41. data/include/rays.h +10 -2
  42. data/include/rays/bitmap.h +14 -26
  43. data/include/rays/bounds.h +21 -4
  44. data/include/rays/color.h +25 -14
  45. data/include/rays/color_space.h +11 -8
  46. data/include/rays/coord.h +114 -0
  47. data/include/rays/debug.h +22 -0
  48. data/include/rays/defs.h +3 -0
  49. data/include/rays/font.h +4 -4
  50. data/include/rays/image.h +11 -17
  51. data/include/rays/matrix.h +50 -24
  52. data/include/rays/noise.h +42 -0
  53. data/include/rays/opengl.h +2 -50
  54. data/include/rays/painter.h +57 -99
  55. data/include/rays/point.h +44 -51
  56. data/include/rays/polygon.h +164 -0
  57. data/include/rays/polyline.h +65 -0
  58. data/include/rays/rays.h +3 -0
  59. data/include/rays/ruby.h +7 -1
  60. data/include/rays/ruby/bounds.h +1 -1
  61. data/include/rays/ruby/color.h +1 -1
  62. data/include/rays/ruby/color_space.h +1 -1
  63. data/include/rays/ruby/font.h +1 -1
  64. data/include/rays/ruby/matrix.h +1 -1
  65. data/include/rays/ruby/point.h +1 -1
  66. data/include/rays/ruby/polygon.h +52 -0
  67. data/include/rays/ruby/polyline.h +41 -0
  68. data/include/rays/ruby/shader.h +1 -1
  69. data/include/rays/shader.h +36 -8
  70. data/lib/rays.rb +6 -1
  71. data/lib/rays/bitmap.rb +0 -15
  72. data/lib/rays/bounds.rb +17 -23
  73. data/lib/rays/color.rb +20 -47
  74. data/lib/rays/color_space.rb +13 -13
  75. data/lib/rays/image.rb +2 -6
  76. data/lib/rays/matrix.rb +28 -0
  77. data/lib/rays/module.rb +4 -19
  78. data/lib/rays/painter.rb +60 -97
  79. data/lib/rays/point.rb +13 -21
  80. data/lib/rays/polygon.rb +50 -0
  81. data/lib/rays/polygon_line.rb +36 -0
  82. data/lib/rays/polyline.rb +32 -0
  83. data/lib/rays/shader.rb +20 -1
  84. data/rays.gemspec +5 -7
  85. data/src/bitmap.h +36 -0
  86. data/src/bounds.cpp +74 -11
  87. data/src/color.cpp +58 -23
  88. data/src/color_space.cpp +50 -32
  89. data/src/color_space.h +22 -0
  90. data/src/coord.cpp +170 -0
  91. data/src/coord.h +35 -0
  92. data/src/font.cpp +118 -0
  93. data/src/font.h +64 -0
  94. data/src/frame_buffer.cpp +37 -71
  95. data/src/frame_buffer.h +4 -4
  96. data/src/image.cpp +171 -97
  97. data/src/image.h +25 -0
  98. data/src/ios/bitmap.mm +107 -105
  99. data/src/ios/font.mm +48 -60
  100. data/src/ios/helper.h +2 -2
  101. data/src/ios/opengl.mm +19 -4
  102. data/src/ios/rays.mm +3 -0
  103. data/src/matrix.cpp +111 -26
  104. data/src/matrix.h +30 -0
  105. data/src/noise.cpp +74 -0
  106. data/src/opengl.cpp +9 -27
  107. data/src/opengl.h +37 -0
  108. data/src/osx/bitmap.mm +111 -106
  109. data/src/osx/font.mm +48 -61
  110. data/src/osx/helper.h +2 -2
  111. data/src/osx/opengl.mm +19 -83
  112. data/src/osx/rays.mm +3 -0
  113. data/src/painter.cpp +780 -696
  114. data/src/painter.h +24 -0
  115. data/src/point.cpp +140 -119
  116. data/src/polygon.cpp +1100 -0
  117. data/src/polygon.h +32 -0
  118. data/src/polyline.cpp +158 -0
  119. data/src/polyline.h +67 -0
  120. data/src/render_buffer.cpp +11 -4
  121. data/src/render_buffer.h +2 -2
  122. data/src/shader.cpp +163 -106
  123. data/src/shader.h +38 -0
  124. data/src/shader_program.cpp +533 -0
  125. data/src/{program.h → shader_program.h} +28 -16
  126. data/src/shader_source.cpp +140 -0
  127. data/src/shader_source.h +52 -0
  128. data/src/texture.cpp +136 -160
  129. data/src/texture.h +65 -0
  130. data/src/win32/bitmap.cpp +62 -52
  131. data/src/win32/font.cpp +11 -13
  132. data/src/win32/font.h +24 -0
  133. data/src/win32/gdi.h +6 -6
  134. data/test/helper.rb +0 -3
  135. data/test/test_bitmap.rb +31 -7
  136. data/test/test_bounds.rb +36 -0
  137. data/test/test_color.rb +59 -19
  138. data/test/test_color_space.rb +95 -0
  139. data/test/test_image.rb +24 -20
  140. data/test/test_matrix.rb +106 -0
  141. data/test/test_painter.rb +92 -46
  142. data/test/test_painter_shape.rb +57 -0
  143. data/test/test_point.rb +21 -0
  144. data/test/test_polygon.rb +234 -0
  145. data/test/test_polygon_line.rb +167 -0
  146. data/test/test_polyline.rb +145 -0
  147. data/test/test_shader.rb +9 -9
  148. metadata +88 -67
  149. data/.doc/ext/rays/texture.cpp +0 -138
  150. data/ext/rays/texture.cpp +0 -149
  151. data/include/rays/ruby/texture.h +0 -41
  152. data/include/rays/texture.h +0 -71
  153. data/lib/rays/texture.rb +0 -24
  154. data/src/program.cpp +0 -648
  155. data/test/test_texture.rb +0 -27
@@ -0,0 +1,74 @@
1
+ #include "rays/noise.h"
2
+
3
+
4
+ #include <glm/gtc/noise.hpp>
5
+ #include "coord.h"
6
+
7
+
8
+ namespace Rays
9
+ {
10
+
11
+
12
+ coord
13
+ perlin (coord x)
14
+ {
15
+ return (coord) glm::perlin(glm::vec2(x, 0));
16
+ }
17
+
18
+ coord
19
+ perlin (coord x, coord y)
20
+ {
21
+ return (coord) glm::perlin(glm::vec2(x, y));
22
+ }
23
+
24
+ coord
25
+ perlin (coord x, coord y, coord z)
26
+ {
27
+ return (coord) glm::perlin(glm::vec3(x, y, z));
28
+ }
29
+
30
+ coord
31
+ perlin (coord x, coord y, coord z, coord w)
32
+ {
33
+ return (coord) glm::perlin(glm::vec4(x, y, z, w));
34
+ }
35
+
36
+ coord
37
+ perlin (const Coord3& position)
38
+ {
39
+ return (coord) glm::perlin(to_glm(position));
40
+ }
41
+
42
+
43
+ coord
44
+ simplex (coord x)
45
+ {
46
+ return (coord) glm::simplex(glm::vec2(x, 0));
47
+ }
48
+
49
+ coord
50
+ simplex (coord x, coord y)
51
+ {
52
+ return (coord) glm::simplex(glm::vec2(x, y));
53
+ }
54
+
55
+ coord
56
+ simplex (coord x, coord y, coord z)
57
+ {
58
+ return (coord) glm::simplex(glm::vec3(x, y, z));
59
+ }
60
+
61
+ coord
62
+ simplex (coord x, coord y, coord z, coord w)
63
+ {
64
+ return (coord) glm::simplex(glm::vec4(x, y, z, w));
65
+ }
66
+
67
+ coord
68
+ simplex (const Coord3& position)
69
+ {
70
+ return (coord) glm::simplex(to_glm(position));
71
+ }
72
+
73
+
74
+ }// Rays
@@ -1,4 +1,4 @@
1
- #include "rays/opengl.h"
1
+ #include "opengl.h"
2
2
 
3
3
 
4
4
  #include "rays/exception.h"
@@ -9,23 +9,11 @@ namespace Rays
9
9
 
10
10
 
11
11
  GLenum
12
- get_error ()
12
+ OpenGL_get_error ()
13
13
  {
14
14
  return glGetError();
15
15
  }
16
16
 
17
- bool
18
- no_error ()
19
- {
20
- return get_error() == GL_NO_ERROR;
21
- }
22
-
23
- bool
24
- is_error (GLenum err)
25
- {
26
- return get_error() == err;
27
- }
28
-
29
17
  static String
30
18
  get_error_name (GLenum error)
31
19
  {
@@ -35,30 +23,24 @@ namespace Rays
35
23
  case GL_INVALID_ENUM: return "GL_INVALID_ENUM";
36
24
  case GL_INVALID_VALUE: return "GL_INVALID_VALUE";
37
25
  case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION";
38
- #ifndef IOS
39
- case GL_STACK_OVERFLOW: return "GL_STACK_OVERFLOW";
40
- case GL_STACK_UNDERFLOW: return "GL_STACK_UNDERFLOW";
41
- #endif
42
26
  case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY";
27
+ #ifndef IOS
28
+ case GL_STACK_OVERFLOW: return "GL_STACK_OVERFLOW";
29
+ case GL_STACK_UNDERFLOW: return "GL_STACK_UNDERFLOW";
30
+ #endif
43
31
  case 0x506: return "GL_INVALID_FRAMEBUFFER_OPERATION";
44
32
  case 0x8031: return "GL_TABLE_TOO_LARGE";
33
+ default: return "UNKNOWN ERROR";
45
34
  }
46
- return "UNKNOWN ERROR";
47
35
  }
48
36
 
49
37
  void
50
- check_error (const char* file, int line)
38
+ OpenGL_check_error (const char* file, int line)
51
39
  {
52
- GLenum e = get_error();
40
+ GLenum e = OpenGL_get_error();
53
41
  if (e != GL_NO_ERROR)
54
42
  opengl_error(file, line, "OpenGL error %s", get_error_name(e).c_str());
55
43
  }
56
44
 
57
- void
58
- clear_error ()
59
- {
60
- get_error();
61
- }
62
-
63
45
 
64
46
  }// Rays
@@ -0,0 +1,37 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __RAYS_SRC_OPENGL_H__
4
+ #define __RAYS_SRC_OPENGL_H__
5
+
6
+
7
+ #if defined(OSX)
8
+ #include <OpenGL/gl.h>
9
+ #include <OpenGL/glext.h>
10
+ #elif defined(IOS)
11
+ #include <OpenGLES/ES3/gl.h>
12
+ #include <OpenGLES/ES3/glext.h>
13
+ #elif defined(WIN32)
14
+ #include <GL/gl.h>
15
+ #include <GL/glext.h>
16
+ #endif
17
+
18
+ #include <rays/opengl.h>
19
+
20
+
21
+ namespace Rays
22
+ {
23
+
24
+
25
+ void OpenGL_set_context (Context context);
26
+
27
+ Context OpenGL_get_context ();
28
+
29
+ GLenum OpenGL_get_error ();
30
+
31
+ void OpenGL_check_error (const char* file, int line);
32
+
33
+
34
+ }// Rays
35
+
36
+
37
+ #endif//EOH
@@ -1,12 +1,12 @@
1
1
  // -*- objc -*-
2
- #import "rays/bitmap.h"
2
+ #import "../bitmap.h"
3
3
 
4
4
 
5
- #include <assert.h>
6
- #include <boost/scoped_array.hpp>
7
5
  #import <Cocoa/Cocoa.h>
8
6
  #include "rays/exception.h"
9
- #include "rays/texture.h"
7
+ #include "../color_space.h"
8
+ #include "../font.h"
9
+ #include "../texture.h"
10
10
  #include "../frame_buffer.h"
11
11
  #include "helper.h"
12
12
 
@@ -59,14 +59,13 @@ namespace Rays
59
59
 
60
60
  ColorSpace color_space;
61
61
 
62
- void* pixels;
62
+ void* pixels = NULL;
63
63
 
64
- CGContextRef context;
64
+ CGContextRef context = NULL;
65
65
 
66
- bool dirty;
66
+ bool modified;
67
67
 
68
68
  Data ()
69
- : pixels(NULL), context(NULL)
70
69
  {
71
70
  clear();
72
71
  }
@@ -85,7 +84,7 @@ namespace Rays
85
84
  if (bpc <= 0 || pitch <= 0) return NULL;
86
85
 
87
86
  CGColorSpaceRef cgcs = NULL;
88
- if (color_space.is_gray())
87
+ if (color_space.is_gray() || color_space.is_alpha())
89
88
  cgcs = CGColorSpaceCreateDeviceGray();
90
89
  else if (color_space.is_rgb() || color_space.is_bgr())
91
90
  cgcs = CGColorSpaceCreateDeviceRGB();
@@ -114,7 +113,7 @@ namespace Rays
114
113
  color_space = COLORSPACE_UNKNOWN;
115
114
  pixels = NULL;
116
115
  context = NULL;
117
- dirty = false;
116
+ modified = false;
118
117
  }
119
118
 
120
119
  };// Bitmap::Data
@@ -134,7 +133,7 @@ namespace Rays
134
133
  this_->self->width = w;
135
134
  this_->self->height = h;
136
135
  this_->self->color_space = cs;
137
- this_->self->dirty = true;
136
+ this_->self->modified = true;
138
137
 
139
138
  size_t size = w * h * cs.Bpp();
140
139
  this_->self->pixels = new uchar[size];
@@ -151,16 +150,109 @@ namespace Rays
151
150
  if (!this_ || !tex)
152
151
  argument_error(__FILE__, __LINE__);
153
152
 
154
- setup_bitmap(this_, tex.width(), tex.height(), tex.color_space(), NULL, false);
153
+ setup_bitmap(
154
+ this_, tex.width(), tex.height(), tex.color_space(), NULL, false);
155
155
 
156
156
  GLenum format, type;
157
- tex.color_space().get_gl_enums(&format, &type, tex.alpha_only());
157
+ ColorSpace_get_gl_format_and_type(&format, &type, tex.color_space());
158
158
 
159
159
  FrameBuffer fb(tex);
160
160
  FrameBufferBinder binder(fb.id());
161
161
 
162
162
  for (int y = 0; y < this_->height(); ++y)
163
- glReadPixels(0, y, this_->width(), 1, format, type, (GLvoid*) this_->at<uchar>(0, y));
163
+ {
164
+ GLvoid* ptr = (GLvoid*) this_->at<uchar>(0, y);
165
+ glReadPixels(0, y, this_->width(), 1, format, type, ptr);
166
+ }
167
+ }
168
+
169
+ Bitmap
170
+ Bitmap_from (const Texture& texture)
171
+ {
172
+ Bitmap bmp;
173
+ setup_bitmap(&bmp, texture);
174
+ return bmp;
175
+ }
176
+
177
+ void
178
+ Bitmap_draw_string (
179
+ Bitmap* bitmap, const RawFont& font, const char* str, coord x, coord y)
180
+ {
181
+ if (!bitmap || !*bitmap || !font || !str)
182
+ argument_error(__FILE__, __LINE__);
183
+
184
+ if (*str == '\0') return;
185
+
186
+ font.draw_string(bitmap->self->get_context(), bitmap->height(), str, x, y);
187
+ Bitmap_set_modified(bitmap);
188
+ }
189
+
190
+ void
191
+ Bitmap_set_modified (Bitmap* bitmap, bool modified)
192
+ {
193
+ assert(bitmap);
194
+
195
+ bitmap->self->modified = modified;
196
+ }
197
+
198
+ bool
199
+ Bitmap_get_modified (const Bitmap& bitmap)
200
+ {
201
+ return bitmap.self->modified;
202
+ }
203
+
204
+ void
205
+ Bitmap_save (const Bitmap& bmp, const char* path_)
206
+ {
207
+ std::shared_ptr<CGImage> img(bmp.self->get_image(), CGImageRelease);
208
+ if (!img)
209
+ rays_error(__FILE__, __LINE__, "getting CGImage failed.");
210
+
211
+ NSString* path = [NSString stringWithUTF8String: path_];
212
+ NSURL* url = [NSURL fileURLWithPath: path];
213
+ if (!url)
214
+ rays_error(__FILE__, __LINE__, "creating NSURL failed.");
215
+
216
+ std::shared_ptr<CGImageDestination> dest(
217
+ CGImageDestinationCreateWithURL((CFURLRef) url, kUTTypePNG, 1, NULL),
218
+ safe_cfrelease);
219
+ if (!dest)
220
+ rays_error(__FILE__, __LINE__, "CGImageDestinationCreateWithURL() failed.");
221
+
222
+ CGImageDestinationAddImage(dest.get(), img.get(), NULL);
223
+ if (!CGImageDestinationFinalize(dest.get()))
224
+ rays_error(__FILE__, __LINE__, "CGImageDestinationFinalize() failed.");
225
+ }
226
+
227
+ Bitmap
228
+ Bitmap_load (const char* path_)
229
+ {
230
+ if (!path_ || path_[0] == '\0')
231
+ argument_error(__FILE__, __LINE__);
232
+
233
+ NSString* path = [NSString stringWithUTF8String: path_];
234
+ NSBitmapImageRep* imagerep =
235
+ [NSBitmapImageRep imageRepWithContentsOfFile: path];
236
+ if (!imagerep)
237
+ rays_error(__FILE__, __LINE__, "[NSBitmapImageRep imageRepWithContentsOfFile] failed.");
238
+
239
+ CGImageRef image = [imagerep CGImage];
240
+ if (!image)
241
+ rays_error(__FILE__, __LINE__, "[imagerep CGImage] failed.");
242
+
243
+ size_t width = CGImageGetWidth(image);
244
+ size_t height = CGImageGetHeight(image);
245
+
246
+ Bitmap bmp((int) width, (int) height, RGBA);
247
+ if (!bmp)
248
+ rays_error(__FILE__, __LINE__, "invalid bitmap.");
249
+
250
+ CGContextRef context = bmp.self->get_context();
251
+ if (!context)
252
+ rays_error(__FILE__, __LINE__, "creating CGContext failed.");
253
+
254
+ CGContextDrawImage(context, CGRectMake(0, 0, width, height), image);
255
+ return bmp;
164
256
  }
165
257
 
166
258
 
@@ -174,17 +266,12 @@ namespace Rays
174
266
  setup_bitmap(this, width, height, color_space, pixels);
175
267
  }
176
268
 
177
- Bitmap::Bitmap (const Texture& texture)
178
- {
179
- setup_bitmap(this, texture);
180
- }
181
-
182
269
  Bitmap::~Bitmap ()
183
270
  {
184
271
  }
185
272
 
186
273
  Bitmap
187
- Bitmap::copy () const
274
+ Bitmap::dup () const
188
275
  {
189
276
  return Bitmap(width(), height(), color_space(), pixels());
190
277
  }
@@ -239,22 +326,13 @@ namespace Rays
239
326
  return const_cast<This*>(this)->pixels();
240
327
  }
241
328
 
242
- bool
243
- Bitmap::dirty () const
244
- {
245
- return self->dirty;
246
- }
247
-
248
- void
249
- Bitmap::set_dirty (bool b)
250
- {
251
- self->dirty = b;
252
- }
253
-
254
329
  Bitmap::operator bool () const
255
330
  {
256
331
  return
257
- self->width > 0 && self->height > 0 && self->color_space && self->pixels;
332
+ self->width > 0 &&
333
+ self->height > 0 &&
334
+ self->color_space &&
335
+ self->pixels;
258
336
  }
259
337
 
260
338
  bool
@@ -264,77 +342,4 @@ namespace Rays
264
342
  }
265
343
 
266
344
 
267
- Bitmap
268
- load_bitmap (const char* path_)
269
- {
270
- if (!path_ || path_[0] == '\0')
271
- argument_error(__FILE__, __LINE__);
272
-
273
- NSString* path = [NSString stringWithUTF8String: path_];
274
- NSBitmapImageRep* imagerep =
275
- [NSBitmapImageRep imageRepWithContentsOfFile: path];
276
- if (!imagerep)
277
- rays_error(__FILE__, __LINE__, "[NSBitmapImageRep imageRepWithContentsOfFile] failed.");
278
-
279
- CGImageRef image = [imagerep CGImage];
280
- if (!image)
281
- rays_error(__FILE__, __LINE__, "[imagerep CGImage] failed.");
282
-
283
- size_t width = CGImageGetWidth(image);
284
- size_t height = CGImageGetHeight(image);
285
-
286
- Bitmap bmp((int) width, (int) height, RGBA);
287
- if (!bmp)
288
- rays_error(__FILE__, __LINE__, "invalid bitmap.");
289
-
290
- CGContextRef context = bmp.self->get_context();
291
- if (!context)
292
- rays_error(__FILE__, __LINE__, "creating CGContext failed.");
293
-
294
- CGContextDrawImage(context, CGRectMake(0, 0, width, height), image);
295
- return bmp;
296
- }
297
-
298
- void
299
- save_bitmap (const Bitmap& bmp, const char* path_)
300
- {
301
- boost::shared_ptr<CGImage> img(
302
- bmp.self->get_image(), CGImageRelease);
303
- if (!img)
304
- rays_error(__FILE__, __LINE__, "getting CGImage failed.");
305
-
306
- NSString* path = [NSString stringWithUTF8String: path_];
307
- NSURL* url = [NSURL fileURLWithPath: path];
308
- if (!url)
309
- rays_error(__FILE__, __LINE__, "creating NSURL failed.");
310
-
311
- boost::shared_ptr<CGImageDestination> dest(
312
- CGImageDestinationCreateWithURL((CFURLRef) url, kUTTypePNG, 1, NULL),
313
- safe_cfrelease);
314
- if (!dest)
315
- rays_error(__FILE__, __LINE__, "CGImageDestinationCreateWithURL() failed.");
316
-
317
- CGImageDestinationAddImage(dest.get(), img.get(), NULL);
318
- if (!CGImageDestinationFinalize(dest.get()))
319
- rays_error(__FILE__, __LINE__, "CGImageDestinationFinalize() failed.");
320
- }
321
-
322
-
323
- void draw_string (
324
- CGContextRef, coord, const char*, coord, coord, const Font&);
325
-
326
- void
327
- draw_string (
328
- Bitmap* bmp, const char* str, coord x, coord y, const Font& font)
329
- {
330
- if (!bmp || !*bmp || !str || !font)
331
- argument_error(__FILE__, __LINE__);
332
-
333
- if (*str == '\0') return;
334
-
335
- draw_string(bmp->self->get_context(), bmp->height(), str, x, y, font);
336
- bmp->set_dirty();
337
- }
338
-
339
-
340
345
  }// Rays