shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$svg$buildSVGDefinitions = function(global, require, module, exports) { function buildColorStops(colorStops) { return colorStops.map(stop => { const hex = Color.Color.shared.setValue(stop.color).toHex(); return ``; }).join(""); } var Color = require("module$node_modules$pixi_DOT_js$lib$color$Color"), FillGradient = require("module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$fill$FillGradient"); "use strict"; class SVGDefsCollector { constructor() { this._gradients = []; this._nextId = 0; } addStyle(style) { if (!(style.fill instanceof FillGradient.FillGradient)) { return null; } const id = `pixi-grad-${this._nextId++}`; this._gradients.push({id, gradient:style.fill, textureSpace:style.textureSpace ?? "local"}); return `url(#${id})`; } build() { if (0 === this._gradients.length) { return ""; } const parts = ["\x3cdefs\x3e"]; for (const {id, gradient, textureSpace} of this._gradients) { const gradientUnits = "global" === textureSpace ? "userSpaceOnUse" : "objectBoundingBox", stops = buildColorStops(gradient.colorStops); if ("radial" === gradient.type) { const cx = gradient.outerCenter?.x ?? 0.5, cy = gradient.outerCenter?.y ?? 0.5; parts.push(``, stops, "\x3c/radialGradient\x3e"); } else { parts.push(``, stops, "\x3c/linearGradient\x3e"); } } parts.push("\x3c/defs\x3e"); return parts.join(""); } } exports.SVGDefsCollector = SVGDefsCollector; }; //# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$graphics$shared$svg$buildSVGDefinitions.js.map