Class: OoxmlParser::ColorProperties

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#alphaObject

Returns the value of attribute alpha.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb', line 4

def alpha
  @alpha
end

#luminance_modulationObject

Returns the value of attribute luminance_modulation.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb', line 4

def luminance_modulation
  @luminance_modulation
end

#luminance_offsetObject

Returns the value of attribute luminance_offset.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb', line 4

def luminance_offset
  @luminance_offset
end

Class Method Details

.parse(color_properties_node) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb', line 6

def self.parse(color_properties_node)
  properties = ColorProperties.new
  color_properties_node.xpath('*').each do |color_properties_node_child|
    case color_properties_node_child.name
    when 'alpha'
      properties.alpha = (color_properties_node_child.attribute('val').value.to_f / 1_000.0).round
    when 'lumMod'
      properties.luminance_modulation = color_properties_node_child.attribute('val').value.to_f / 100_000.0
    when 'lumOff'
      properties.luminance_offset = color_properties_node_child.attribute('val').value.to_f / 100_000.0
    end
  end
  properties
end