Sha256: bb8ce10b7feb8628b3c3cf4bb934b55ac4d950bb9c3773d1cb828740f9f60297

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 Bytes

Contents

# Class for color transformations
module OoxmlParser
  class ColorProperties
    attr_accessor :alpha, :luminance_modulation, :luminance_offset

    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ooxml_parser-0.1.2 lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb
ooxml_parser-0.1.1 lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb