DVUI

svgToTvg

Takes in svg bytes and returns a tvg bytes that can be used with icon or iconTexture

Only valid between Window.beginand Window.end.

Parameters

#
allocator:std.mem.Allocator
std.mem.Allocator
svg_bytes:[]const u8
[]const u8

Source

Implementation

#
pub fn svgToTvg(allocator: std.mem.Allocator, svg_bytes: []const u8) (std.mem.Allocator.Error || TvgError)![]const u8 {
    if (comptime !useTvg) {
        comptime unreachable;
    }
    return tvg.tvg_from_svg(allocator, svg_bytes, .{}) catch |err| switch (err) {
        error.OutOfMemory => |e| return e,
        else => {
            log.debug("svgToTvg returned {any}", .{err});
            return TvgError.tvgError;
        },
    };
}