makepad_font/
outline_point.rs

1use makepad_geometry::{Point, Transform, Transformation};
2
3/// A point in an outline.
4///
5/// An outline point is either on the curve or off the curve. If it is on the curve, it represents
6/// an endpoint of a quadratic b-spline curve segment. Otherwise, it represents a control point of
7/// a quadratic b-spline curve segment. Each quadratic b-spline curve segment has two endpoints and
8/// zero or more control points.
9#[derive(Clone, Copy, Debug, PartialEq)]
10pub struct OutlinePoint {
11    pub is_on_curve: bool,
12    pub point: Point,
13}
14
15impl Transform for OutlinePoint {
16    fn transform<T>(self, t: &T) -> OutlinePoint
17    where
18        T: Transformation,
19    {
20        OutlinePoint {
21            is_on_curve: self.is_on_curve,
22            point: self.point.transform(t),
23        }
24    }
25
26    fn transform_mut<T>(&mut self, t: &T)
27    where
28        T: Transformation,
29    {
30        *self = self.transform(t)
31    }
32}