Skip to main content

RenderOutput

Enum RenderOutput 

Source
pub enum RenderOutput {
    Greyscale(Bitmap),
    Color(ColorBitmap),
    Sdf {
        width: u32,
        height: u32,
        data: Vec<u8>,
    },
    Lcd(LcdBitmap),
    Msdf {
        width: u32,
        height: u32,
        data: Vec<u8>,
    },
}
Expand description

Unified per-glyph render output.

Lets a rendering pipeline return greyscale, color, SDF, LCD subpixel, or multi-channel SDF output through a single channel so callers can handle a mixed set of glyphs uniformly.

Variants§

§

Greyscale(Bitmap)

A greyscale coverage bitmap.

§

Color(ColorBitmap)

An RGBA color bitmap (color fonts).

§

Sdf

A single-channel signed-distance-field tile (width * height bytes).

Fields

§width: u32

Tile width in pixels.

§height: u32

Tile height in pixels.

§data: Vec<u8>

SDF bytes (< 128 outside, ≈ 128 outline, > 128 inside).

§

Lcd(LcdBitmap)

An LCD subpixel bitmap (three bytes per pixel: R, G, B channels).

Used for ClearType / FreeType LCD rendering to achieve sub-pixel horizontal precision on colour LCD displays.

§

Msdf

A multi-channel signed-distance-field tile.

MSDF encodes the distance field across three independent colour channels to resolve corner artefacts that appear in single-channel SDF at large magnifications. The data layout is width * height * 3 bytes (RGB).

Fields

§width: u32

Tile width in pixels.

§height: u32

Tile height in pixels.

§data: Vec<u8>

MSDF bytes in RGB order: width * height * 3 bytes.

Implementations§

Source§

impl RenderOutput

Source

pub fn into_bitmap(self) -> Option<Bitmap>

Extracts the greyscale Bitmap from a RenderOutput::Greyscale variant, returning None for all other variants.

Trait Implementations§

Source§

impl Clone for RenderOutput

Source§

fn clone(&self) -> RenderOutput

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RenderOutput

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<RenderOutput> for Option<Bitmap>

Source§

fn from(output: RenderOutput) -> Self

Converts a RenderOutput into Some(Bitmap) for the greyscale variant, or None for all other variants.

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.