Skip to main content

Renderer

Struct Renderer 

Source
pub struct Renderer { /* private fields */ }
Expand description

The renderer. Stateless aside from config — call render() each frame.

Implementations§

Source§

impl Renderer

Source

pub fn new(config: RenderConfig) -> Renderer

Source

pub fn config(&self) -> &RenderConfig

Access renderer configuration.

Source

pub fn render( &self, doc: &Document, viewport: &ViewState, selected_ids: &[&str], selection_box: Option<Bounds>, ) -> Pixmap

Render the full document to a pixel buffer.

Source

pub fn hit_test( &self, doc: &Document, viewport: &ViewState, screen_x: f32, screen_y: f32, ) -> Option<String>

Hit test: which element is at this screen point? Returns element id. Iterates in reverse z-order (topmost first).

Source

pub fn hit_test_handle( &self, doc: &Document, viewport: &ViewState, screen_x: f32, screen_y: f32, ) -> Option<(String, HandlePosition)>

Hit test for resize handles. Returns (element_id, handle_position).

Source

pub fn elements_in_rect( &self, doc: &Document, _viewport: &ViewState, rect: Bounds, ) -> Vec<String>

Get element ids within a selection rectangle (world coords in Bounds).

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, 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.