Class: SwfRuby::Swf::Gradrecord

Inherits:
Object
  • Object
show all
Defined in:
lib/swf_ruby/swf/gradrecord.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#colorObject

Returns the value of attribute color.



8
9
10
# File 'lib/swf_ruby/swf/gradrecord.rb', line 8

def color
  @color
end

#lengthObject (readonly)

Returns the value of attribute length.



9
10
11
# File 'lib/swf_ruby/swf/gradrecord.rb', line 9

def length
  @length
end

#ratioObject

Returns the value of attribute ratio.



7
8
9
# File 'lib/swf_ruby/swf/gradrecord.rb', line 7

def ratio
  @ratio
end

#shape_versionObject

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