Pixel-Composer/scripts/svg_reader/svg_reader.gml

12 lines
388 B
Text
Raw Normal View History

2024-06-06 09:54:13 +02:00
function svg_parse(xmlStr) {
if(!is_struct(xmlStr)) return noone;
if(!struct_has(xmlStr, "children")) return noone;
if(struct_try_get(xmlStr, "type") != "root") return noone;
if(array_empty(xmlStr.children)) return noone;
2024-06-06 09:54:13 +02:00
var svg_object = xmlStr.children[0];
if(struct_try_get(svg_object, "type") != "svg") return noone;
return new SVG().setContent(svg_object);
2024-06-06 09:54:13 +02:00
}