pub struct Renderer { /* private fields */ }Expand description
The renderer. Stateless aside from config — call render() each frame.
Implementations§
Source§impl Renderer
impl Renderer
pub fn new(config: RenderConfig) -> Self
pub fn config(&self) -> &RenderConfig
Sourcepub fn render(
&self,
doc: &Document,
viewport: &ViewState,
selected_ids: &[&str],
selection_box: Option<Bounds>,
) -> Pixmap
pub fn render( &self, doc: &Document, viewport: &ViewState, selected_ids: &[&str], selection_box: Option<Bounds>, ) -> Pixmap
Render the document to a pixmap.
§Panics
Panics if tiny_skia::Pixmap::new fails to allocate. Width and height
are clamped to at least 1 via .max(1), so the remaining failure modes
are allocator OOM or dimensions whose width * height * 4 overflows
i32::MAX — conditions the caller is responsible for avoiding via
RenderConfig sizing.
pub fn hit_test( &self, doc: &Document, viewport: &ViewState, screen_x: f32, screen_y: f32, ) -> Option<String>
pub fn hit_test_handle( &self, doc: &Document, viewport: &ViewState, screen_x: f32, screen_y: f32, ) -> Option<(String, HandlePosition)>
pub fn elements_in_rect( &self, doc: &Document, _viewport: &ViewState, rect: Bounds, ) -> Vec<String>
Auto Trait Implementations§
impl Freeze for Renderer
impl RefUnwindSafe for Renderer
impl Send for Renderer
impl Sync for Renderer
impl Unpin for Renderer
impl UnsafeUnpin for Renderer
impl UnwindSafe for Renderer
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
Mutably borrows from an owned value. Read more