pub struct Point<PD: PointData> {
pub x: f32,
pub y: f32,
pub a: Handle,
pub b: Handle,
pub name: Option<String>,
pub ptype: PointType,
pub smooth: bool,
pub data: Option<PD>,
}Expand description
A Skia-friendly point
Fields§
§x: f32§y: f32§a: Handle§b: Handle§name: Option<String>§ptype: PointType§smooth: bool§data: Option<PD>Implementations§
Source§impl<PD: PointData> Point<PD>
impl<PD: PointData> Point<PD>
pub fn new() -> Point<PD>
Sourcepub fn from_x_y_type((x, y): (f32, f32), ptype: PointType) -> Point<PD>
pub fn from_x_y_type((x, y): (f32, f32), ptype: PointType) -> Point<PD>
Make a point from its x and y position and type
Sourcepub fn from_x_y_a_b_type(
(x, y): (f32, f32),
(a, b): (Handle, Handle),
ptype: PointType,
) -> Point<PD>
pub fn from_x_y_a_b_type( (x, y): (f32, f32), (a, b): (Handle, Handle), ptype: PointType, ) -> Point<PD>
Make a point from its x and y position, handles and type
Sourcepub fn from_fields(
(x, y): (f32, f32),
(a, b): (Handle, Handle),
smooth: bool,
ptype: PointType,
name: Option<String>,
data: Option<PD>,
) -> Point<PD>
pub fn from_fields( (x, y): (f32, f32), (a, b): (Handle, Handle), smooth: bool, ptype: PointType, name: Option<String>, data: Option<PD>, ) -> Point<PD>
Make a point from its x and y position, handles and type
pub fn handle(&self, which: WhichHandle) -> Handle
Sourcepub fn handle_or_colocated(
&self,
which: WhichHandle,
transform_x: &dyn Fn(f32) -> f32,
transform_y: &dyn Fn(f32) -> f32,
) -> (f32, f32)
pub fn handle_or_colocated( &self, which: WhichHandle, transform_x: &dyn Fn(f32) -> f32, transform_y: &dyn Fn(f32) -> f32, ) -> (f32, f32)
Return an x, y position for a point, or one of its handles. If called with WhichHandle::Neither, return position for point.
pub fn handle_as_gpoint(&self, which: WhichHandle) -> GlifPoint
pub fn handle_as_point(&self, which: WhichHandle) -> Self
pub fn handle_as_kpoint(&self, which: WhichHandle) -> KurboPoint
Sourcepub fn set_handle(&mut self, which: WhichHandle, handle: Handle)
pub fn set_handle(&mut self, which: WhichHandle, handle: Handle)
This function is intended for use by generic functions that can work on either handle, to
decrease the use of macros like move_mirror!(a, b).
Trait Implementations§
Source§impl<PD: PointData> ApplyMatrix for Point<PD>
impl<PD: PointData> ApplyMatrix for Point<PD>
fn apply_matrix(&mut self, matrix: Affine)
Source§impl<'de, PD> Deserialize<'de> for Point<PD>
impl<'de, PD> Deserialize<'de> for Point<PD>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<PD: PointData> IsValid for Point<PD>
impl<PD: PointData> IsValid for Point<PD>
Source§fn is_valid(&self) -> bool
fn is_valid(&self) -> bool
validate_data parameter allows you to define an is_valid (or whatever) impl on your
PointData struct’s. You can then pass the function while validating the point as e.g.
Some(MyPointData::is_valid). It takes an Option<&PD> so that you have the choice as to
whether it’s valid or not for your type not to be defined; Point.data should probably not
be defined as an Option
fn expect_valid(&self)
Source§impl<PD: PointData> MFEKPointCommon<PD> for Point<PD>
impl<PD: PointData> MFEKPointCommon<PD> for Point<PD>
fn has_handle(&self, _handle: WhichHandle) -> bool
fn get_handle(&self, handle: WhichHandle) -> Option<Handle>
fn get_handle_position(&self, handle: WhichHandle) -> Option<(f32, f32)>
fn set_handle_position(&mut self, handle: WhichHandle, x: f32, y: f32)
fn set_handle(&mut self, wh: WhichHandle, handle: Handle)
fn get_position(&self) -> (f32, f32)
fn set_position(&mut self, x: f32, y: f32)
fn set_position_no_handles(&mut self, x: f32, y: f32)
fn x(&self) -> f32
fn y(&self) -> f32
fn get_name(&self) -> Option<String>
fn set_name(&mut self, name: String)
fn cubic(&self) -> Option<&Point<PD>>
fn quad(&self) -> Option<&QPoint<PD>>
fn hyper(&self) -> Option<&HyperPoint<PD>>
fn colocate_handle(&mut self, wh: WhichHandle)
Source§impl<PD: PointData> PointLike for Point<PD>
impl<PD: PointData> PointLike for Point<PD>
fn x(&self) -> IntegerOrFloat
fn y(&self) -> IntegerOrFloat
fn set_x(&mut self, x: IntegerOrFloat)
fn set_y(&mut self, y: IntegerOrFloat)
fn x32(&self) -> f32
fn y32(&self) -> f32
fn x64(&self) -> f64
fn y64(&self) -> f64
fn as_kpoint(&self) -> KurboPoint
Source§impl<PD: PointData> RoundToInt for Point<PD>
impl<PD: PointData> RoundToInt for Point<PD>
fn round_to_int(&mut self)
impl<PD: PointData> StructuralPartialEq for Point<PD>
Auto Trait Implementations§
impl<PD> Freeze for Point<PD>where
PD: Freeze,
impl<PD> RefUnwindSafe for Point<PD>where
PD: RefUnwindSafe,
impl<PD> Send for Point<PD>where
PD: Send,
impl<PD> Sync for Point<PD>where
PD: Sync,
impl<PD> Unpin for Point<PD>where
PD: Unpin,
impl<PD> UnwindSafe for Point<PD>where
PD: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more