pub struct Subpath {
pub points: Vec<(f32, f32)>,
pub closed: bool,
/* private fields */
}Expand description
One subpath decomposed into on-curve points and segments.
Fields§
§points: Vec<(f32, f32)>On-curve points: the start, each segment endpoint, and (when closed) a repeat of the start.
closed: boolTrue when the subpath ended with an explicit Close.
Implementations§
Source§impl Subpath
impl Subpath
Sourcepub fn segment_count(&self) -> usize
pub fn segment_count(&self) -> usize
Number of drawing segments.
Sourcepub fn segments(&self) -> Vec<FlatSegment>
pub fn segments(&self) -> Vec<FlatSegment>
The drawing segments, in order, as (kind, c1, c2, to) with kind:
1 line, 2 quad, 3 cubic. Control slots are (0.0, 0.0) when unused.
use font_model::{Path, Winding};
// A square: four line segments, no controls.
let mut p = Path::starting_at(0.0, 0.0);
p.line_to(1.0, 0.0);
p.line_to(1.0, 1.0);
p.line_to(0.0, 1.0);
p.close();
let subs = p.subpaths();
assert_eq!(subs.len(), 1);
assert_eq!(subs[0].segment_count(), 3);Sourcepub fn signed_area(&self) -> f32
pub fn signed_area(&self) -> f32
Signed area: each segment’s exact analytic contribution plus the closing line when the subpath is open but has drawn segments.
Trait Implementations§
impl StructuralPartialEq for Subpath
Auto Trait Implementations§
impl Freeze for Subpath
impl RefUnwindSafe for Subpath
impl Send for Subpath
impl Sync for Subpath
impl Unpin for Subpath
impl UnsafeUnpin for Subpath
impl UnwindSafe for Subpath
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more