SVG

public class
loom2d.display.SVG

Description

SVG vector image that can be loaded from a file or string. Draw with Graphics.drawSVG().

API overview

Constructor

SVG ()

Attributes

Public attributes

height: Number read-only

Get the height of the displayed SVG in pixels before any transformations

width: Number read-only

Get the width of the displayed SVG in pixels before any transformations

Functions

Public functions

fromFile ( path: String , units: String = px , dpi: Number = 96 ): SVG static

Load an SVG image asset from the file system and return it as an SVG object

fromString ( path: String , units: String = px , dpi: Number = 96 ): SVG static

Load an SVG layout from a string and return it as an SVG object

loadFile ( path: String , units: String = px , dpi: Number = 96 ): Void native

Load a file containing the SVG layout and replace the current SVG contents with it

loadString ( svg: String , units: String = px , dpi: Number = 96 ): Void native

Load an SVG layout from a string and replace the current SVG contents with it

Constructor

SVG ()

Attributes

height: Number

read-only

Get the height of the displayed SVG in pixels before any transformations.

width: Number

read-only

Get the width of the displayed SVG in pixels before any transformations.

Functions

fromFile ( path: String , units: String = px , dpi: Number = 96 ): SVG

static

Load an SVG image asset from the file system and return it as an SVG object. This is the static factory for convenient loading through the use of loadFile.

See also:
loadFile

The supported values are px, pt, pc, mm, cm, in, %, em, ex. Use px for direct interpretation. Use one of the other units along with dpi to scale the image accordingly.

Parameters

path: String The path of the SVG asset.
units: String = px The unit to interpret the values in.
dpi: Number = 96 Dots per inch of the SVG image. Used for proper scaling units other than `px`.


fromString ( path: String , units: String = px , dpi: Number = 96 ): SVG

static

Load an SVG layout from a string and return it as an SVG object. This is the static factory for convenient loading through the use of loadString. Use fromFile when loading a file asset to enable support for live reloading.

See also:
loadString
fromFile

The supported values are px, pt, pc, mm, cm, in, %, em, ex. Use px for direct interpretation. Use one of the other units along with dpi to scale the image accordingly.

Parameters

path: String The path of the SVG asset.
units: String = px The unit to interpret the values in.
dpi: Number = 96 Dots per inch of the SVG image. Used for proper scaling units other than `px`.


getFullTypeName (): String
Inherited from Object

native

Gets the fully qualified type name of the Object. The fully qualified type name includes the package of the type.


Returns

String fully qualified type name of the Object.

getType (): Type
Inherited from Object

native

Gets the Type that describes the Object.


Returns

Type The Type that describes the object.

getTypeName (): String
Inherited from Object

native

Gets the type name of the Object.


Returns

String type name of the Object.

loadFile ( path: String , units: String = px , dpi: Number = 96 ): Void

native

Load a file containing the SVG layout and replace the current SVG contents with it.

See also:
fromFile

The supported values are px, pt, pc, mm, cm, in, %, em, ex. Use px for direct interpretation. Use one of the other units along with dpi to scale the image accordingly.

Parameters

path: String The path of the SVG asset.
units: String = px The unit to interpret the values in.
dpi: Number = 96 Dots per inch of the SVG image. Used for proper scaling units other than `px`.


loadString ( svg: String , units: String = px , dpi: Number = 96 ): Void

native

Load an SVG layout from a string and replace the current SVG contents with it. Use loadFile when loading a file asset to enable support for live reloading.

See also:
fromString
loadFile

The supported values are px, pt, pc, mm, cm, in, %, em, ex. Use px for direct interpretation. Use one of the other units along with dpi to scale the image accordingly.

Parameters

svg: String
units: String = px The unit to interpret the values in.
dpi: Number = 96 Dots per inch of the SVG image. Used for proper scaling units other than `px`.


toString (): String
Inherited from Object

native

Returns a String that describes the Object. This can be overriden to provide extra details when printing objects using trace().


Returns

String String that described the Object.

: