func createElement()

in Cyborg/VectorDrawableParser.swift [527:553]


    func createElement(in viewportSize: CGSize) -> Result<GroupChild> {
        let gradient: VectorDrawable.Gradient?
        if let first = children.first,
            let definiteGradient = first.createElement(in: viewportSize) {
            gradient = definiteGradient
        } else {
            gradient = nil
        }
        if let commands = commands {
            return .ok(VectorDrawable.Path(name: pathName,
                                           fillColor: fillColor,
                                           fillAlpha: fillAlpha,
                                           data: Array(commands.joined()),
                                           strokeColor: strokeColor,
                                           strokeWidth: strokeWidth,
                                           strokeAlpha: strokeAlpha,
                                           trimPathStart: trimPathStart,
                                           trimPathEnd: trimPathEnd,
                                           trimPathOffset: trimPathOffset,
                                           strokeLineCap: strokeLineCap,
                                           strokeLineJoin: strokeLineJoin,
                                           fillType: fillType,
                                           gradient: gradient))
        } else {
            return .error("\(PathProperty.pathData.rawValue) is a required property of <\(PathParser.name.rawValue)>.")
        }
    }