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§
Sourcefn clear_areas(&mut self, areas: &[DeviceRect], backend: &mut Self::Host)
fn clear_areas(&mut self, areas: &[DeviceRect], backend: &mut Self::Host)
clear a list of areas in the texture with zero.
Sourcefn write_data(&mut self, dist: &DeviceRect, data: &[u8], host: &mut Self::Host)
fn write_data(&mut self, dist: &DeviceRect, data: &[u8], host: &mut Self::Host)
write data to the texture.
Sourcefn copy_as_image(
&self,
rect: &DeviceRect,
host: &mut Self::Host,
) -> impl Future<Output = Result<PixelImage, Box<dyn Error>>> + 'static
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_frameis called to ensure all content had been submitted, because the PainterBackend does not be required to draw synchronization
fn color_format(&self) -> ColorFormat
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.