Class: SvgDocument::Path
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#vertices ⇒ Object
The bezier path object must have all its nodes turned “sharp”, or non-curve-handle-ish, or this parser will not work properly.
Methods inherited from Base
#game_class, #game_handle, #initialize, #visible?
Methods included from HasTranslation
Constructor Details
This class inherits a constructor from SvgDocument::Base
Instance Method Details
#vertices ⇒ Object
The bezier path object must have all its nodes turned “sharp”, or non-curve-handle-ish, or this parser will not work properly
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/gamebox/core/svg_document.rb', line 127 def vertices unless @verts @verts = [] data = @node.attributes['d'] scanner = StringScanner.new(data) pat = /[ML]\s+([-0-9.,]+)\s*/ hit = scanner.scan(pat) while hit x,y = scanner[1].split(/,/).map { |s| s.to_f } @verts << vec2(x,y) hit = scanner.scan(pat) end end @verts end |