pub struct ContourPoint {
pub x: f64,
pub y: f64,
pub typ: PointType,
pub smooth: bool,
pub name: Option<Name>,
/* private fields */
}Expand description
A single point in a Contour.
Fields§
§x: f64Contour point x coordinate value.
y: f64Contour point y coordinate value.
typ: PointTypeContour point type.
smooth: boolWhether a smooth curvature should be maintained at this point. Must not be set for off-curve points.
name: Option<Name>Optional contour point name.
Implementations§
Source§impl ContourPoint
impl ContourPoint
Sourcepub fn new(
x: f64,
y: f64,
typ: PointType,
smooth: bool,
name: Option<Name>,
identifier: Option<Identifier>,
) -> Self
pub fn new( x: f64, y: f64, typ: PointType, smooth: bool, name: Option<Name>, identifier: Option<Identifier>, ) -> Self
Returns a new ContourPoint given an x coordinate value,
y coordinate value, point type, and smooth definition.
Sourcepub fn lib_mut(&mut self) -> Option<&mut Plist>
pub fn lib_mut(&mut self) -> Option<&mut Plist>
Returns a mutable reference to the contour’s lib.
Sourcepub fn replace_lib(&mut self, lib: Plist) -> Option<Plist>
pub fn replace_lib(&mut self, lib: Plist) -> Option<Plist>
Replaces the actual lib by the lib given in parameter, returning the old lib if present. Sets a new UUID v4 identifier if none is set already.
Sourcepub fn take_lib(&mut self) -> Option<Plist>
pub fn take_lib(&mut self) -> Option<Plist>
Takes the lib out of the contour, leaving a None in its place.
Sourcepub fn identifier(&self) -> Option<&Identifier>
pub fn identifier(&self) -> Option<&Identifier>
Returns a reference to the contour’s identifier.
Sourcepub fn replace_identifier(&mut self, id: Identifier) -> Option<Identifier>
pub fn replace_identifier(&mut self, id: Identifier) -> Option<Identifier>
Replaces the actual identifier by the identifier given in parameter, returning the old identifier if present.
Sourcepub fn to_kurbo(&self) -> Point
pub fn to_kurbo(&self) -> Point
Returns a kurbo::Point with this ContourPoint’s coordinates.
Sourcepub fn transform(&mut self, transform: AffineTransform)
pub fn transform(&mut self, transform: AffineTransform)
Applies a transformation matrix to the point’s coordinates
Trait Implementations§
Source§impl Clone for ContourPoint
impl Clone for ContourPoint
Source§fn clone(&self) -> ContourPoint
fn clone(&self) -> ContourPoint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more