Namespace fabric
Defined in: parser.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
fabric.getCSSRules(doc)
Returns CSS rules for a given SVG document
|
| <static> |
fabric.getGradientDefs(doc)
Parses an SVG document, returning all of the gradient declarations found in it
|
| <static> |
fabric.log(Values)
Wrapper around `console.log` (when available)
|
| <static> |
fabric.parseAttributes(element, attributes)
Returns an object of attributes' name/value, given element and an array of attribute names;
Parses parent "g" nodes recursively upwards.
|
| <static> |
fabric.parseElements(elements, callback, options)
Transforms an array of svg elements to corresponding fabric.
|
| <static> |
fabric.parsePointsAttribute(points)
Parses "points" attribute, returning an array of values
|
| <static> |
fabric.parseStyleAttribute(element)
Parses "style" attribute, retuning an object with values
|
| <static> |
fabric.parseSVGDocument(doc, callback)
Parses an SVG document, converts it to an array of corresponding fabric.
|
| <static> |
fabric.parseTransformAttribute(attributeValue)
Parses "transform" attribute, returning an array of values
|
| <static> |
fabric.warn(Values)
Wrapper around `console.warn` (when available)
|
Method Detail
<static>
{Object}
fabric.getCSSRules(doc)
Returns CSS rules for a given SVG document
- Parameters:
- {SVGDocument} doc
- SVG document to parse
- Returns:
- {Object} CSS rules of this document
<static>
{Object}
fabric.getGradientDefs(doc)
Parses an SVG document, returning all of the gradient declarations found in it
Defined in: gradient.js.
Defined in: gradient.js.
- Parameters:
- {SVGDocument} doc
- SVG document to parse
- Returns:
- {Object} Gradient definitions; key corresponds to element id, value -- to gradient definition element
<static>
fabric.log(Values)
Wrapper around `console.log` (when available)
Defined in: fabric.js.
Defined in: fabric.js.
- Parameters:
- {Any} Values
- to log
<static>
{Object}
fabric.parseAttributes(element, attributes)
Returns an object of attributes' name/value, given element and an array of attribute names;
Parses parent "g" nodes recursively upwards.
- Parameters:
- {DOMElement} element
- Element to parse
- {Array} attributes
- Array of attributes to parse
- Returns:
- {Object} object containing parsed attributes' names/values
<static>
fabric.parseElements(elements, callback, options)
Transforms an array of svg elements to corresponding fabric.* instances
- Parameters:
- {Array} elements
- Array of elements to parse
- {Function} callback
- Being passed an array of fabric instances (transformed from SVG elements)
- {Object} options
- Options object
<static>
{Array}
fabric.parsePointsAttribute(points)
Parses "points" attribute, returning an array of values
- Parameters:
- points
- {String} points attribute string
- Returns:
- {Array} array of points
<static>
{Object}
fabric.parseStyleAttribute(element)
Parses "style" attribute, retuning an object with values
- Parameters:
- {SVGElement} element
- Element to parse
- Returns:
- {Object} Objects with values parsed from style attribute of an element
<static>
fabric.parseSVGDocument(doc, callback)
Parses an SVG document, converts it to an array of corresponding fabric.* instances and passes them to a callback
- Parameters:
- {SVGDocument} doc
- SVG document to parse
- {Function} callback
- Callback to call when parsing is finished; It's being passed an array of elements (parsed from a document).
<static>
{Array}
fabric.parseTransformAttribute(attributeValue)
Parses "transform" attribute, returning an array of values
- Parameters:
- attributeValue
- {String} string containing attribute value
- Returns:
- {Array} array of 6 elements representing transformation matrix
<static>
fabric.warn(Values)
Wrapper around `console.warn` (when available)
Defined in: fabric.js.
Defined in: fabric.js.
- Parameters:
- {Any} Values
- to log as a warning