Sha256: de585760ed10c89255ced5e05a2e05e5c72f2e5f1100864780ecac2a82725ef3

Contents?: true

Size: 873 Bytes

Versions: 4

Compression:

Stored size: 873 Bytes

Contents

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

    # Parse ColorProperties object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [ColorProperties] result of parsing
    def parse(node)
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'alpha'
          @alpha = (node_child.attribute('val').value.to_f / 1_000.0).round
        when 'lumMod'
          @luminance_modulation = node_child.attribute('val').value.to_f / 100_000.0
        when 'lumOff'
          @luminance_offset = node_child.attribute('val').value.to_f / 100_000.0
        when 'tint'
          @tint = node_child.attribute('val').value.to_f / 100_000.0
        end
      end
      self
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ooxml_parser-0.4.1 lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb
ooxml_parser-0.4.0 lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb
ooxml_parser-0.3.0 lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb
ooxml_parser-0.2.0 lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb