pub trait LineBufferProvider {
    type TargetPixel: TargetPixel;

    // Required method
    fn process_line(
        &mut self,
        line: usize,
        range: Range<usize>,
        render_fn: impl FnOnce(&mut [Self::TargetPixel])
    );
}
Expand description

This trait defines a bi-directional interface between Slint and your code to send lines to your screen, when using the SoftwareRenderer::render_by_line function.

  • Through the associated TargetPixel type Slint knows how to create and manipulate pixels without having to know the exact device-specific binary representation and operations for blending.
  • Through the process_line function Slint notifies you when a line can be rendered and provides a callback that you can invoke to fill a slice of pixels for the given line.

See the render_by_line documentation for an example.

Required Associated Types§

type TargetPixel: TargetPixel

The pixel type of the buffer

Required Methods§

fn process_line( &mut self, line: usize, range: Range<usize>, render_fn: impl FnOnce(&mut [Self::TargetPixel]) )

Called once per line, you will have to call the render_fn back with the buffer.

The line is the y position of the line to be drawn. The range is the range within the line that is going to be rendered (eg, within the dirty region) The render_fn function should be called to render the line, passing the buffer corresponding to the specified line and range.

Implementors§