pub fn close_path(curve: &BezPath) -> BezPath {
	let mut new = BezPath::new();
	let mut path_closed_flag = true;
	for el in curve.iter() {
		match el {
			PathEl::MoveTo(p) => {
				if !path_closed_flag {
					new.push(PathEl::ClosePath);
				}
				new.push(PathEl::MoveTo(p));
				path_closed_flag = false;
			}
			PathEl::ClosePath => {
				path_closed_flag = true;
				new.push(PathEl::ClosePath);
			}
			element => {
				new.push(element);
			}
		}
	}
	if !path_closed_flag {
		new.push(PathEl::ClosePath);
	}
	new
}
/// Close off all sub-paths in curve by inserting a `ClosePath` whenever a `MoveTo` is not preceded by one.
Close off all sub-paths in curve by inserting a `ClosePath` whenever a `MoveTo` is not preceded by one.
Close off all sub - paths in curve by inserting a ` ClosePath ` whenever a ` MoveTo ` is not preceded by one .
pub fn close_path(curve: &BezPath) -> BezPath {
	let mut new = BezPath::new();
	let mut path_closed_flag = true;
	for el in curve.iter() {
		match el {
			PathEl::MoveTo(p) => {
				if !path_closed_flag {
					new.push(PathEl::ClosePath);
				}
				new.push(PathEl::MoveTo(p));
				path_closed_flag = false;
			}
			PathEl::ClosePath => {
				path_closed_flag = true;
				new.push(PathEl::ClosePath);
			}
			element => {
				new.push(element);
			}
		}
	}
	if !path_closed_flag {
		new.push(PathEl::ClosePath);
	}
	new
}
pub fn close_path ( curve : & BezPath ) -> BezPath { let mut new = BezPath :: new ( ) ; let mut path_closed_flag = true ; for el in curve . iter ( ) { match el { PathEl :: MoveTo ( p ) => { if ! path_closed_flag { new . push ( PathEl :: ClosePath ) ; } new . push ( PathEl :: MoveTo ( p ) ) ; path_closed_flag = false ; } PathEl :: ClosePath => { path_closed_flag = true ; new . push ( PathEl :: ClosePath ) ; } element => { new . push ( element ) ; } } } if ! path_closed_flag { new . push ( PathEl :: ClosePath ) ; } new }
Close off all sub-paths in curve by inserting a `ClosePath` whenever a `MoveTo` is not preceded by one.
Close off all sub - paths in curve by inserting a ` ClosePath ` whenever a ` MoveTo ` is not preceded by one .
curve
&BezPath
curve
&BezPath