Class: SwfRuby::Swf::Gradient
- Inherits:
-
Object
- Object
- SwfRuby::Swf::Gradient
- Defined in:
- lib/swf_ruby/swf/gradient.rb
Instance Attribute Summary collapse
-
#gradient_records ⇒ Object
Returns the value of attribute gradient_records.
-
#interpolation_mode ⇒ Object
Returns the value of attribute interpolation_mode.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#num_gradients ⇒ Object
Returns the value of attribute num_gradients.
-
#shape_version ⇒ Object
Returns the value of attribute shape_version.
-
#spread_mode ⇒ Object
Returns the value of attribute spread_mode.
Instance Method Summary collapse
-
#initialize(bytearray, shape_version) ⇒ Gradient
constructor
A new instance of Gradient.
Constructor Details
#initialize(bytearray, shape_version) ⇒ Gradient
Returns a new instance of Gradient.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/swf_ruby/swf/gradient.rb', line 13 def initialize(bytearray, shape_version) @shape_version = shape_version bits_str = bytearray[0, 1].unpack("B").first @spread_mode = bits_str[0, 2].to_i(2) @interpolation_mode = bits_str[2, 2].to_i(2) @num_gradients = bits_str[4, 4].to_i(2) offset = 1 @gradient_records = [] @num_gradients.times do gradient_record = SwfRuby::Swf::Gradrecord.new(bytearray[offset..-1], @shape_version) @gradient_records << gradient_record offset += gradient_record.length end @length = offset self end |
Instance Attribute Details
#gradient_records ⇒ Object
Returns the value of attribute gradient_records.
10 11 12 |
# File 'lib/swf_ruby/swf/gradient.rb', line 10 def gradient_records @gradient_records end |
#interpolation_mode ⇒ Object
Returns the value of attribute interpolation_mode.
8 9 10 |
# File 'lib/swf_ruby/swf/gradient.rb', line 8 def interpolation_mode @interpolation_mode end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
11 12 13 |
# File 'lib/swf_ruby/swf/gradient.rb', line 11 def length @length end |
#num_gradients ⇒ Object
Returns the value of attribute num_gradients.
9 10 11 |
# File 'lib/swf_ruby/swf/gradient.rb', line 9 def num_gradients @num_gradients end |
#shape_version ⇒ Object
Returns the value of attribute shape_version.
6 7 8 |
# File 'lib/swf_ruby/swf/gradient.rb', line 6 def shape_version @shape_version end |
#spread_mode ⇒ Object
Returns the value of attribute spread_mode.
7 8 9 |
# File 'lib/swf_ruby/swf/gradient.rb', line 7 def spread_mode @spread_mode end |