Class: SwfRuby::Swf::Rectangle
- Inherits:
-
Object
- Object
- SwfRuby::Swf::Rectangle
- Defined in:
- lib/swf_ruby/swf/rectangle.rb
Instance Attribute Summary collapse
-
#bits ⇒ Object
Returns the value of attribute bits.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#xmax ⇒ Object
Returns the value of attribute xmax.
-
#xmin ⇒ Object
Returns the value of attribute xmin.
-
#ymax ⇒ Object
Returns the value of attribute ymax.
-
#ymin ⇒ Object
Returns the value of attribute ymin.
Instance Method Summary collapse
-
#initialize(bytearray) ⇒ Rectangle
constructor
A new instance of Rectangle.
Constructor Details
#initialize(bytearray) ⇒ Rectangle
Returns a new instance of Rectangle.
13 14 15 16 17 18 19 20 21 |
# File 'lib/swf_ruby/swf/rectangle.rb', line 13 def initialize(bytearray) @bits = bytearray[0].chr.unpack("B5").first.to_i(2) rect_bitstr = bytearray[0..((self.bits/2)+1)].unpack("B*").first @xmin = rect_bitstr[5, self.bits].to_i(2) @xmax = rect_bitstr[5+self.bits, self.bits].to_i(2) @ymin = rect_bitstr[5+2*self.bits, self.bits].to_i(2) @ymax = rect_bitstr[5+3*self.bits, self.bits].to_i(2) @length = (5+self.bits*4)/8+1 # including padded byte end |
Instance Attribute Details
#bits ⇒ Object
Returns the value of attribute bits.
6 7 8 |
# File 'lib/swf_ruby/swf/rectangle.rb', line 6 def bits @bits end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
11 12 13 |
# File 'lib/swf_ruby/swf/rectangle.rb', line 11 def length @length end |
#xmax ⇒ Object
Returns the value of attribute xmax.
8 9 10 |
# File 'lib/swf_ruby/swf/rectangle.rb', line 8 def xmax @xmax end |
#xmin ⇒ Object
Returns the value of attribute xmin.
7 8 9 |
# File 'lib/swf_ruby/swf/rectangle.rb', line 7 def xmin @xmin end |
#ymax ⇒ Object
Returns the value of attribute ymax.
10 11 12 |
# File 'lib/swf_ruby/swf/rectangle.rb', line 10 def ymax @ymax end |
#ymin ⇒ Object
Returns the value of attribute ymin.
9 10 11 |
# File 'lib/swf_ruby/swf/rectangle.rb', line 9 def ymin @ymin end |