Skip to main content

RenderResult

Struct RenderResult 

Source
pub struct RenderResult {
    pub glyphs: Vec<PositionedGlyph>,
    pub bitmaps: Vec<Bitmap>,
    pub outputs: Vec<RenderOutput>,
    pub lines: Vec<Line>,
    pub metrics: ParagraphMetrics,
    pub decoration_rects: Vec<DecorationRect>,
}
Expand description

The result of rendering a string of text.

Fields§

§glyphs: Vec<PositionedGlyph>

Positioned glyphs in layout order.

§bitmaps: Vec<Bitmap>

Per-glyph greyscale bitmaps in the same order as glyphs.

For color glyphs this contains an empty Bitmap; use Self::outputs to access the RenderOutput::Color variant.

§outputs: Vec<RenderOutput>

Per-glyph render outputs including both greyscale and color variants.

Always the same length as Self::glyphs. For greyscale glyphs this mirrors bitmaps; for COLRv0/v1 color glyphs the entry is RenderOutput::Color.

§lines: Vec<Line>

Per-line records indexing into Self::glyphs.

Populated by the word-aware layout engine. Lets callers render or hit-test on a per-line basis.

§metrics: ParagraphMetrics

Aggregate paragraph metrics (total width/height, line count, overflow).

§decoration_rects: Vec<DecorationRect>

Decoration rectangles (underlines, overlines, strikethroughs) produced by the layout engine when a TextDecoration was requested via LayoutOptions::decoration (in oxitext_layout).

Empty when the basic Pipeline::render path is used (which does not pass a decoration through to the layout engine). Populated when calling Pipeline::layout_with_options or Pipeline::render_paragraph with a decoration-enabled LayoutOptions.

Implementations§

Source§

impl RenderResult

Source

pub fn composite_to_rgba( &self, width: u32, height: u32, bg_color: Rgba8, text_color: Rgba8, ) -> ColorBitmap

Composites all greyscale glyph bitmaps onto an RGBA canvas of the given size, painting glyphs in text_color over bg_color.

Returns a ColorBitmap (width * height * 4 RGBA bytes). Glyph coverage is treated as an alpha mask and blended with straight-alpha Porter-Duff “source over”.

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.