Class: SwfRuby::Swf::Fillstyle
- Inherits:
-
Object
- Object
- SwfRuby::Swf::Fillstyle
- Defined in:
- lib/swf_ruby/swf/fillstyle.rb
Instance Attribute Summary collapse
-
#bitmap_id ⇒ Object
Returns the value of attribute bitmap_id.
-
#bitmap_id_offset ⇒ Object
Returns the value of attribute bitmap_id_offset.
-
#bitmap_matrix ⇒ Object
Returns the value of attribute bitmap_matrix.
-
#color ⇒ Object
Returns the value of attribute color.
-
#fill_style_type ⇒ Object
Returns the value of attribute fill_style_type.
-
#gradient ⇒ Object
Returns the value of attribute gradient.
-
#gradient_matrix ⇒ Object
Returns the value of attribute gradient_matrix.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#shape_version ⇒ Object
Returns the value of attribute shape_version.
Instance Method Summary collapse
-
#initialize(bytearray, shape_version) ⇒ Fillstyle
constructor
A new instance of Fillstyle.
Constructor Details
#initialize(bytearray, shape_version) ⇒ Fillstyle
Returns a new instance of Fillstyle.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/swf_ruby/swf/fillstyle.rb', line 16 def initialize(bytearray, shape_version) @shape_version = shape_version @fill_style_type = bytearray[0, 1].unpack("C").first offset = 1 if @fill_style_type == 0x00 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 end if @fill_style_type == 0x10 or @fill_style_type == 0x12 or @fill_style_type == 0x13 @gradient_matrix = SwfRuby::Swf::Matrix.new(bytearray[offset..-1]) offset += @gradient_matrix.length end if @fill_style_type == 0x10 or @fill_style_type == 0x12 @gradient = SwfRuby::Swf::Gradient.new(bytearray[offset..-1], @shape_version) offset += @gradient.length elsif @fill_style_type == 0x13 @gradient = SwfRuby::Swf::Focalgradient.new(bytearray[offset..-1], @shape_version) offset += @gradient.length end if @fill_style_type == 0x40 or @fill_style_type == 0x41 or @fill_style_type == 0x42 or @fill_style_type == 0x43 @bitmap_id = bytearray[offset, 2].unpack("v").first @bitmap_id_offset = offset offset += 2 @bitmap_matrix = SwfRuby::Swf::Matrix.new(bytearray[offset..-1]) offset += @bitmap_matrix.length end @length = offset self end |
Instance Attribute Details
#bitmap_id ⇒ Object
Returns the value of attribute bitmap_id.
11 12 13 |
# File 'lib/swf_ruby/swf/fillstyle.rb', line 11 def bitmap_id @bitmap_id end |
#bitmap_id_offset ⇒ Object
Returns the value of attribute bitmap_id_offset.
12 13 14 |
# File 'lib/swf_ruby/swf/fillstyle.rb', line 12 def bitmap_id_offset @bitmap_id_offset end |
#bitmap_matrix ⇒ Object
Returns the value of attribute bitmap_matrix.
13 14 15 |
# File 'lib/swf_ruby/swf/fillstyle.rb', line 13 def bitmap_matrix @bitmap_matrix end |
#color ⇒ Object
Returns the value of attribute color.
8 9 10 |
# File 'lib/swf_ruby/swf/fillstyle.rb', line 8 def color @color end |
#fill_style_type ⇒ Object
Returns the value of attribute fill_style_type.
7 8 9 |
# File 'lib/swf_ruby/swf/fillstyle.rb', line 7 def fill_style_type @fill_style_type end |
#gradient ⇒ Object
Returns the value of attribute gradient.
10 11 12 |
# File 'lib/swf_ruby/swf/fillstyle.rb', line 10 def gradient @gradient end |
#gradient_matrix ⇒ Object
Returns the value of attribute gradient_matrix.
9 10 11 |
# File 'lib/swf_ruby/swf/fillstyle.rb', line 9 def gradient_matrix @gradient_matrix end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
14 15 16 |
# File 'lib/swf_ruby/swf/fillstyle.rb', line 14 def length @length end |
#shape_version ⇒ Object
Returns the value of attribute shape_version.
6 7 8 |
# File 'lib/swf_ruby/swf/fillstyle.rb', line 6 def shape_version @shape_version end |