PIXI.SVGResource
class SVGResource extends PIXI.BaseImageResource
Resource type for SVG elements and graphics.
Constructor
new PIXI.SVGResource(sourceBase64: string, options: object) → {}
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
| sourceBase64 | string |
Base64 encoded SVG element or URL for SVG file. |
||
| options | object |
<optional> |
Options to use |
|
| options.scale | number |
<optional> |
1 |
Scale to apply to SVG. Overridden by... |
| options.width | number |
<optional> |
Rasterize SVG this wide. Aspect ratio preserved if height not specified. |
|
| options.height | number |
<optional> |
Rasterize SVG this high. Aspect ratio preserved if width not specified. |
|
| options.autoLoad | boolean |
<optional> |
true |
Start loading right away. |
Summary
Properties from SVGResource
|
|
|
|
|
|
| number |
A height override for rasterization on load. |
| number |
A width override for rasterization on load. |
| number |
The source scale to apply when rasterizing on load. |
| string |
Base64 encoded SVG element or URL for SVG file. |
Methods from SVGResource
| ISize |
|
| boolean |
|
| void |
Destroys this texture. |
Properties inherited from BaseImageResource
| HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | SVGElement |
|
Properties inherited from Resource
| boolean |
|
| number |
|
| boolean |
|
| string |
The url of the resource |
| boolean |
|
| number |
|
| number |
Internal height of the resource. |
| number |
Internal width of the resource. |
Methods inherited from BaseImageResource
| void |
|
| boolean |
|
Methods inherited from Resource
| void |
|
| void |
|
| void |
|
| boolean |
|
| void |
|
| Promise<PIXI.Resource> |
|
Public Properties
static SVG_SIZE = undefined
Regular expression for SVG size.
<svg width="100" height="100"></svg>
static SVG_XML = undefined
Regular expression for SVG XML document.
<?xml version="1.0" encoding="utf-8" ?><!-- image/svg --><svg
_overrideHeight: number
A height override for rasterization on load.
Public Methods
static getSize(svgString: string) → {ISize}
Get size from an svg string using a regular expression.
| Name | Type | Attributes | Description |
|---|---|---|---|
| svgString | string |
<optional> |
a serialized svg element |
| Type | Description |
|---|---|
| ISize |
|
static test(source: unknown, extension: string) → {boolean}
Used to auto-detect the type of resource.
| Name | Type | Attributes | Description |
|---|---|---|---|
| source | unknown |
The source object |
|
| extension | string |
<optional> |
The extension of source, if set |
| Type | Description |
|---|---|
| boolean |
|