Class: Win32::CaptureIE::Area
- Inherits:
-
Object
- Object
- Win32::CaptureIE::Area
- Defined in:
- lib/win32/capture_ie/area.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#h ⇒ Object
(also: #height)
Returns the value of attribute h.
-
#w ⇒ Object
(also: #width)
Returns the value of attribute w.
-
#x ⇒ Object
(also: #x1)
Returns the value of attribute x.
-
#y ⇒ Object
(also: #y1)
Returns the value of attribute y.
Instance Method Summary collapse
- #+(other) ⇒ Object
- #bottom_left ⇒ Object
- #bottom_right ⇒ Object
-
#initialize(x, y, w, h) ⇒ Area
constructor
A new instance of Area.
- #rect ⇒ Object
- #to_s ⇒ Object
- #top_left ⇒ Object
- #top_right ⇒ Object
- #x2 ⇒ Object
- #y2 ⇒ Object
Constructor Details
#initialize(x, y, w, h) ⇒ Area
Returns a new instance of Area.
13 14 15 |
# File 'lib/win32/capture_ie/area.rb', line 13 def initialize(x, y, w, h) @x, @y, @w, @h = x, y, w, h end |
Instance Attribute Details
#h ⇒ Object Also known as: height
Returns the value of attribute h.
7 8 9 |
# File 'lib/win32/capture_ie/area.rb', line 7 def h @h end |
#w ⇒ Object Also known as: width
Returns the value of attribute w.
7 8 9 |
# File 'lib/win32/capture_ie/area.rb', line 7 def w @w end |
#x ⇒ Object Also known as: x1
Returns the value of attribute x.
7 8 9 |
# File 'lib/win32/capture_ie/area.rb', line 7 def x @x end |
#y ⇒ Object Also known as: y1
Returns the value of attribute y.
7 8 9 |
# File 'lib/win32/capture_ie/area.rb', line 7 def y @y end |
Instance Method Details
#+(other) ⇒ Object
45 46 47 48 49 |
# File 'lib/win32/capture_ie/area.rb', line 45 def +(other) tl = top_left.zip(other.top_left).map{|e| e.min } br = bottom_right.zip(other.bottom_right).map{|e| e.max } self.class.new(tl[0], tl[1], br[0] - tl[0], br[1] - tl[1]) end |
#bottom_left ⇒ Object
33 34 35 |
# File 'lib/win32/capture_ie/area.rb', line 33 def bottom_left [x1, y2] end |
#bottom_right ⇒ Object
37 38 39 |
# File 'lib/win32/capture_ie/area.rb', line 37 def bottom_right [x2, y2] end |
#rect ⇒ Object
41 42 43 |
# File 'lib/win32/capture_ie/area.rb', line 41 def rect [x1, y1, x2, y2] end |
#to_s ⇒ Object
51 52 53 |
# File 'lib/win32/capture_ie/area.rb', line 51 def to_s "[(%d, %d), (%d, %d)]" % rect end |
#top_left ⇒ Object
25 26 27 |
# File 'lib/win32/capture_ie/area.rb', line 25 def top_left [x1, y1] end |
#top_right ⇒ Object
29 30 31 |
# File 'lib/win32/capture_ie/area.rb', line 29 def top_right [x2, y1] end |
#x2 ⇒ Object
17 18 19 |
# File 'lib/win32/capture_ie/area.rb', line 17 def x2 x + w end |
#y2 ⇒ Object
21 22 23 |
# File 'lib/win32/capture_ie/area.rb', line 21 def y2 y + h end |