pub trait SDFTrait {
type Image: GenericImage;
type ColoredOutput: GenericImage;
fn from_image(image: Self::Image, range: f64, mid_value: f32) -> Self;
fn to_image(self) -> Self::Image;
fn image(&self) -> &Self::Image;
fn range(&self) -> f64;
fn mid_value(&self) -> f32;
fn render(&self, width: u32, height: u32) -> GrayFImage;
fn render_colored(&self, width: u32, height: u32) -> Self::ColoredOutput;
}
Expand description
Trait for various types of SDFs. Can be converted to an image, or rendered with SDFTrait::render / SDFTrait::render_colored.
Required Associated Types
source
type Image: GenericImage
Required Methods
sourcefn from_image(image: Self::Image, range: f64, mid_value: f32) -> Self
fn from_image(image: Self::Image, range: f64, mid_value: f32) -> Self
Create an SDF from an image.
sourcefn render(&self, width: u32, height: u32) -> GrayFImage
fn render(&self, width: u32, height: u32) -> GrayFImage
Render this SDF to a single-channel float image of specified size.
sourcefn render_colored(&self, width: u32, height: u32) -> Self::ColoredOutput
fn render_colored(&self, width: u32, height: u32) -> Self::ColoredOutput
Render this SDF to a multi-channel float image of specified size. Colors represent MSDF edge colors.