Libraries.Data.Formats.ScalableVectorGraphics.ScalableVectorGraphics Documentation

The ScalableVectorGraphics class is a ScalableVectorGraphicsObject that defines a coordinate system and viewport for which other elements can be added to. For an SVG file this class defines the outermost element but the SVG standard allows for another SVG to be embedded into an SVG document.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

    // make an svg with a circle
    ScalableVectorGraphics canvas
    canvas:SetSize(100,100)

    Circle circle
    circle:SetPosition(50, 50)
    circle:SetRadius(20)
    circle:SetFill("green")

    canvas:Add(circle)

    output canvas:ToText()

Inherits from: Libraries.Language.Object, Libraries.Data.Formats.ScalableVectorGraphics.ScalableVectorGraphicsObject

Summary

Actions Summary Table

ActionsDescription
Add(Libraries.Web.Page.Division div)This action adds a div block to the bottom of the ScalableVectorGraphics.
Add(Libraries.Web.Page.Script script)This action adds a script block to the bottom of the ScalableVectorGraphics.
Add(Libraries.Data.Formats.ScalableVectorGraphics.ScalableVectorGraphicsObject object)This action adds other ScalableVectorGraphicsObjects as children to this object.
Add(Libraries.Web.Page.Style style)This action adds a style block to the bottom of the ScalableVectorGraphics.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
ConvertReservedCharacters(text value)This action returns a new string that automatically converts any characters that are reserved in the HTML specification before placing them into the vector graphic.
Empty()This action removes all of the children, scripts and styles that have been added.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetAriaDescribedBy()This action will give a aria-describedby attribute to the SVG element.
GetAriaDescription()This action will give a aria-description attribute to the SVG element.
GetAriaHidden()This action will give a aria-hidden attribute to the SVG element.
GetAriaLabel()This action will give a aria-label attribute to the SVG element.
GetAriaLabelledBy()This action will give a aria-labelledby attribute to the SVG element.
GetAriaRoleDescription()This action will give a aria-roledescription attribute to the SVG element.
GetCloseTag(text name, boolean container)This is an interal action that allows the ScalableVectorGraphicsObject generate the correct closing tag.
GetColor()This action returns the color of the object.
GetDescription()This action will return the currently set description to a ScalableVectorGraphicsObject.
GetFill()This action returns the fill of the object.
GetFillOpacity()This action returns the fill opacity of the object.
GetHashCode()This action gets the hash code for an object.
GetHeight()This action returns the height of the viewport.
GetID()This action returns the id of the object.
GetOnBlur()This action will give a blur event handler attribute to the SVG element.
GetOnFocus()This action will give a focus event handler attribute to the SVG element.
GetPositionX()This action returns the x position of the viewport in the document.
GetPositionY()This action returns the y position of the viewport in the document.
GetRole()This action will give a role attribute to the SVG element.
GetStroke()This action returns the stroke of the object.
GetStrokeOpacity()This action returns the stroke opacity of the object.
GetStrokeWidth()This action returns the stroke width of the object.
GetStyle()This action returns the style information of the object.
GetStyleClass()This action will give a class attribute to the SVG element.
GetTabIndex()This action returns the tab index of the object.
GetTitle()This action will return the currently set title of the object.
GetWidth()This action returns the width of the viewport.
GlobalAttributesToText()This is an interal action that allows the ScalableVectorGraphicsObject to write out its global attributes.
IsContainer()This action is used internally by the system to designate whether the SVG element is a single tag or contains more objects within it.
IsOneLine()This action is used internally by the system to designate whether the SVG element should print with new lines.
IsTopLevel()This action will return whether or not the current object is set to be the top level element.
SetAriaDescribedBy(text ariaDescribedBy)This action will give a aria-describedby attribute to the SVG element.
SetAriaDescription(text ariaDescription)This action will give a aria-description attribute to the SVG element.
SetAriaHidden(text ariaHidden)This action will give a aria-hidden attribute to the SVG element.
SetAriaLabel(text ariaLabel)This action will give a aria-label attribute to the SVG element.
SetAriaLabelledBy(text ariaLabelledBy)This action will give a aria-labelledby attribute to the SVG element.
SetAriaRoleDescription(text ariaRoleDescription)This action will give a aria-roledescription attribute to the SVG element.
SetColor(text color)This action will give a color attribute to the SVG element.
SetDescription(text description)This action will give a description to a ScalableVectorGraphicsObject.
SetFill(Libraries.Game.Graphics.Color fill)This action will give a fill attribute to the SVG element.
SetFill(text fill)This action will give a fill attribute to the SVG element.
SetFillOpacity(text opacity)This action will give a fill attribute to the SVG element.
SetFillOpacity(number opacity)This action will give a fill attribute to the SVG element.
SetFillOpacity(Libraries.Game.Graphics.Color opacity)This action will give a fill attribute to the SVG element.
SetHeight(integer height)This action sets the height of the ScalableVectorGraphics.
SetID(text id)This action will give an ID attribute to the SVG element.
SetIsContainer(boolean isContainer)This action is used internally by the system to designate whether the SVG element is a single tag or contains more objects within it.
SetIsOneLine(boolean isOneLine)This action is used internally by the system to designate whether the SVG element should print with new lines.
SetIsTopLevel(boolean isTopLevel)This action sets whether or not this instance of ScalableVectorGraphics is outermost element of the SVG file.
SetOnBlur(text onBlur)This action will give a blur event handler attribute to the SVG element.
SetOnFocus(text onFocus)This action will give a focus event handler attribute to the SVG element.
SetPosition(integer x, integer y)This action sets the position of the ScalableVectorGraphics in the document.
SetPositionX(integer x)This action sets the x position of the ScalableVectorGraphics in the document.
SetPositionY(integer y)This action sets the y position of the ScalableVectorGraphics in the document.
SetRole(text role)This action will give a role attribute to the SVG element.
SetSize(integer width, integer height)This action sets the width and height of the ScalableVectorGraphics.
SetStroke(text stroke)This action will give a stroke attribute to the SVG element.
SetStroke(Libraries.Game.Graphics.Color stroke)This action will give a stroke attribute to the SVG element.
SetStrokeOpacity(number opacity)This action will give a stroke opacity attribute to the SVG element.
SetStrokeOpacity(text opacity)This action will give a stroke opacity attribute to the SVG element.
SetStrokeOpacity(Libraries.Game.Graphics.Color opacity)This action will give a stroke opacity attribute to the SVG element.
SetStrokeWidth(number strokeWidth)This action sets the width of the stroke of the SVG element.
SetStrokeWidth(number strokeWidth, text unit)This action sets the width of the stroke of the SVG element along with which unit to use.
SetStyle(text style)This action will give a style attribute to the SVG element.
SetStyleClass(text styleClass)This action will give a class attribute to the SVG element.
SetTabIndex(integer tabIndex)This action will give the ScalableVectorGraphicsObject a tab index.
SetTitle(text title)This action will give a title to a ScalableVectorGraphicsObject.
SetViewBox(integer minX, integer minY, integer width, integer height)This action sets the view box of the ScalableVectorGraphics.
SetWidth(integer width)This action sets the width of the ScalableVectorGraphics.
ToText()This action takes all of the ScalableVectorGraphicsObjects added to this object and writes out all of the necessary tags and attributes to a string and returns that string.
Write(Libraries.System.File file)This action takes all of the ScalableVectorGraphicsObjects added to this object and writes out all of the necessary tags and attributes line by line to the given file.

Actions Documentation

Add(Libraries.Web.Page.Division div)

This action adds a div block to the bottom of the ScalableVectorGraphics.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all
        use Libraries.Web.Page.Division

        ScalableVectorGraphics canvas
        Division div
        div:SetIdentifier("my-div")
        div:SetClassAttribute("wrapper-div")
        canvas:Add(div)

Parameters

Add(Libraries.Web.Page.Script script)

This action adds a script block to the bottom of the ScalableVectorGraphics.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all
        use Libraries.Web.Page.Script

        ScalableVectorGraphics canvas
        Script script
        script:SetCode("//insert javascript here")
        canvas:Add(script)

Parameters

Add(Libraries.Data.Formats.ScalableVectorGraphics.ScalableVectorGraphicsObject object)

This action adds other ScalableVectorGraphicsObjects as children to this object. When ScalableVectorGraphics is written out it will also write out all of the content of its children. To add other elements such as shapes and text to an SVG document this action must be used. Note that the order at which objects are drawn on the document corresponds to the order they were added using this action.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        Circle circle
        canvas:Add(circle)

Parameters

Add(Libraries.Web.Page.Style style)

This action adds a style block to the bottom of the ScalableVectorGraphics.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all
        use Libraries.Web.Page.Style

        ScalableVectorGraphics canvas
        Style style
        style:SetType("text/css")
        style:SetDescription("h1 {color:blue;}")
        canvas:Add(style)

Parameters

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

ConvertReservedCharacters(text value)

This action returns a new string that automatically converts any characters that are reserved in the HTML specification before placing them into the vector graphic. This prevents the graphic from not compiling in circumstances where a DataFrame created a graphic that used a reserved character.

Parameters

Return

text: A new text value with converted reserved characters.

Empty()

This action removes all of the children, scripts and styles that have been added.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        Circle circle
        canvas:Add(circle)

        canvas:Empty()

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetAriaDescribedBy()

This action will give a aria-describedby attribute to the SVG element. This aria-describedby can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetAriaDescribedBy("This is a blue circle with a radius of 5.0")

Return

text:

GetAriaDescription()

This action will give a aria-description attribute to the SVG element. This aria-description can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetAriaDescription("This is a blue circle with a radius of 5.0")

Return

text:

GetAriaHidden()

This action will give a aria-hidden attribute to the SVG element. This aria-hideen can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetAriaHidden("true")

Return

text:

GetAriaLabel()

This action will give a aria-label attribute to the SVG element. This aria-label can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetAriaLabel("My Circle")

Return

text:

GetAriaLabelledBy()

This action will give a aria-labelledby attribute to the SVG element. This aria-labelledby can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetAriaLabelledBy("id")

Return

text:

GetAriaRoleDescription()

This action will give a aria-roledescription attribute to the SVG element. This aria-roledescription can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetAriaRoleDescription("This is a blue circle with a radius of 5.0")

Return

text:

GetCloseTag(text name, boolean container)

This is an interal action that allows the ScalableVectorGraphicsObject generate the correct closing tag.

Parameters

Return

text:

GetColor()

This action returns the color of the object.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetColor("navy")
        output circle:GetColor()

Return

text: the color of the object.

GetDescription()

This action will return the currently set description to a ScalableVectorGraphicsObject.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetDescription("This is my circle and it will be blue")
        text myDescpription = circle:GetDescription()

Return

text: The current text description of the object.

GetFill()

This action returns the fill of the object.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetFill("navy")
        output circle:GetFill()

Return

text: the fill of the object.

GetFillOpacity()

This action returns the fill opacity of the object.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetFill("navy")
        circle:SetFillOpacity(0.7)
        output circle:GetFillOpacity()

Return

text: the fill opacity of the object.

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetHeight()

This action returns the height of the viewport.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        output canvas:GetHeight()

Return

integer: the height of the viewport.

GetID()

This action returns the id of the object.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetID("My Circle")
        output circle:GetID()

Return

text: the id of the object.

GetOnBlur()

This action will give a blur event handler attribute to the SVG element. This blur can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Group group
        group:SetOnBlur("console.log('hello world');")

Return

text:

GetOnFocus()

This action will give a focus event handler attribute to the SVG element. This focus can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Group group
        group:SetOnFocus("console.log('hello world');")

Return

text:

GetPositionX()

This action returns the x position of the viewport in the document.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        output canvas:GetPositionX()

Return

integer: the x position of the viewport.

GetPositionY()

This action returns the y position of the viewport in the document.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        output canvas:GetPositionY()

Return

integer: the y position of the viewport.

GetRole()

This action will give a role attribute to the SVG element. This role can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetRole("region")

Return

text:

GetStroke()

This action returns the stroke of the object.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetStroke("navy")
        output circle:GetStroke()

Return

text: the stroke of the object.

GetStrokeOpacity()

This action returns the stroke opacity of the object.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetStroke("navy")
        circle:SetStrokeOpacity(0.7)
        output circle:GetStrokeOpacity()

Return

text: the stroke opacity of the object.

GetStrokeWidth()

This action returns the stroke width of the object. Since lengths can have varying units in SVG the unit will be appended to the returned length

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetStrokeWidth(5, "%")
        text strokeWidth = circle:GetStrokeWidth()

Return

text: the stroke width with the unit appended if one was given.

GetStyle()

This action returns the style information of the object.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetStyle("fill: skyblue; stroke: navy;")
        output circle:GetStyle()

Return

text: the style information of the object.

GetStyleClass()

This action will give a class attribute to the SVG element. This class can be for gerneral use by a web browser or for when using a styling sheet on the SVG file.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetStyleClass("circleClass")

Return

text:

GetTabIndex()

This action returns the tab index of the object.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetTabIndex(5)
        output circle:GetTabIndex()

Return

integer: the tab index of the object.

GetTitle()

This action will return the currently set title of the object.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetTitle("My Circle")
        text myTitle = circle:GetTitle()

Return

text: The current title of the object.

GetWidth()

This action returns the width of the viewport.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        output canvas:GetWidth()

Return

integer: the width of the viewport.

GlobalAttributesToText()

This is an interal action that allows the ScalableVectorGraphicsObject to write out its global attributes.

Return

text:

IsContainer()

This action is used internally by the system to designate whether the SVG element is a single tag or contains more objects within it.

Return

boolean:

IsOneLine()

This action is used internally by the system to designate whether the SVG element should print with new lines.

Return

boolean:

IsTopLevel()

This action will return whether or not the current object is set to be the top level element.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        canvas:SetIsTopLevel(false)

Return

boolean: true if this ScalableVectorGraphics is set to be top level, false otherwise.

SetAriaDescribedBy(text ariaDescribedBy)

This action will give a aria-describedby attribute to the SVG element. This aria-describedby can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetAriaDescribedBy("This is a blue circle with a radius of 5.0")

Parameters

SetAriaDescription(text ariaDescription)

This action will give a aria-description attribute to the SVG element. This aria-description can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetAriaDescription("This is a blue circle with a radius of 5.0")

Parameters

SetAriaHidden(text ariaHidden)

This action will give a aria-hidden attribute to the SVG element. This aria-hideen can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetAriaHidden("true")

Parameters

SetAriaLabel(text ariaLabel)

This action will give a aria-label attribute to the SVG element. This aria-label can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetAriaLabel("My Circle")

Parameters

SetAriaLabelledBy(text ariaLabelledBy)

This action will give a aria-labelledby attribute to the SVG element. This aria-labelledby can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetAriaLabelledBy("id")

Parameters

SetAriaRoleDescription(text ariaRoleDescription)

This action will give a aria-roledescription attribute to the SVG element. This aria-roledescription can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetAriaRoleDescription("This is a blue circle with a radius of 5.0")

Parameters

SetColor(text color)

This action will give a color attribute to the SVG element. This attribute does not directly change an objects color. It provides a color for other attriubtes, such as fill and stroke that may not have a defined color, to inherit a color.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetColor("green")

Parameters

SetDescription(text description)

This action will give a description to a ScalableVectorGraphicsObject. When an object has a non-empty description a description tag will be generated when the whole object is written out. A description in SVG functions similarly to the description of an image in HTML.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetDescription("This is my circle and it will be blue")

Parameters

SetFill(Libraries.Game.Graphics.Color fill)

This action will give a fill attribute to the SVG element. This attribute may do different things depending on the type of SVG element. For shapes and text it will define the color used to paint the object

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        use Libraries.Game.Graphics.Color

        Color blue
        blue:SetColor(0, 0, 1, 1)

        Circle circle
        circle:SetFill(blue)

Parameters

SetFill(text fill)

This action will give a fill attribute to the SVG element. This attribute may do different things depending on the type of SVG element. For shapes and text it will define the color used to paint the object

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetFill("green")

Parameters

SetFillOpacity(text opacity)

This action will give a fill attribute to the SVG element. This attribute may do different things depending on the type of SVG element. For shapes and text it will define the color opaqueness used to paint the object

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetFill("green")
        circle:SetFillOpacity("50%") // alternate: circle:SetFillOpacity("0.5")

Parameters

SetFillOpacity(number opacity)

This action will give a fill attribute to the SVG element. This attribute may do different things depending on the type of SVG element. For shapes and text it will define the color opaqueness used to paint the object

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        use Libraries.Game.Graphics.Color

        Color blue
        blue:SetColor(0, 0, 1, 1)

        Circle circle
        circle:SetFill(blue)
        circle:SetFillOpacity(0.7)

Parameters

SetFillOpacity(Libraries.Game.Graphics.Color opacity)

This action will give a fill attribute to the SVG element. This attribute may do different things depending on the type of SVG element. For shapes and text it will define the color opaqueness used to paint the object

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        use Libraries.Game.Graphics.Color

        Color blue
        blue:SetColor(0, 0, 1, 1)

        Circle circle
        circle:SetFill(blue)
        circle:SetFillOpacity(blue) // alternate: circle:SetFillOpacity("1")

Parameters

SetHeight(integer height)

This action sets the height of the ScalableVectorGraphics. This width and height affects the size of viewport of the SVG. ScalableVectorGraphics defines a coordinate system so elements that would be outside of this viewport are not visible.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        canvas:SetHeight(500)

Parameters

SetID(text id)

This action will give an ID attribute to the SVG element. This is useful in contexts where you need to reference an SVG element by a name such as when using a styling sheet with the SVG file.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetID("circle1")

Parameters

SetIsContainer(boolean isContainer)

This action is used internally by the system to designate whether the SVG element is a single tag or contains more objects within it.

Parameters

SetIsOneLine(boolean isOneLine)

This action is used internally by the system to designate whether the SVG element should print with new lines.

Parameters

SetIsTopLevel(boolean isTopLevel)

This action sets whether or not this instance of ScalableVectorGraphics is outermost element of the SVG file. Setting this to false opens up the ability add the position attributes.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics innerCanvas
        innerCanvas:SetIsTopLevel(false)

Parameters

SetOnBlur(text onBlur)

This action will give a blur event handler attribute to the SVG element. This blur can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Group group
        group:SetOnBlur("console.log('hello world');")

Parameters

SetOnFocus(text onFocus)

This action will give a focus event handler attribute to the SVG element. This focus can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Group group
        group:SetOnFocus("console.log('hello world');")

Parameters

SetPosition(integer x, integer y)

This action sets the position of the ScalableVectorGraphics in the document. This has no effect if ScalableVectorGraphics is the top level element. Note that the x and y define the top left corner of the element in SVG.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        canvas:SetPosition(50,50)

Parameters

SetPositionX(integer x)

This action sets the x position of the ScalableVectorGraphics in the document. This has no effect if ScalableVectorGraphics is the top level element. Note that the x and y define the top left corner of the element in SVG.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        canvas:SetPositionX(50)

Parameters

SetPositionY(integer y)

This action sets the y position of the ScalableVectorGraphics in the document. This has no effect if ScalableVectorGraphics is the top level element. Note that the x and y define the top left corner of the element in SVG.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        canvas:SetPositionY(50)

Parameters

SetRole(text role)

This action will give a role attribute to the SVG element. This role can be for general use by a web browser.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetRole("region")

Parameters

SetSize(integer width, integer height)

This action sets the width and height of the ScalableVectorGraphics. This width and height affects the size of viewport of the SVG. ScalableVectorGraphics defines a coordinate system so elements that would be outside of this viewport are not visible.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        canvas:SetSize(500,500)

Parameters

SetStroke(text stroke)

This action will give a stroke attribute to the SVG element. This attribute defines the color used to paint the outline of a shape. For shapes like lines that have no fill a stroke must be set so that the line will be visible.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetStroke("navy")

Parameters

SetStroke(Libraries.Game.Graphics.Color stroke)

This action will give a stroke attribute to the SVG element. This attribute defines the color used to paint the outline of a shape. For shapes like lines that have no fill a stroke must be set so that the line will be visible.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all
        
        use Libraries.Game.Graphics.Color

        Color blue
        blue:SetColor(0, 0, 1, 1)

        Circle circle
        circle:SetStroke(blue)

Parameters

SetStrokeOpacity(number opacity)

This action will give a stroke opacity attribute to the SVG element. This attribute may do different things depending on the type of SVG element. For shapes and text it will define the color opaqueness used to paint the border of the object

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        use Libraries.Game.Graphics.Color

        Color blue
        blue:SetColor(0, 0, 1, 1)

        Circle circle
        circle:SetStroke(blue)
        circle:SetStrokeOpacity(0.7)

Parameters

SetStrokeOpacity(text opacity)

This action will give a stroke opacity attribute to the SVG element. This attribute may do different things depending on the type of SVG element. For shapes and text it will define the color opaqueness used to paint the border of the object

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetStroke("green")
        circle:SetStrokeOpacity("50%") // alternate: circle:SetStrokeOpacity("0.5")

Parameters

SetStrokeOpacity(Libraries.Game.Graphics.Color opacity)

This action will give a stroke opacity attribute to the SVG element. This attribute may do different things depending on the type of SVG element. For shapes and text it will define the color opaqueness used to paint the border of the object

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        use Libraries.Game.Graphics.Color

        Color blue
        blue:SetColor(0, 0, 1, 1)

        Circle circle
        circle:SetStroke(blue)
        circle:SetStrokeOpacity(blue) // alternate: circle:SetStrokeOpacity("1")

Parameters

SetStrokeWidth(number strokeWidth)

This action sets the width of the stroke of the SVG element. Shapes with an outline have a stroke width.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetStrokeWidth(5)

Parameters

SetStrokeWidth(number strokeWidth, text unit)

This action sets the width of the stroke of the SVG element along with which unit to use. Shapes with an outline have a stroke width. In SVG, units are defined by unit identifiers giving by the CSS specification along with percentages.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetStrokeWidth(5, "%")

Parameters

SetStyle(text style)

This action will give a style attribute to the SVG element. This attribute also for embedding CSS declarations inline with the SVG element. Use of this attribute requires knowledge of CSS.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetStyle("fill: skyblue; stroke: navy;")

Parameters

SetStyleClass(text styleClass)

This action will give a class attribute to the SVG element. This class can be for gerneral use by a web browser or for when using a styling sheet on the SVG file.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetStyleClass("circleClass")

Parameters

SetTabIndex(integer tabIndex)

This action will give the ScalableVectorGraphicsObject a tab index. A non-negative tab index attribute will allow the element to be focusable and it can define the relative order for sequential navigation with the tab key. If two objects have the same tab index then whichever was added first is first in the naviagation. Default is 0 which means the item is focusable.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle1
        Circle circle2
        Circle circle3
        circle1:SetTabIndex(1)
        circle2:SetTabIndex(2)
        circle3:SetTabIndex(3)

Parameters

SetTitle(text title)

This action will give a title to a ScalableVectorGraphicsObject. When an object has a non-empty title a title tag will be generated when the whole object is written out which will show the title as a popup box when hovering over the object in the final SVG file.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        Circle circle
        circle:SetTitle("My Circle")

Parameters

SetViewBox(integer minX, integer minY, integer width, integer height)

This action sets the view box of the ScalableVectorGraphics. ScalableVectorGraphics define a coordinate system and the view box defines the position and dimension of the user sapce fills the viewport. The four parameters define the rectangle in user space that is then bound to the viewport of this SVG element. Note that the x and y define the top left corner of the element in SVG.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        canvas:SetViewBox(0,0,1000,1000)

Parameters

SetWidth(integer width)

This action sets the width of the ScalableVectorGraphics. This width and height affects the size of viewport of the SVG. ScalableVectorGraphics defines a coordinate system so elements that would be outside of this viewport are not visible.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        canvas:SetWidth(500)

Parameters

ToText()

This action takes all of the ScalableVectorGraphicsObjects added to this object and writes out all of the necessary tags and attributes to a string and returns that string. That string can then be pushed to file

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all

        ScalableVectorGraphics canvas
        output canvas:ToText()

Return

text: the formatted string of all tags and objects in the SVG

Write(Libraries.System.File file)

This action takes all of the ScalableVectorGraphicsObjects added to this object and writes out all of the necessary tags and attributes line by line to the given file.

Example Code

Libraries.Data.Formats.ScalableVectorGraphics.all
        use Libraries.System.File
        
        File f
        f:SetPath("aFile.svg")
        ScalableVectorGraphics canvas
        canvas:Write(f)

Parameters