Beispiel #1
0
def stroke_to_curve(paths, stroke_style):
    if not stroke_style:
        return []
    width = stroke_style[1]
    dash_list = stroke_style[3]
    caps = stroke_style[4]
    joint = stroke_style[5]
    miter_limit = stroke_style[6]

    if dash_list:
        dashes = []
        for path in paths:
            dashes += dash_path(path, width, dash_list)
        paths = dashes

    new_paths = []
    for path in paths:
        outlines = []
        fw, bw = create_stroke_outline(path, width / 2.0, joint, caps,
                                       miter_limit)

        if path[-1] == sk2const.CURVE_CLOSED:
            outlines.append(make_path(fw))
            outlines.append(make_path(bw))
        else:
            outlines.append(make_path(fw + bw))
        new_paths.append(outlines)
    if len(new_paths) == 1:
        return new_paths[0]
    else:
        ret = new_paths[0]
        for item in new_paths[1:]:
            ret = fuse_paths(ret, item)
        return ret
Beispiel #2
0
def stroke_to_curve(paths, stroke_style):
#	print paths
	if not stroke_style: return []
	width = stroke_style[1]
	dash_list = stroke_style[3]
	caps = stroke_style[4]
	joint = stroke_style[5]
	miter_limit = stroke_style[6]

	if dash_list:
		dashes = []
		for path in paths:
			dashes += dash_path(path, width, dash_list)
		paths = dashes

	new_paths = []
	for path in paths:
		outlines = []
		fw, bw = create_stroke_outline(path, width / 2.0,
									joint, caps, miter_limit)

		if path[-1] == sk2_const.CURVE_CLOSED:
			outlines.append(make_path(fw))
			outlines.append(make_path(bw))
		else:
			outlines.append(make_path(fw + bw))
		new_paths.append(outlines)
	if len(new_paths) == 1:
		return new_paths[0]
	else:
		ret = new_paths[0]
		for item in new_paths[1:]:
			ret = fuse_paths(ret, item)
		return ret