lib/prawn/svg/parser.rb
#
# Parse the SVG data and return a call tree.  The returned +Array+ is in the format:
#
#   [
#     ['prawn_method_name', ['argument1', 'argument2'], []],
#     ['method_that_takes_a_block', ['argument1', 'argument2'], [
#       ['method_called_inside_block', ['argument'], []]
#     ]
#   ]
#
Parse the SVG data and return a call tree.
Parse the SVG data and return a call tree .
def parse
    @document.warnings.clear
    calls = [['fill_color', '000000', []]]
    calls << [
      'transformation_matrix',
      [@document.sizing.x_scale, 0, 0, @document.sizing.y_scale, 0, 0],
      []
    ]
    calls << [
      'transformation_matrix',
      [1, 0, 0, 1, @document.sizing.x_offset, @document.sizing.y_offset],
      []
    ]
    root_element = Prawn::Svg::Element.new(@document, @document.root, calls, :ids => {}, :fill => true)
    parse_element(root_element)
    calls
  end
def parse @document . warnings . clear calls = [ [ 'fill_color' , '000000' , [ ] ] ] calls << [ 'transformation_matrix' , [ @document . sizing . x_scale , 0 , 0 , @document . sizing . y_scale , 0 , 0 ] , [ ] ] calls << [ 'transformation_matrix' , [ 1 , 0 , 0 , 1 , @document . sizing . x_offset , @document . sizing . y_offset ] , [ ] ] root_element = Prawn :: Svg :: Element . new ( @document , @document . root , calls , :ids => { } , :fill => true ) parse_element ( root_element ) calls end
Parse the SVG data and return a call tree.
Parse the SVG data and return a call tree .