i_slint_core::item_rendering

Struct PartialRenderer

Source
pub struct PartialRenderer<'a, T> {
    pub dirty_region: DirtyRegion,
    pub actual_renderer: T,
    /* private fields */
}
Expand description

Put this structure in the renderer to help with partial rendering

Fields§

§dirty_region: DirtyRegion

The region of the screen which is considered dirty and that should be repainted

§actual_renderer: T

The actual renderer which the drawing call will be forwarded to

Implementations§

Source§

impl<'a, T> PartialRenderer<'a, T>

Source

pub fn new( cache: &'a RefCell<PartialRenderingCache>, initial_dirty_region: DirtyRegion, actual_renderer: T, ) -> Self

Create a new PartialRenderer

Source

pub fn compute_dirty_regions( &mut self, component: &ItemTreeRc, origin: LogicalPoint, size: LogicalSize, )

Visit the tree of item and compute what are the dirty regions

Source

pub fn into_inner(self) -> T

Move the actual renderer

Trait Implementations§

Source§

impl<'a, T: ItemRenderer> ItemRenderer for PartialRenderer<'a, T>

Source§

fn filter_item(&mut self, item_rc: &ItemRc) -> (bool, LogicalRect)

This is called before it is being rendered (before the draw_* function). Returns Read more
Source§

fn draw_rectangle( &mut self, obj: Pin<&Rectangle>, item_rc: &ItemRc, size: LogicalSize, )

Source§

fn draw_border_rectangle( &mut self, obj: Pin<&dyn RenderBorderRectangle>, item_rc: &ItemRc, size: LogicalSize, cache: &CachedRenderingData, )

Source§

fn draw_image( &mut self, obj: Pin<&dyn RenderImage>, item_rc: &ItemRc, size: LogicalSize, cache: &CachedRenderingData, )

Source§

fn draw_text( &mut self, obj: Pin<&dyn RenderText>, item_rc: &ItemRc, size: LogicalSize, cache: &CachedRenderingData, )

Source§

fn draw_text_input( &mut self, obj: Pin<&TextInput>, item_rc: &ItemRc, size: LogicalSize, )

Source§

fn draw_path(&mut self, obj: Pin<&Path>, item_rc: &ItemRc, size: LogicalSize)

Source§

fn draw_box_shadow( &mut self, obj: Pin<&BoxShadow>, item_rc: &ItemRc, size: LogicalSize, )

Source§

fn visit_clip( &mut self, obj: Pin<&Clip>, item_rc: &ItemRc, size: LogicalSize, ) -> RenderingResult

Source§

fn visit_opacity( &mut self, obj: Pin<&Opacity>, item_rc: &ItemRc, size: LogicalSize, ) -> RenderingResult

Source§

fn combine_clip( &mut self, rect: LogicalRect, radius: LogicalBorderRadius, border_width: LogicalLength, ) -> bool

Clip the further call until restore_state. radius/border_width can be used for border rectangle clip. (FIXME: consider removing radius/border_width and have another function that take a path instead) Returns a boolean indicating the state of the new clip region: true if the clip region covers an area; false if the clip region is empty.
Source§

fn get_current_clip(&self) -> LogicalRect

Get the current clip bounding box in the current transformed coordinate.
Source§

fn translate(&mut self, distance: LogicalVector)

Source§

fn translation(&self) -> LogicalVector

Source§

fn rotate(&mut self, angle_in_degrees: f32)

Source§

fn apply_opacity(&mut self, opacity: f32)

Apply the opacity (between 0 and 1) for all following items until the next call to restore_state.
Source§

fn save_state(&mut self)

Source§

fn restore_state(&mut self)

Source§

fn scale_factor(&self) -> f32

Returns the scale factor
Source§

fn draw_cached_pixmap( &mut self, item_rc: &ItemRc, update_fn: &dyn Fn(&mut dyn FnMut(u32, u32, &[u8])), )

Draw a pixmap in position indicated by the pos. The pixmap will be taken from cache if the cache is valid, otherwise, update_fn will be called with a callback that need to be called once with fn (width, height, data) where data are the RGBA premultiplied pixel values
Source§

fn draw_string(&mut self, string: &str, color: Color)

Draw the given string with the specified color at current (0, 0) with the default font. Mainly used by the performance counter overlay.
Source§

fn draw_image_direct(&mut self, image: Image)

Source§

fn draw_rect(&mut self, size: LogicalSize, brush: Brush)

Fills a rectangle at (0,0) with the given size. This is used for example by the Skia renderer to handle window backgrounds with a brush (gradient).
Source§

fn window(&self) -> &WindowInner

Source§

fn as_any(&mut self) -> Option<&mut dyn Any>

Return the internal renderer
Source§

fn visit_layer( &mut self, _layer_item: Pin<&Layer>, _self_rc: &ItemRc, _size: LogicalSize, ) -> RenderingResult

Source§

fn metrics(&self) -> RenderingMetrics

Returns any rendering metrics collecting since the creation of the renderer (typically per frame)

Auto Trait Implementations§

§

impl<'a, T> Freeze for PartialRenderer<'a, T>
where T: Freeze,

§

impl<'a, T> !RefUnwindSafe for PartialRenderer<'a, T>

§

impl<'a, T> !Send for PartialRenderer<'a, T>

§

impl<'a, T> !Sync for PartialRenderer<'a, T>

§

impl<'a, T> Unpin for PartialRenderer<'a, T>
where T: Unpin,

§

impl<'a, T> !UnwindSafe for PartialRenderer<'a, T>

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.