Sprite |
ImportSVG |
SVG XML import parser creating a list of svg shape objects. AS3 rewrite of drawsvg_mm.as which was based on drawsvg.as.
| ImportSVG | SVG XML import parser creating a list of svg shape objects. |
| Public properties | |
| shapes | Array of ShapeSVG objects. |
| Public methods | |
| parseSVG | Parses an SVG XML text into the shapes array. |
| generateCode | Generates and returns an AS3 method that returns a Sprite representing the imported SVG path definitions. |
| numPoints | Returns the number of line segment points in all defined shapes. |
| Private methods | |
| findPathNode | Recursively looks at XML objects to find PATH nodes. |
| parseFill | Parses a SVG fill attribute. |
| parseStroke | Parses a SVG stroke line style. |
| defineShape | Reads a SVG path node. |
| createShapeDef | Creates and returns a ShapeSVG object from the d attribute of the SVG PATH tag given in the cmds array. |
public var shapes: Array
Array of ShapeSVG objects.
private function findPathNode( node: XMLNode, defaultFill: Object, defaultStroke: Object ):void
Recursively looks at XML objects to find PATH nodes. When one is found, it calls defineShape to parse the PATH node and calls createShapeDef to create a ShapeSVG object which is pushed onto the shapes array.
private function defineShape( node: XMLNode, defaultFill: Object, defaultStroke: Object ):void
Reads a SVG path node.
Then calls createShapeDef to create a ShapeSVG object
private function createShapeDef( cmds: Array, rotation: int, fill: Object, stroke: Object ):ShapeSVG
Creates and returns a ShapeSVG object from the d attribute of the SVG PATH tag given in the cmds array.
Array of ShapeSVG objects.
public var shapes: Array
Parses an SVG XML text into the shapes array.
public function parseSVG( srcXML: String, parseTolerance: int ):int
Generates and returns an AS3 method that returns a Sprite representing the imported SVG path definitions.
public function generateCode():String
Returns the number of line segment points in all defined shapes.
public function get numPoints():int
Recursively looks at XML objects to find PATH nodes.
private function findPathNode( node: XMLNode, defaultFill: Object, defaultStroke: Object ):void
Parses a SVG fill attribute.
private function parseFill( attributes: Object, defaultFill: Object ):Object
Parses a SVG stroke line style.
private function parseStroke( attributes: Object, defaultStroke: Object ):Object
Reads a SVG path node.
private function defineShape( node: XMLNode, defaultFill: Object, defaultStroke: Object ):void
Creates and returns a ShapeSVG object from the d attribute of the SVG PATH tag given in the cmds array.
private function createShapeDef( cmds: Array, rotation: int, fill: Object, stroke: Object ):ShapeSVG