Skip to content

Vector Graphics

Vector graphics methods provide additional drawing features such as Bézier curves, rounded rectangles, SVG paths, and stars.

Method
drawBezierCurve(displayId : DisplayID, pointsObj : table, r : number, g : number, b : number, segmentsObj : number) : ()
drawRoundedRect(displayId : DisplayID, x : number, y : number, w : number, h : number, radius : number, r : number, g : number, b : number, filled : boolean) : ()
drawSVGPath(displayId : DisplayID, pathData : string, x : number, y : number, scale : number, r : number, g : number, b : number) : ()
drawStar(displayId : DisplayID, cx : number, cy : number, points : number, outerRadius : number, innerRadius : number, r : number, g : number, b : number, filled : boolean) : ()

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

gpu.drawBezierCurve(
displayId,
{
{10, 80},
{40, 10},
{90, 10},
{120, 80}
},
255,
255,
255,
50
)

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.

gpu.drawRoundedRect(
displayId,
10,
10,
100,
40,
8,
0,
200,
255,
true
)

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:

  • DisplayID
  • pathData : string
  • x : number
  • y : number
  • scale : number
  • r : number
  • g : number
  • b : number
gpu.drawSVGPath(
displayId,
"M 0 0 L 10 0 L 10 10 Z",
50,
50,
4,
255,
255,
255
)

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.

gpu.drawStar(
displayId,
80,
80,
5,
30,
15,
255,
255,
0,
true
)