Skip to main content

Contour

Struct Contour 

Source
struct Contour<'a, C, D>
where C: PointCoord, D: PointCoord + From<C>,
{ points: &'a [Point<C>], flags: &'a [PointFlags], out_points: &'a mut [Point<D>], }
Expand description

One contour’s worth of points, as input coordinates and the moved coordinates being derived from them.

All three slices have the same length, so indices are interchangeable between them and are always in bounds.

Fields§

§points: &'a [Point<C>]§flags: &'a [PointFlags]§out_points: &'a mut [Point<D>]

Implementations§

Source§

impl<C, D> Contour<'_, C, D>
where C: PointCoord, D: PointCoord + From<C>,

Source

fn interpolate_untouched(&mut self)

Infers the deltas of every point in this contour that the current tuple did not reference.

Source

fn shift(&mut self, reference: usize)

Shifts the whole contour by the delta of its one referenced point.

Modeled after the FreeType implementation: https://github.com/freetype/freetype/blob/bbfcd79eacb4985d4b68783565f4b494aa64516b/src/truetype/ttgxvar.c#L3776

Source

fn interpolate(&mut self, range: Range<usize>, ref1: usize, ref2: usize)

Interpolates the unreferenced points in range between the referenced points at ref1 and ref2.

Modeled after the FreeType implementation: https://github.com/freetype/freetype/blob/bbfcd79eacb4985d4b68783565f4b494aa64516b/src/truetype/ttgxvar.c#L3813

For details on the algorithm, see: https://learn.microsoft.com/en-us/typography/opentype/spec/gvar#inferred-deltas-for-un-referenced-point-numbers

Auto Trait Implementations§

§

impl<'a, C, D> Freeze for Contour<'a, C, D>

§

impl<'a, C, D> RefUnwindSafe for Contour<'a, C, D>

§

impl<'a, C, D> Send for Contour<'a, C, D>
where C: Sync, D: Send,

§

impl<'a, C, D> Sync for Contour<'a, C, D>
where C: Sync, D: Sync,

§

impl<'a, C, D> Unpin for Contour<'a, C, D>

§

impl<'a, C, D> UnsafeUnpin for Contour<'a, C, D>

§

impl<'a, C, D> !UnwindSafe for Contour<'a, C, D>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.