rays 0.1.11 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
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,65 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __RAYS_SRC_TEXTURE_H__
4
+ #define __RAYS_SRC_TEXTURE_H__
5
+
6
+
7
+ #include <xot/pimpl.h>
8
+ #include <rays/defs.h>
9
+ #include <rays/color_space.h>
10
+ #include "opengl.h"
11
+
12
+
13
+ namespace Rays
14
+ {
15
+
16
+
17
+ class Bitmap;
18
+
19
+
20
+ class Texture
21
+ {
22
+
23
+ public:
24
+
25
+ Texture ();
26
+
27
+ Texture (int width, int height, const ColorSpace& cs = RGBA);
28
+
29
+ Texture (const Bitmap& bitmap);
30
+
31
+ ~Texture ();
32
+
33
+ int width () const;
34
+
35
+ int reserved_width () const;
36
+
37
+ int height () const;
38
+
39
+ int reserved_height () const;
40
+
41
+ const ColorSpace& color_space () const;
42
+
43
+ Context context () const;
44
+
45
+ GLuint id () const;
46
+
47
+ void set_modified (bool modified = true);
48
+
49
+ bool modified () const;
50
+
51
+ operator bool () const;
52
+
53
+ bool operator ! () const;
54
+
55
+ struct Data;
56
+
57
+ Xot::PSharedImpl<Data> self;
58
+
59
+ };// Texture
60
+
61
+
62
+ }// Rays
63
+
64
+
65
+ #endif//EOH
@@ -1,6 +1,7 @@
1
- #include "rays/bitmap.h"
1
+ #include "../bitmap.h"
2
2
 
3
3
 
4
+ #include "font.h"
4
5
  #include "gdi.h"
5
6
 
6
7
 
@@ -19,10 +20,10 @@ namespace Rays
19
20
 
20
21
  Win32::MemoryDC memdc;
21
22
 
22
- bool dirty;
23
+ bool modified;
23
24
 
24
25
  Data ()
25
- : pixels(NULL), dirty(true)
26
+ : pixels(NULL), modified(true)
26
27
  {
27
28
  }
28
29
 
@@ -56,7 +57,7 @@ namespace Rays
56
57
  }
57
58
 
58
59
  static bool
59
- setup (Bitmap* bmp, int w, int h, const ColorSpace& cs, HDC hdc = NULL)
60
+ setup_bitmap (Bitmap* bmp, int w, int h, const ColorSpace& cs, HDC hdc = NULL)
60
61
  {
61
62
  if (w <= 0 || h <= 0 || !cs || !bmp || *bmp)
62
63
  return false;
@@ -94,6 +95,59 @@ namespace Rays
94
95
  return init_bitmap_pixels(bmp);
95
96
  }
96
97
 
98
+ static void
99
+ setup_bitmap (Bitmap* this_, const Texture& tex)
100
+ {
101
+ not_implement_error(__FILE__, __LINE__);
102
+ }
103
+
104
+ Bitmap
105
+ Bitmap_from (const Texture& texture)
106
+ {
107
+ Bitmap bmp;
108
+ setup_bitmap(&bmp, texture);
109
+ return bmp;
110
+ }
111
+
112
+ void
113
+ Bitmap_draw_string (
114
+ Bitmap* bitmap, const RawFont& font, const char* str, coord x, coord y)
115
+ {
116
+ if (!bitmap || !*bitmap || !font || !str)
117
+ argument_error(__FILE__, __LINE__);
118
+
119
+ if (*str == '\0') return;
120
+
121
+ font.draw_string(bitmap->self->memdc.handle(), bitmap->height(), str, x, y);
122
+ Bitmap_set_modified(bitmap);
123
+ }
124
+
125
+ void
126
+ Bitmap_set_modified (Bitmap* bitmap, bool modified)
127
+ {
128
+ assert(bitmap);
129
+
130
+ bitmap->self->modified = modified;
131
+ }
132
+
133
+ bool
134
+ Bitmap_get_modified (const Bitmap& bitmap)
135
+ {
136
+ return bitmap.self->modified;
137
+ }
138
+
139
+ bool
140
+ Bitmap_save (const Bitmap& bitmap, const char* path)
141
+ {
142
+ return false;
143
+ }
144
+
145
+ bool
146
+ Bitmap_load (Bitmap* bitmap, const char* path)
147
+ {
148
+ return false;
149
+ }
150
+
97
151
 
98
152
  Bitmap::Bitmap ()
99
153
  {
@@ -101,7 +155,7 @@ namespace Rays
101
155
 
102
156
  Bitmap::Bitmap (int width, int height, const ColorSpace& cs)
103
157
  {
104
- setup(this, width, height, cs);
158
+ setup_bitmap(this, width, height, cs);
105
159
  }
106
160
 
107
161
  Bitmap::~Bitmap ()
@@ -138,28 +192,16 @@ namespace Rays
138
192
  return pitch() * height();
139
193
  }
140
194
 
141
- bool
142
- Bitmap::dirty () const
143
- {
144
- return self->dirty;
145
- }
146
-
147
- void
148
- Bitmap::set_dirty (bool b)
149
- {
150
- self->dirty = b;
151
- }
152
-
153
195
  void*
154
- Bitmap::data ()
196
+ Bitmap::pixels ()
155
197
  {
156
198
  return self->pixels;
157
199
  }
158
200
 
159
201
  const void*
160
- Bitmap::data () const
202
+ Bitmap::pixels () const
161
203
  {
162
- return const_cast<This*>(this)->data();
204
+ return const_cast<This*>(this)->pixels();
163
205
  }
164
206
 
165
207
  Bitmap::operator bool () const
@@ -177,36 +219,4 @@ namespace Rays
177
219
  }
178
220
 
179
221
 
180
- bool
181
- load_bitmap (Bitmap* bitmap, const char* path)
182
- {
183
- return false;
184
- }
185
-
186
- bool
187
- save_bitmap (const Bitmap& bitmap, const char* path)
188
- {
189
- return false;
190
- }
191
-
192
-
193
- bool draw_string (
194
- HDC, coord, const char*, coord, coord, const Font&);
195
-
196
- bool
197
- draw_string (
198
- Bitmap* bmp, const char* str, coord x, coord y, const Font& font)
199
- {
200
- if (!bmp || !*bmp || !str || !font) return false;
201
-
202
- if (*str == '\0') return true;
203
-
204
- if (!draw_string(bmp->self->memdc.handle(), bmp->height(), str, x, y, font))
205
- return false;
206
-
207
- bmp->set_dirty();
208
- return true;
209
- }
210
-
211
-
212
222
  }// Rays
@@ -1,7 +1,4 @@
1
- #include "rays/font.h"
2
-
3
-
4
- #include "gdi.h"
1
+ #include "font.h"
5
2
 
6
3
 
7
4
  namespace Rays
@@ -67,23 +64,23 @@ namespace Rays
67
64
  }
68
65
 
69
66
 
70
- bool
71
- draw_string (
72
- HDC hdc, coord context_height,
73
- const char* str, coord x, coord y, const Font& font)
67
+ void
68
+ Font_draw_string (
69
+ const Font& font, HDC hdc, coord context_height,
70
+ const char* str, coord x, coord y)
74
71
  {
75
72
  using namespace Win32;
76
73
 
77
- if (!hdc || !str || !font) return false;
74
+ if (!font || !hdc || !str)
75
+ argument_error(__FILE__, __LINE__);
78
76
 
79
- if (*str == '\0') return true;
77
+ if (*str == '\0') return;
80
78
 
81
79
  coord width = 0, height = 0;
82
80
  if (!font.get_extent(&width, &height, str))
83
- return false;
81
+ rays_error(__FILE__, __LINE__, "getting font extent failed.");
84
82
 
85
83
  DC dc = hdc;
86
-
87
84
  RECT rect = {x, y, x + (int) width, y + (int) height};
88
85
  FillRect(dc.handle(), &rect, Brush(0, 0, 0).handle());
89
86
 
@@ -92,7 +89,8 @@ namespace Rays
92
89
  BOOL ret = TextOutA(dc.handle(), x, y, str, strlen(str));
93
90
  dc.set_font(old);
94
91
 
95
- return ret != FALSE;
92
+ if (ret == FALSE)
93
+ rays_error(__FILE__, __LINE__, "drawing text failed.");
96
94
  }
97
95
 
98
96
 
@@ -0,0 +1,24 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __RAYS_SRC_WIN32_FONT_H__
4
+ #define __RAYS_SRC_WIN32_FONT_H__
5
+
6
+
7
+ #include <rays/defs.h>
8
+ #include <rays/font.h>
9
+ #include "gdi.h"
10
+
11
+
12
+ namespace Rays
13
+ {
14
+
15
+
16
+ bool RawFont_draw_string (
17
+ const RawFont& font, HDC hdc, coord context_height,
18
+ const char* str, coord x, coord y);
19
+
20
+
21
+ }// Rays
22
+
23
+
24
+ #endif//EOH
@@ -38,7 +38,7 @@ namespace Rays
38
38
 
39
39
  struct Data;
40
40
 
41
- Xot::PImpl<Data, true> self;
41
+ Xot::PSharedImpl<Data> self;
42
42
 
43
43
  };// Pen
44
44
 
@@ -64,7 +64,7 @@ namespace Rays
64
64
 
65
65
  struct Data;
66
66
 
67
- Xot::PImpl<Data, true> self;
67
+ Xot::PSharedImpl<Data> self;
68
68
 
69
69
  };// Brush
70
70
 
@@ -95,7 +95,7 @@ namespace Rays
95
95
 
96
96
  struct Data;
97
97
 
98
- Xot::PImpl<Data, true> self;
98
+ Xot::PSharedImpl<Data> self;
99
99
 
100
100
  };// Font
101
101
 
@@ -123,7 +123,7 @@ namespace Rays
123
123
 
124
124
  struct Data;
125
125
 
126
- Xot::PImpl<Data, true> self;
126
+ Xot::PSharedImpl<Data> self;
127
127
 
128
128
  };// Bitmap
129
129
 
@@ -181,7 +181,7 @@ namespace Rays
181
181
 
182
182
  struct Data;
183
183
 
184
- Xot::PImpl<Data, true> self;
184
+ Xot::PSharedImpl<Data> self;
185
185
 
186
186
  };// DC
187
187
 
@@ -209,7 +209,7 @@ namespace Rays
209
209
 
210
210
  struct Data;
211
211
 
212
- Xot::PImpl<Data, true> self;
212
+ Xot::PSharedImpl<Data> self;
213
213
 
214
214
  };// MemoryDC
215
215
 
@@ -15,6 +15,3 @@ include Xot::Test
15
15
  unless $RAYS_NOAUTOINIT
16
16
  def Rays.fin! () end
17
17
  end
18
-
19
-
20
- Rays.init_offscreen_context
@@ -9,19 +9,43 @@ class TestBitmap < Test::Unit::TestCase
9
9
  W = 32
10
10
  H = 16
11
11
 
12
- def bmp (w = W, h = H)
12
+ def bitmap (w = W, h = H)
13
13
  Rays::Bitmap.new w, h
14
14
  end
15
15
 
16
+ def color (*args)
17
+ Rays::Color.new *args
18
+ end
19
+
16
20
  def test_initialize ()
17
- assert_equal W, bmp.width
18
- assert_equal H, bmp.height
21
+ assert_equal W, bitmap.width
22
+ assert_equal H, bitmap.height
23
+ end
24
+
25
+ def test_dup ()
26
+ o = bitmap
27
+ assert_equal color(0, 0, 0, 0), o[0, 0]
28
+ o[0, 0] = color(1, 0, 0, 0)
29
+ assert_equal color(1, 0, 0, 0), o[0, 0]
30
+ x = o.dup
31
+ assert_equal color(1, 0, 0, 0), x[0, 0]
32
+ x[0, 0] = color(0, 1, 0, 0)
33
+ assert_equal color(0, 1, 0, 0), x[0, 0]
34
+ assert_equal color(1, 0, 0, 0), o[0, 0]
35
+ end
36
+
37
+ def test_at ()
38
+ o = bitmap
39
+ assert_equal color(0, 0, 0, 0), o[0, 0]
40
+ o[0, 0] = 1
41
+ assert_equal color(1, 1, 1, 1), o[0, 0]
19
42
  end
20
43
 
21
- def test_to_texture ()
22
- assert_equal Rays::Texture, bmp.to_texture.class
23
- assert_equal W, bmp.to_texture.width
24
- assert_equal H, bmp.to_texture.height
44
+ def test_to_a ()
45
+ colors = %w[#f00 #0f0 #00f #ff0].map {|s| color s}
46
+ bmp = bitmap 2, 2
47
+ bmp[0, 0], bmp[1, 0], bmp[0, 1], bmp[1, 1] = colors
48
+ assert_equal colors, bmp.to_a
25
49
  end
26
50
 
27
51
  end# TestBitmap
@@ -25,6 +25,18 @@ class TestBounds < Test::Unit::TestCase
25
25
  assert_raise(ArgumentError) {bounds(1, 2, 3, 4, 5, 6, 7)}
26
26
  end
27
27
 
28
+ def test_dup ()
29
+ o = bounds
30
+ assert_equal bounds(0, 0, 0, 0, 0, 0), o
31
+ o.x = 1
32
+ assert_equal bounds(1, 0, 0, 0, 0, 0), o
33
+ x = o.dup
34
+ assert_equal bounds(1, 0, 0, 0, 0, 0), x
35
+ x.x = 2
36
+ assert_equal bounds(2, 0, 0, 0, 0, 0), x
37
+ assert_equal bounds(1, 0, 0, 0, 0, 0), o
38
+ end
39
+
28
40
  def test_intersect? ()
29
41
  assert bounds(10, 20, 30, 100, 100, 100).intersect?(bounds 50, 60, 70, 100, 100, 100)
30
42
  assert_not bounds(10, 20, 30, 10, 10, 10).intersect?(bounds 50, 60, 70, 100, 100, 100)
@@ -35,6 +47,16 @@ class TestBounds < Test::Unit::TestCase
35
47
  assert_not bounds(10, 20, 30, 10, 10, 10).include?(point 50, 60)
36
48
  end
37
49
 
50
+ def test_valid? ()
51
+ assert bounds(0, 0, 0, 0, 0, 0).valid?
52
+ assert bounds(0, 0, 0, 1, 0, 0).valid?
53
+ assert bounds(0, 0, 0, 0, 1, 0).valid?
54
+ assert bounds(0, 0, 0, 0, 0, 1).valid?
55
+ assert_not bounds(0, 0, 0, -1, 0, 0).valid?
56
+ assert_not bounds(0, 0, 0, 0, -1, 0).valid?
57
+ assert_not bounds(0, 0, 0, 0, 0, -1).valid?
58
+ end
59
+
38
60
  def test_get_xyzwhd ()
39
61
  o = bounds 1, 2, 3, 4, 5, 6
40
62
  assert_equal 1, o.x
@@ -285,8 +307,22 @@ class TestBounds < Test::Unit::TestCase
285
307
  def test_operators ()
286
308
  assert_equal bounds(50, 60, 70, 60, 60, 60), bounds(10, 20, 30, 100, 100, 100) & bounds(50, 60, 70, 100, 100, 100)
287
309
  assert_equal bounds(10, 20, 30, 140, 140, 140), bounds(10, 20, 30, 100, 100, 100) | bounds(50, 60, 70, 100, 100, 100)
310
+ assert_equal bounds(10, 20, 30, 20, 20, 20), bounds(20, 30, 40, 10, 10, 10) | point(10, 20, 30)
311
+ assert_equal bounds(10, 20, 30, 30, 30, 30), bounds(10, 20, 30, 10, 10, 10) | point(40, 50, 60)
288
312
 
289
313
  assert_equal point(0), (bounds(10, 20, 30, 10, 10, 10) & bounds(50, 60, 70, 10, 10, 10)).size
290
314
  end
291
315
 
316
+ def test_invalid ()
317
+ o = Rays::Bounds.invalid
318
+ assert_not o.valid?
319
+
320
+ o |= point(1, 2)
321
+ assert o.valid?
322
+ assert_equal bounds(1, 2, 0, 0), o
323
+
324
+ o |= point(10, 20)
325
+ assert_equal bounds(1, 2, 9, 18), o
326
+ end
327
+
292
328
  end# TestBounds