Vector Graphics
Vector graphics methods provide additional drawing features such as Bézier curves, rounded rectangles, SVG paths, and stars.
Methods
Section titled “Methods”drawBezierCurve
Section titled “drawBezierCurve”Draws a Bézier curve using a list of control points.
The pointsObj table should contain points in the following format:
{ {x1, y1}, {x2, y2}, {x3, y3}, {x4, y4}}segmentsObj controls curve smoothness. If omitted, DirectGPU uses a default segment count.
Requires: DisplayID, pointsObj : table, r : number, g : number, b : number
Example
Section titled “Example”gpu.drawBezierCurve( displayId, { {10, 80}, {40, 10}, {90, 10}, {120, 80} }, 255, 255, 255, 50)drawRoundedRect
Section titled “drawRoundedRect”Draws a rectangle with rounded corners.
Set filled to true to draw a filled rounded rectangle.
Requires: DisplayID, position, size, radius, color, and fill state.
Example
Section titled “Example”gpu.drawRoundedRect( displayId, 10, 10, 100, 40, 8, 0, 200, 255, true)drawSVGPath
Section titled “drawSVGPath”Draws a shape from SVG-style path data.
Useful for rendering icons and custom vector graphics.
Supported path commands depend on the SVG parser implementation.
Requires:
DisplayIDpathData : stringx : numbery : numberscale : numberr : numberg : numberb : number
Example
Section titled “Example”gpu.drawSVGPath( displayId, "M 0 0 L 10 0 L 10 10 Z", 50, 50, 4, 255, 255, 255)drawStar
Section titled “drawStar”Draws a star shape.
points controls the number of star points.
outerRadius controls the outside points, while innerRadius controls the inner edges.
Set filled to true to draw a solid star.
Example
Section titled “Example”gpu.drawStar( displayId, 80, 80, 5, 30, 15, 255, 255, 0, true)