rays 0.1.3 → 0.1.4

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 (88) hide show
  1. data/.doc/ext/rays/bitmap.cpp +76 -53
  2. data/.doc/ext/rays/font.cpp +31 -27
  3. data/.doc/ext/rays/image.cpp +44 -37
  4. data/.doc/ext/rays/native.cpp +6 -0
  5. data/.doc/ext/rays/painter.cpp +276 -160
  6. data/.doc/ext/rays/rays.cpp +8 -9
  7. data/.doc/ext/rays/texture.cpp +50 -28
  8. data/.gitignore +14 -0
  9. data/Rakefile +5 -30
  10. data/VERSION +1 -1
  11. data/ext/rays/bitmap.cpp +77 -53
  12. data/ext/rays/bounds.cpp +426 -0
  13. data/ext/rays/color.cpp +199 -0
  14. data/ext/rays/defs.h +1 -18
  15. data/ext/rays/extconf.rb +10 -8
  16. data/ext/rays/font.cpp +31 -27
  17. data/ext/rays/image.cpp +44 -37
  18. data/ext/rays/matrix.cpp +154 -0
  19. data/ext/rays/native.cpp +6 -0
  20. data/ext/rays/painter.cpp +288 -163
  21. data/ext/rays/point.cpp +175 -0
  22. data/ext/rays/rays.cpp +8 -9
  23. data/ext/rays/texture.cpp +52 -28
  24. data/include/rays.h +1 -2
  25. data/include/rays/bitmap.h +5 -3
  26. data/include/rays/bounds.h +94 -0
  27. data/include/rays/color.h +53 -0
  28. data/include/rays/colorspace.h +2 -2
  29. data/include/rays/exception.h +1 -1
  30. data/include/rays/font.h +7 -3
  31. data/include/rays/image.h +6 -2
  32. data/include/rays/matrix.h +63 -0
  33. data/include/rays/opengl.h +1 -1
  34. data/include/rays/painter.h +138 -39
  35. data/include/rays/point.h +39 -0
  36. data/include/rays/ruby.h +3 -0
  37. data/include/rays/ruby/bitmap.h +5 -3
  38. data/include/rays/ruby/bounds.h +41 -0
  39. data/include/rays/ruby/color.h +41 -0
  40. data/include/rays/ruby/font.h +5 -3
  41. data/include/rays/ruby/image.h +5 -3
  42. data/include/rays/ruby/matrix.h +41 -0
  43. data/include/rays/ruby/painter.h +5 -3
  44. data/include/rays/ruby/point.h +41 -0
  45. data/include/rays/ruby/texture.h +5 -3
  46. data/include/rays/texture.h +6 -2
  47. data/lib/rays.rb +3 -0
  48. data/lib/rays/autoinit.rb +1 -1
  49. data/lib/rays/bitmap.rb +15 -1
  50. data/lib/rays/bounds.rb +138 -0
  51. data/lib/rays/color.rb +52 -0
  52. data/lib/rays/ext.rb +4 -0
  53. data/lib/rays/image.rb +1 -1
  54. data/lib/rays/module.rb +9 -2
  55. data/lib/rays/painter.rb +40 -41
  56. data/lib/rays/point.rb +82 -0
  57. data/lib/rays/texture.rb +1 -1
  58. data/rays.gemspec +16 -37
  59. data/src/bounds.cpp +234 -0
  60. data/src/cocoa/bitmap.mm +4 -4
  61. data/src/cocoa/font.mm +35 -30
  62. data/src/cocoa/rays.mm +2 -0
  63. data/src/color.cpp +77 -0
  64. data/src/colorspace.cpp +3 -3
  65. data/src/exception.cpp +3 -18
  66. data/src/image.cpp +9 -2
  67. data/src/matrix.cpp +103 -0
  68. data/src/painter.cpp +475 -224
  69. data/src/point.cpp +52 -0
  70. data/src/texture.cpp +14 -2
  71. data/src/win32/bitmap.cpp +2 -2
  72. data/src/win32/gdi.cpp +22 -13
  73. data/src/win32/gdi.h +7 -7
  74. data/test/helpers.rb +1 -5
  75. data/test/test_bitmap.rb +9 -0
  76. data/test/test_bounds.rb +246 -0
  77. data/test/test_color.rb +88 -0
  78. data/test/test_font.rb +28 -0
  79. data/test/test_image.rb +9 -0
  80. data/test/test_painter.rb +1 -3
  81. data/test/test_point.rb +121 -0
  82. data/test/test_rays.rb +2 -3
  83. data/test/test_texture.rb +1 -3
  84. metadata +146 -75
  85. data/include/rays/helpers.h +0 -37
  86. data/include/rays/transform.h +0 -35
  87. data/src/helpers.cpp +0 -22
  88. data/src/transform.cpp +0 -88
@@ -1,37 +0,0 @@
1
- // -*- c++ -*-
2
- #pragma once
3
- #ifndef __RAYS_HELPERS_H__
4
- #define __RAYS_HELPERS_H__
5
-
6
-
7
- #include <boost/shared_ptr.hpp>
8
-
9
-
10
- namespace Rays
11
- {
12
-
13
-
14
- template <typename T>
15
- class Impl : public boost::shared_ptr<T>
16
- {
17
-
18
- typedef boost::shared_ptr<T> Super;
19
-
20
- public:
21
-
22
- Impl () : Super(new T) {}
23
-
24
- Impl (T* p) : Super(p) {}
25
-
26
- };// Impl
27
-
28
-
29
- int bit2byte (int bits);
30
-
31
- int byte2bit (int bytes);
32
-
33
-
34
- }// Rays
35
-
36
-
37
- #endif//EOH
@@ -1,35 +0,0 @@
1
- // -*- c++ -*-
2
- #pragma once
3
- #ifndef __RAYS_TRANSFORM_H__
4
- #define __RAYS_TRANSFORM_H__
5
-
6
-
7
- #include <rays/defs.h>
8
-
9
-
10
- namespace Rays
11
- {
12
-
13
-
14
- bool translate (coord x, coord y, coord z = 0);
15
-
16
- bool scale (coord x, coord y, coord z = 1);
17
-
18
- bool rotate (coord angle, coord x = 0, coord y = 0, coord z = 1);
19
-
20
-
21
- bool set_matrix (coord value = 1);
22
-
23
- bool set_matrix (coord* elements, size_t size);
24
-
25
- bool get_matrix (coord* elements, size_t size);
26
-
27
- bool push_matrix ();
28
-
29
- bool pop_matrix ();
30
-
31
-
32
- }// Rays
33
-
34
-
35
- #endif//EOH
data/src/helpers.cpp DELETED
@@ -1,22 +0,0 @@
1
- #include "rays/helpers.h"
2
-
3
-
4
- namespace Rays
5
- {
6
-
7
-
8
- int
9
- bit2byte (int bits)
10
- {
11
- if ((bits % 8) != 0) return -1;
12
- return bits / 8;
13
- }
14
-
15
- int
16
- byte2bit (int bytes)
17
- {
18
- return bytes * 8;
19
- }
20
-
21
-
22
- }// Rays
data/src/transform.cpp DELETED
@@ -1,88 +0,0 @@
1
- #include "rays/painter.h"
2
-
3
-
4
- #include "rays/opengl.h"
5
-
6
-
7
- namespace Rays
8
- {
9
-
10
-
11
- static bool
12
- is_error ()
13
- {
14
- GLenum e = glGetError();
15
- return e == GL_INVALID_OPERATION;
16
- }
17
-
18
- static bool
19
- is_error (GLenum error)
20
- {
21
- GLenum e = glGetError();
22
- return e == GL_INVALID_OPERATION || e == error;
23
- }
24
-
25
-
26
- bool
27
- translate (coord x, coord y, coord z)
28
- {
29
- glTranslatef(x, y, z);
30
- return !is_error();
31
- }
32
-
33
- bool
34
- scale (coord x, coord y, coord z)
35
- {
36
- glScalef(x, y, z);
37
- return !is_error();
38
- }
39
-
40
- bool
41
- rotate (float angle, coord x, coord y, coord z)
42
- {
43
- glRotatef(angle, x, y, z);
44
- return !is_error();
45
- }
46
-
47
-
48
- bool
49
- set_matrix (coord value)
50
- {
51
- glLoadIdentity();
52
- if (is_error()) return false;
53
- if (value == 1) return true;
54
- return scale(value, value, value);
55
- }
56
-
57
- bool
58
- set_matrix (const coord* elements, size_t size)
59
- {
60
- if (!elements || size != 16) return false;
61
- glLoadMatrixf(elements);
62
- return !is_error();
63
- }
64
-
65
- bool
66
- get_matrix (coord* elements, size_t size)
67
- {
68
- if (!elements || size != 16) return false;
69
- glGetFloatv(GL_MODELVIEW_MATRIX, elements);
70
- return !is_error(GL_INVALID_ENUM);
71
- }
72
-
73
- bool
74
- push_matrix ()
75
- {
76
- glPushMatrix();
77
- return !is_error(GL_STACK_OVERFLOW);
78
- }
79
-
80
- bool
81
- pop_matrix ()
82
- {
83
- glPopMatrix();
84
- return !is_error(GL_STACK_UNDERFLOW);
85
- }
86
-
87
-
88
- }// Rays