pub trait TextureExtManual: Sealed + IsA<Texture> + 'static {
    // Provided method
    fn download(&self, data: &mut [u8], stride: usize) { ... }
}
Expand description

Trait containing manually implemented methods of Texture.

Provided Methods§

source

fn download(&self, data: &mut [u8], stride: usize)

Downloads the @self into local memory.

This may be an expensive operation, as the actual texture data may reside on a GPU or on a remote display server.

The data format of the downloaded data is equivalent to CAIRO_FORMAT_ARGB32, so every downloaded pixel requires 4 bytes of memory.

Downloading a texture into a Cairo image surface: ⚠️ The following code is in c ⚠️

surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
                                      gdk_texture_get_width (texture),
                                      gdk_texture_get_height (texture));
gdk_texture_download (texture,
                      cairo_image_surface_get_data (surface),
                      cairo_image_surface_get_stride (surface));
cairo_surface_mark_dirty (surface);

For more flexible download capabilites, see TextureDownloader.

data

pointer to enough memory to be filled with the downloaded data of @self

stride

rowstride in bytes

Implementors§