Skip to main content

DisplayRenderer

Struct DisplayRenderer 

Source
pub struct DisplayRenderer<'a, B: RenderBackend> { /* private fields */ }
Expand description

Renders a DisplayTree by implementing DisplayVisitor and forwarding drawing commands to a RenderBackend.

Implementations§

Source§

impl<'a, B: RenderBackend> DisplayRenderer<'a, B>

Source

pub fn new( backend: &'a mut B, surface: &'a mut B::Surface, page_transform: Matrix, image_decoder: Option<&'a dyn ImageDecoder>, ) -> Self

Create a new renderer targeting the given backend and surface.

Source

pub fn with_fallback_fonts(self, fonts: Vec<Arc<ResolvedFont>>) -> Self

Set fallback fonts to use when the primary font is missing a glyph.

Source

pub fn with_forced_color_scheme(self, scheme: ColorScheme) -> Self

Set a forced color scheme for accessibility rendering.

Source

pub fn with_per_feature_aa( self, text_aa: bool, path_aa: bool, image_aa: bool, ) -> Self

Set per-feature anti-aliasing flags.

Trait Implementations§

Source§

impl<B: RenderBackend> DisplayVisitor for DisplayRenderer<'_, B>

Source§

fn enter_group( &mut self, blend_mode: BlendMode, clip: Option<&ClipPath>, opacity: f32, isolated: bool, knockout: bool, soft_mask: &Option<Box<SoftMask>>, ) -> bool

Called when entering a group node. Read more
Source§

fn leave_group(&mut self)

Called when leaving a group node.
Source§

fn visit_path( &mut self, ops: &[PathOp], style: &PathStyle, matrix: &Matrix, fill_color: Option<&Color>, stroke_color: Option<&Color>, fill_color_space: Option<&ColorSpaceFamily>, stroke_color_space: Option<&ColorSpaceFamily>, transfer_function: Option<&TransferFunction>, overprint: bool, _overprint_mode: u32, )

Called for a path node.
Source§

fn visit_image( &mut self, image_ref: &ImageRef, matrix: &Matrix, mask: Option<&ImageMask>, fill_color: Option<&Color>, transfer_function: Option<&TransferFunction>, )

Called for an image node.
Source§

fn visit_inline_image( &mut self, properties: &HashMap<Name, Operand>, data: &[u8], matrix: &Matrix, )

Called for an inline image node.
Source§

fn visit_pattern_fill( &mut self, path_ops: &[PathOp], fill_rule: FillRule, pattern: &TilingPattern, pattern_tree: &DisplayTree, _fill_color: Option<&Color>, matrix: &Matrix, )

Called for a pattern fill node.
Source§

fn visit_shading_fill(&mut self, shading: &ShadingDict, matrix: &Matrix)

Called for a shading fill node.
Source§

fn visit_text(&mut self, runs: &[TextRun])

Called for a text node.

Auto Trait Implementations§

§

impl<'a, B> Freeze for DisplayRenderer<'a, B>

§

impl<'a, B> !RefUnwindSafe for DisplayRenderer<'a, B>

§

impl<'a, B> Send for DisplayRenderer<'a, B>
where <B as RenderBackend>::Surface: Send,

§

impl<'a, B> Sync for DisplayRenderer<'a, B>
where B: Sync, <B as RenderBackend>::Surface: Sync,

§

impl<'a, B> Unpin for DisplayRenderer<'a, B>

§

impl<'a, B> UnsafeUnpin for DisplayRenderer<'a, B>

§

impl<'a, B> !UnwindSafe for DisplayRenderer<'a, B>

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more