Skip to main content

Texture

Trait Texture 

Source
pub trait Texture {
    type Host;

    // Required methods
    fn clear_areas(&mut self, areas: &[DeviceRect], backend: &mut Self::Host);
    fn write_data(
        &mut self,
        dist: &DeviceRect,
        data: &[u8],
        host: &mut Self::Host,
    );
    fn copy_as_image(
        &self,
        rect: &DeviceRect,
        host: &mut Self::Host,
    ) -> impl Future<Output = Result<PixelImage, Box<dyn Error>>> + 'static;
    fn color_format(&self) -> ColorFormat;
    fn size(&self) -> DeviceSize;
}
Expand description

Texture use to display.

Required Associated Types§

Required Methods§

Source

fn clear_areas(&mut self, areas: &[DeviceRect], backend: &mut Self::Host)

clear a list of areas in the texture with zero.

Source

fn write_data(&mut self, dist: &DeviceRect, data: &[u8], host: &mut Self::Host)

write data to the texture.

Source

fn copy_as_image( &self, rect: &DeviceRect, host: &mut Self::Host, ) -> impl Future<Output = Result<PixelImage, Box<dyn Error>>> + 'static

Return a image future of the texture area.

  • you should poll the image future after the end_frame is called to ensure all content had been submitted, because the PainterBackend does not be required to draw synchronization
Source

fn color_format(&self) -> ColorFormat

Source

fn size(&self) -> DeviceSize

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§