DgsCreateSVG: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 18: | Line 18: | ||
local svg = dgsCreateSVG(500,500) -- Create the SVG . | local svg = dgsCreateSVG(500,500) -- Create the SVG . | ||
local svgDoc = | local svgDoc = dgsSVGGetDocument(svg) -- Get the SVG Document so you can modify it . | ||
local rect = | local rect = dgsSVGCreateNode(svgDoc,"rect",50,50,50,50) -- Create SVG node with rect shape. | ||
dgsSVGNodeSetAttributes(rect,{ -- Change the rect shape attributes value . | |||
["stroke"] = {255,255,0}, | ["stroke"] = {255,255,0}, | ||
["stroke-width"] = "5px", | ["stroke-width"] = "5px", |
Revision as of 18:11, 25 February 2022
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 shape. dgsSVGNodeSetAttributes(rect,{ -- Change the rect shape attributes value . ["stroke"] = {255,255,0}, ["stroke-width"] = "5px", ["fill"] = "rgb(255,0,0)", }
Requirements
This template will be deleted.