Sha256: 4e4396e5643eb57c479a3c20dbc49f436bdf215a681da05e0a03f70ac92bdb94

Contents?: true

Size: 729 Bytes

Versions: 3

Compression:

Stored size: 729 Bytes

Contents

module Prawn::SVG::Attributes::ClipPath
  def parse_clip_path_attribute_and_call
    return unless clip_path = attributes['clip-path']

    if (matches = clip_path.strip.match(/\Aurl\(#(.*)\)\z/)).nil?
      document.warnings << "Only clip-path attributes with the form 'url(#xxx)' are supported"
    elsif (clip_path_element = @document.elements_by_id[matches[1]]).nil?
      document.warnings << "clip-path ID '#{matches[1]}' not defined"
    elsif clip_path_element.source.name != "clipPath"
      document.warnings << "clip-path ID '#{matches[1]}' does not point to a clipPath tag"
    else
      add_call_and_enter 'save_graphics_state'
      add_calls_from_element clip_path_element
      add_call "clip"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prawn-svg-0.23.1 lib/prawn/svg/attributes/clip_path.rb
prawn-svg-0.23.0 lib/prawn/svg/attributes/clip_path.rb
prawn-svg-0.22.1 lib/prawn/svg/attributes/clip_path.rb