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: ParagraphMetricsAggregate 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
impl RenderResult
Sourcepub fn composite_to_rgba(
&self,
width: u32,
height: u32,
bg_color: Rgba8,
text_color: Rgba8,
) -> ColorBitmap
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§
impl Freeze for RenderResult
impl RefUnwindSafe for RenderResult
impl Send for RenderResult
impl Sync for RenderResult
impl Unpin for RenderResult
impl UnsafeUnpin for RenderResult
impl UnwindSafe for RenderResult
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