Preview #
About #
GraffitiSVG provides an API for rendering SVG to Xojo Picture objects.
Requirements #
Requirements #
- This class requires a DesktopHTMLViewer be present on a view (DesktopWindow or DesktopContainer) in your project for Windows support.
Enumerations #
This class exposes no enumerations.
Constants #
This class exposes no constants.
Events #
This class exposes no events.
Methods #
This class exposes no methods.
Shared Methods #
Name | Parameters | Return Type | Description |
---|---|---|---|
Initialize | callback as InitializedCallback = nil | None | Initializes the control and calls the InitializedCallback delegate when ready. Required in the App.Opening Event Handler. |
Render | data as String width as Integer = 1000 height as Integer = 1000 | Picture | Renders and returns an image for the SVG data specified by the parameters. |
Delegates #
Name | Parameters | Return Type | Description |
---|---|---|---|
InitializedCallback | None | None | Delegate used with the Initialize method to signal the class is ready. |
Properties #
This class exposes no properties.
Examples #
Initializing #
GraffitiSVG must be initialized before use. The following can be added to the App.Opening event:
GraffitiSVG.Initialize
Due to the asynchronous nature of the class, you may wish to initialize then cache returned icons. Note that icon is a property of the class where you wish to use GraffitiSVG, and renderIcon is the name of the delegate method.
Private Sub renderIcon()
icon = GraffitiFontAwesome.Render( GraffitiFontAwesome.IconTypes.Solid, "search", &cFFFFFF, me.Width, me.Height )
self.Refresh
End Sub
Sub Opening Handles Opening
GraffitiSVG.Initialize( AddressOf renderIcon )
End Sub
Caching, however, is not required, and once the class is initialized then you may use it as though it were a normal synchronous class by simply calling the delegate method to refresh the icon or calling the Render method directly from within Paint events.