Sha256: c3280278f50aa5ab613bf98e97e0232b34ef592b6f5c83147b3b79cbaa43c304

Contents?: true

Size: 1017 Bytes

Versions: 9

Compression:

Stored size: 1017 Bytes

Contents

# frozen_string_literal: true

require_relative 'tile'
module OoxmlParser
  # Class for working with Image Fill
  class ImageFill < OOXMLDocumentObject
    attr_accessor :stretch, :tile, :properties
    # @return [FileReference] image structure
    attr_accessor :file_reference

    def initialize(parent: nil)
      @path = ''
      super
    end

    # Parse ImageFill object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [ImageFill] result of parsing
    def parse(node)
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'blip'
          @file_reference = FileReference.new(parent: self).parse(node_child)
        when 'tile'
          @tile = Tile.new(OOXMLCoordinates.new(parent: self).parse(node_child, x_attr: 'tx', y_attr: 'ty'),
                           OOXMLCoordinates.new(parent: self).parse(node_child, x_attr: 'sx', y_attr: 'sy'),
                           parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ooxml_parser-0.38.0 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.37.1 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.37.0 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.36.1 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.36.0 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.35.0 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.34.2 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.34.1 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb
ooxml_parser-0.34.0 lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb