Class: SwfRuby::Swf::Gradrecord
- Inherits:
-
Object
- Object
- SwfRuby::Swf::Gradrecord
- Defined in:
- lib/swf_ruby/swf/gradrecord.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#ratio ⇒ Object
Returns the value of attribute ratio.
-
#shape_version ⇒ Object
Returns the value of attribute shape_version.
Instance Method Summary collapse
-
#initialize(bytearray, shape_version) ⇒ Gradrecord
constructor
A new instance of Gradrecord.
Constructor Details
#initialize(bytearray, shape_version) ⇒ Gradrecord
Returns a new instance of Gradrecord.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/swf_ruby/swf/gradrecord.rb', line 11 def initialize(bytearray, shape_version) @shape_version = shape_version @ratio = bytearray[0, 1].unpack("C").first offset = 1 if @shape_version >= 3 @color = SwfRuby::Swf::Rgba.new(bytearray[offset..-1]) else @color = SwfRuby::Swf::Rgb.new(bytearray[offset..-1]) end offset += @color.length @length = offset self end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
8 9 10 |
# File 'lib/swf_ruby/swf/gradrecord.rb', line 8 def color @color end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
9 10 11 |
# File 'lib/swf_ruby/swf/gradrecord.rb', line 9 def length @length end |
#ratio ⇒ Object
Returns the value of attribute ratio.
7 8 9 |
# File 'lib/swf_ruby/swf/gradrecord.rb', line 7 def ratio @ratio end |
#shape_version ⇒ Object
Returns the value of attribute shape_version.
6 7 8 |
# File 'lib/swf_ruby/swf/gradrecord.rb', line 6 def shape_version @shape_version end |