DgsCreateSVG: Difference between revisions
Jump to navigation
Jump to search
Fernando187 (talk | contribs) (Remove obsolete Requirements section) |
|||
(10 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Client function}} | |||
__NOTOC__ | |||
Creates an svg from size (blank document), filepath or raw data , similar to [[svgCreate]]. | Creates an svg from size (blank document), filepath or raw data , similar to [[svgCreate]]. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
svg dgsCreateSVG ( int width, int height [, string pathORrawData ] ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
Line 12: | Line 14: | ||
===Returns=== | ===Returns=== | ||
* Returns an [[svg]] if created successfully, ''false'' otherwise. | * Returns an [[svg]] if created successfully, ''false'' otherwise. | ||
==Example== | ==Example== | ||
<section name="Client" class="client" show="true"> | <section name="Client" class="client" show="true"> | ||
Line 17: | Line 20: | ||
loadstring(exports.dgs:dgsImportFunction())() -- load dgs functions using loadstring. | loadstring(exports.dgs:dgsImportFunction())() -- load dgs functions using loadstring. | ||
local svg = dgsCreateSVG(500,500) -- Create the SVG . | |||
local svgDoc = dgsSVGGetDocument(svg) -- Get the SVG Document so you can modify it . | |||
local rect = dgsSVGCreateNode(svgDoc,"rect",50,50,50,50) -- Create SVG node with rect type. | |||
dgsSVGNodeSetAttributes(rect,{ -- Change the node attributes value . | |||
["stroke"] = {255,255,0}, | |||
["stroke-width"] = "5px", | |||
["fill"] = "rgb(255,0,0)", | |||
}) | |||
local theImage = dgsCreateImage(200,200,500,500,svg,false) --Render the SVG by dgsCreateImage | |||
</syntaxhighlight></section> | </syntaxhighlight></section> | ||
== | ==See Also== | ||
{{ | {{DGS Plugin/SVG}} | ||
== | ===<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">General Functions</span>=== | ||
{{ | {{DGS General Functions}} |
Latest revision as of 17:31, 7 November 2024
Creates an svg from size (blank document), filepath or raw data , similar to svgCreate.
Syntax
svg dgsCreateSVG ( int width, int height [, string pathORrawData ] )
Required Arguments
- width: Desired width, preferably power of two (16, 32, 64 etc.), maximum is 4096
- height : Desired height, preferably power of two (16, 32, 64 etc.), maximum is 4096
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- pathOrRawData: A string representing the path to your SVG file, or the raw SVG data
Returns
- Returns an svg if created successfully, false otherwise.
Example
Click to collapse [-]
Clientloadstring(exports.dgs:dgsImportFunction())() -- load dgs functions using loadstring. local svg = dgsCreateSVG(500,500) -- Create the SVG . local svgDoc = dgsSVGGetDocument(svg) -- Get the SVG Document so you can modify it . local rect = dgsSVGCreateNode(svgDoc,"rect",50,50,50,50) -- Create SVG node with rect type. dgsSVGNodeSetAttributes(rect,{ -- Change the node attributes value . ["stroke"] = {255,255,0}, ["stroke-width"] = "5px", ["fill"] = "rgb(255,0,0)", }) local theImage = dgsCreateImage(200,200,500,500,svg,false) --Render the SVG by dgsCreateImage
See Also
- dgsCreateSVG
- dgsSVGGetRawDocument
- dgsSVGGetDocument
- dgsSVGCreateNode
- dgsSVGDestroyNode
- dgsSVGNodeSetAttribute
- dgsSVGNodeGetAttribute
- dgsSVGNodeSetAttributes
- dgsSVGNodeGetAttributes
General Functions
- dgsGetPosition
- dgsSetPosition
- dgsSetParent
- dgsGetParent
- dgsGetChild
- dgsGetChildren
- dgsGetSize
- dgsSetSize
- dgsGetType
- dgsSetLayer
- dgsGetLayer
- dgsSetCurrentLayerIndex
- dgsGetCurrentLayerIndex
- dgsGetLayerElements
- dgsGetProperty
- dgsSetProperty
- dgsSetPropertyInherit
- dgsGetProperties
- dgsSetProperties
- dgsGetVisible
- dgsSetVisible
- dgsGetEnabled
- dgsSetEnabled
- dgsGetPositionAlignment
- dgsSetPositionAlignment
- dgsGetAlpha
- dgsSetAlpha
- dgsGetFont
- dgsSetFont
- dgsGetText
- dgsSetText
- dgsGetPostGUI
- dgsSetPostGUI
- dgsGetInputEnabled
- dgsSetInputEnabled
- dgsGetInputMode
- dgsSetInputMode
- dgsAttachToAutoDestroy
- dgsDetachFromAutoDestroy
- dgsFocus
- dgsBlur
- dgsCreateFont
- dgsBringToFront
- dgsMoveToBack
- dgsGetScreenSize
- dgsGetCursorPosition
- dgsGetMouseEnterGUI
- dgsGetMouseLeaveGUI
- dgsIsMouseWithinGUI
- dgsSetSystemFont
- dgsGetSystemFont
- dgsGetElementsInLayer
- dgsGetElementsFromResource
- dgsGetFocusedGUI
- dgsImportFunction
- dgsImportOOPClass
- dgsG2DLoadHooker
- dgsSetRenderSetting
- dgsGetRenderSetting
- dgsSimulateClick
- dgsGetRootElement
- dgsAddMoveHandler
- dgsRemoveMoveHandler
- dgsIsMoveHandled
- dgsAddSizeHandler
- dgsRemoveSizeHandler
- dgsIsSizeHandled
- dgsAttachElements
- dgsDetachElements
- dgsElementIsAttached
- dgsAddPropertyListener
- dgsRemovePropertyListener
- dgsGetListenedProperties
- dgsSetMultiClickInterval
- dgsGetMultiClickInterval
- dgsSetMouseStayDelay
- dgsGetMouseStayDelay
- dgsCenterElement
- dgsSetElementKeeperEnabled
- dgsGetElementKeeperEnabled
- dgsSetClickingSound
- dgsGetClickingSound
- dgsSetClickingSoundVolume
- dgsGetClickingSoundVolume