def from_lineset(cls, lineset, filepath, res_y, split_at_invisible, use_stroke_color, frame_current, *, name=""): """Builds a SVGPathShader using data from the given lineset""" name = name or lineset.name linestyle = lineset.linestyle # extract style attributes from the linestyle and scene svg = getCurrentScene().svg_export style = { 'fill': 'none', 'stroke-width': linestyle.thickness, 'stroke-linecap': linestyle.caps.lower(), 'stroke-opacity': linestyle.alpha, 'stroke': format_rgb(linestyle.color), 'stroke-linejoin': svg.line_join_type.lower(), } # get dashed line pattern (if specified) if linestyle.use_dashed_line: style['stroke-dasharray'] = ",".join( str(elem) for elem in get_dashed_pattern(linestyle)) # return instance return cls(name, style, filepath, res_y, split_at_invisible, use_stroke_color, frame_current)
def from_lineset(cls, lineset, filepath, res_y, split_at_invisible, frame_current, *, name=""): """Builds a SVGPathShader using data from the given lineset""" name = name or lineset.name linestyle = lineset.linestyle # extract style attributes from the linestyle and scene svg = getCurrentScene().svg_export style = { 'fill': 'none', 'stroke-width': linestyle.thickness, 'stroke-linecap': linestyle.caps.lower(), 'stroke-opacity': linestyle.alpha, 'stroke': 'rgb({}, {}, {})'.format(*(int(c * 255) for c in linestyle.color)), 'stroke-linejoin': svg.line_join_type.lower(), } # get dashed line pattern (if specified) if linestyle.use_dashed_line: style['stroke-dasharray'] = ",".join(str(elem) for elem in get_dashed_pattern(linestyle)) # return instance return cls(name, style, filepath, res_y, split_at_invisible, frame_current)