Sha256: 2c7e445293ac108705e0c7467781c9b8a984f5bb8471a77d3e479344ad5c00e2

Contents?: true

Size: 678 Bytes

Versions: 6

Compression:

Stored size: 678 Bytes

Contents

class Prawn::SVG::Elements::Root < Prawn::SVG::Elements::Base
  def initialize(document, source = document.root, parent_calls = [], state = ::Prawn::SVG::State.new)
    super
  end

  def parse
    state.viewport_sizing = @document.sizing
  end

  def apply
    if [nil, 'inherit', 'none', 'currentColor'].include?(properties.fill)
      add_call 'fill_color', Prawn::SVG::Color.default_color(@document.color_mode).value
    end

    add_call 'transformation_matrix', @document.sizing.x_scale, 0, 0, @document.sizing.y_scale, 0, 0
    add_call 'transformation_matrix', 1, 0, 0, 1, -@document.sizing.x_offset, @document.sizing.y_offset
  end

  def container?
    true
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
prawn-svg-0.35.1 lib/prawn/svg/elements/root.rb
prawn-svg-0.35.0 lib/prawn/svg/elements/root.rb
prawn-svg-0.34.2 lib/prawn/svg/elements/root.rb
prawn-svg-0.34.1 lib/prawn/svg/elements/root.rb
prawn-svg-0.34.0 lib/prawn/svg/elements/root.rb
prawn-svg-0.33.0 lib/prawn/svg/elements/root.rb