Skip to main content

ILockedFramebuffer

Trait ILockedFramebuffer 

Source
pub trait ILockedFramebuffer {
    // Required methods
    fn address(&self) -> *mut u8;
    fn with_data(&self, access: &mut dyn FnMut(&mut [u8]));
    fn size(&self) -> PixelSize;
    fn row_bytes(&self) -> i32;
    fn dpi(&self) -> Vector;
    fn format(&self) -> PixelFormat;
    fn alpha_format(&self) -> AlphaFormat;
    fn dispose(&self);
}
Expand description

A locked framebuffer: a block of pixel memory that can be read and written until it is disposed, at which point its content is presented or committed.

Required Methods§

Source

fn address(&self) -> *mut u8

The address of the first pixel.

The memory is row_bytes() * size().height bytes long and stays valid until dispose is called.

Source

fn with_data(&self, access: &mut dyn FnMut(&mut [u8]))

Gives access the pixel memory as a slice of row_bytes() * size().height bytes.

This is the safe counterpart of address. The framebuffer must not be accessed again from within access.

Source

fn size(&self) -> PixelSize

The framebuffer size in device pixels.

Source

fn row_bytes(&self) -> i32

The number of bytes per row.

Source

fn dpi(&self) -> Vector

The DPI of the underlying screen.

Source

fn format(&self) -> PixelFormat

The pixel format.

Source

fn alpha_format(&self) -> AlphaFormat

The alpha format.

Source

fn dispose(&self)

Unlocks the framebuffer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§