Skip to main content

TargetPixelBuffer

Trait TargetPixelBuffer 

Source
pub trait TargetPixelBuffer {
    type TargetPixel: TargetPixel;

    // Required methods
    fn line_slice(&mut self, line_number: usize) -> &mut [Self::TargetPixel];
    fn num_lines(&self) -> usize;

    // Provided methods
    fn fill_background(
        &mut self,
        _brush: &Brush,
        _region: &PhysicalRegion,
    ) -> bool { ... }
    fn draw_rectangle(
        &mut self,
        _: &DrawRectangleArgs,
        _clip: &PhysicalRegion,
    ) -> bool { ... }
    fn draw_texture(
        &mut self,
        _: &DrawTextureArgs,
        _clip: &PhysicalRegion,
    ) -> bool { ... }
}
Available on crate feature experimental only.
Expand description

This trait represents access to a buffer of pixels the software renderer can render into, as well as certain operations that the renderer will try to delegate to this trait. Implement these functions to delegate rendering further to hardware-provided 2D acceleration units, such as DMA2D or PXP.

Required Associated Types§

Source

type TargetPixel: TargetPixel

The pixel type the buffer represents.

Required Methods§

Source

fn line_slice(&mut self, line_number: usize) -> &mut [Self::TargetPixel]

Returns a slice of pixels for the given line.

Source

fn num_lines(&self) -> usize

Returns the number of lines the buffer has. This is typically the height in pixels.

Provided Methods§

Source

fn fill_background(&mut self, _brush: &Brush, _region: &PhysicalRegion) -> bool

Fill the background of the buffer with the given brush.

Source

fn draw_rectangle( &mut self, _: &DrawRectangleArgs, _clip: &PhysicalRegion, ) -> bool

Draw a rectangle specified by the DrawRectangleArgs. That rectangle must be clipped to the given region

Source

fn draw_texture(&mut self, _: &DrawTextureArgs, _clip: &PhysicalRegion) -> bool

Draw a texture into the buffer. The texture must be clipped to the given region. Returns true if the operation was successful; false if it could not be implemented and instead the software renderer needs to draw the texture

Implementors§