core.svg.create_from_raw
Client
Creates a new SVG instance from a raw string
Syntax
local instance = core.svg.create_from_raw(
raw,
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 anANISOTROPICvariant. - Before compressing — if both mipmaps and compression are needed, pass
truehere;self:compresscannot generate mipmaps, so this is the only opportunity.
Parameters
| Type | Name | Description |
|---|---|---|
string | raw | Raw markup string |
bool | mipmaps | Determines whether to generate a mipmap chain for the underlying svg texture |
Returns
| Type | Name | Description |
|---|---|---|
svg | instance | Created SVG instance |
Examples
local entity = core.svg.create_from_raw([[
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="50"/>
</svg>
]])local entity = core.svg.create_from_raw([[
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<rect width="100" height="100" fill="red"/>
</svg>
]])
entity:update([[
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="50" fill="blue"/>
</svg>
]])