pub struct Shape { /* private fields */ }
Expand description
An msdfgen shape. Can be used to generate an SDF or Psuedo-SDF. Must be colored first using a coloring function to generate a MSDF or MTSDF.
Implementations§
Source§impl Shape
impl Shape
Sourcepub fn color_edges_simple(self, angle: f64) -> ColoredShape
pub fn color_edges_simple(self, angle: f64) -> ColoredShape
Assigns colors to edges of the shape in accordance to the multi-channel distance field
technique. May split some edges if necessary. angle
specifies the maximum angle (in
radians) to be considered a corner, for example 3 (~172 degrees). Values below 1/2 PI will
be treated as the external angle.
Sourcepub fn color_edges_ink_trap(self, angle: f64) -> ColoredShape
pub fn color_edges_ink_trap(self, angle: f64) -> ColoredShape
The alternative “ink trap” coloring strategy is designed for better results with typefaces that use ink traps as a design feature. It guarantees that even if all edges that are shorter than both their neighboring edges are removed, the coloring remains consistent with the established rules.
Sourcepub fn color_edges_by_distance(self, angle: f64) -> ColoredShape
pub fn color_edges_by_distance(self, angle: f64) -> ColoredShape
The alternative coloring by distance tries to use different colors for edges that are close together. This should theoretically be the best strategy on average. However, since it needs to compute the distance between all pairs of edges, and perform a graph optimization task, it is much slower than the rest.
Sourcepub fn generate_sdf(
&self,
width: u32,
height: u32,
range: f64,
projection: &Projection,
config: &SDFConfig,
) -> SDF
pub fn generate_sdf( &self, width: u32, height: u32, range: f64, projection: &Projection, config: &SDFConfig, ) -> SDF
Generates a conventional single-channel signed distance field.
Sourcepub fn generate_psuedo_sdf(
&self,
width: u32,
height: u32,
range: f64,
projection: &Projection,
config: &SDFConfig,
) -> SDF
pub fn generate_psuedo_sdf( &self, width: u32, height: u32, range: f64, projection: &Projection, config: &SDFConfig, ) -> SDF
Generates a single-channel signed pseudo-distance field.
Auto Trait Implementations§
impl Freeze for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnwindSafe for Shape
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> 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