canvg.js - Javascript SVG parser and renderer on Canvas
- License:
- MIT
- Source:
- See:
Methods
(static) canvg(target, s, optsopt) → {Promise.<(XMLDocument|Array.<XMLDocument>)>}
If called with no arguments, it will replace all <svg> elements on the page
with <canvas> elements.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
target |
HTMLCanvasElement | string | canvas element or the id of a canvas element |
|
s |
string | XMLDocument | svg string, url to svg file, or xml document |
|
opts |
module:canvg.CanvgOptions |
<optional> |
Optional hash of options |
- Source:
Returns:
All the function after the first render is completed with dom
- Type
- Promise.<(XMLDocument|Array.<XMLDocument>)>
(inner) build(opts) → {object}
Parameters:
| Name | Type | Description |
|---|---|---|
opts |
module:canvg.CanvgOptions |
- Source:
- To Do:
-
- Flesh out exactly what object is returned here (after updating to latest and reincluding our changes here and those of StackBlur)
Returns:
- Type
- object
(inner) isNullish(val) → {boolean}
Whether a value is null or undefined.
Parameters:
| Name | Type | Description |
|---|---|---|
val |
any |
- Source:
Returns:
- Type
- boolean
Type Definitions
CanvgOptions
Type:
Properties:
| Name | Type | Description |
|---|---|---|
opts.ignoreMouse |
boolean | true => ignore mouse events |
opts.ignoreAnimation |
boolean | true => ignore animations |
opts.ignoreDimensions |
boolean | true => does not try to resize canvas |
opts.ignoreClear |
boolean | true => does not clear canvas |
opts.offsetX |
Integer | int => draws at a x offset |
opts.offsetY |
Integer | int => draws at a y offset |
opts.scaleWidth |
Integer | int => scales horizontally to width |
opts.scaleHeight |
Integer | int => scales vertically to height |
opts.forceRedraw |
module:canvg.ForceRedraw | function => will call the function on every frame, if it returns true, will redraw |
opts.log |
boolean | Adds log function |
opts.useCORS |
boolean | Whether to set CORS |
- Source:
ForceRedraw() → {boolean}
- Source:
Returns:
- Type
- boolean