core.svg.create

Client

Creates a new SVG instance from a file path


Syntax

local instance = core.svg.create(
    path,
    mipmaps = false
)

Only needed if you already know a mipmap-based filter is coming.

  • Use it when — the SVG is going to use NEAREST_MIPMAP, LINEAR_MIPMAP, or an ANISOTROPIC variant.
  • Before compressing — if both mipmaps and compression are needed, pass true here; self:compress cannot generate mipmaps, so this is the only opportunity.

Parameters

TypeNameDescription
stringpathFile path to the SVG asset
boolmipmapsDetermines whether to generate a mipmap chain for the underlying svg texture

Returns

TypeNameDescription
svginstanceCreated SVG instance

Examples

Create an SVG instance from a file
local entity = core.svg.create("assets/icon.svg")
Create an SVG with mipmaps for mipmap-based filtering
local entity = core.svg.create("assets/icon.svg", true)

entity:set_filter(core.svg.svg_filter.LINEAR_MIPMAP_ANISOTROPIC)

On this page