Struct wayland_client::core::shm::ShmPool [] [src]

pub struct ShmPool {
    // some fields omitted
}

A shared memory pool.

It represents a chunk of memory shared between your program and the wayland client. You can write to it using the means you used to create it (for example by writing to the file if you used a temporary file).

This pool can the be split into buffers, which are "views" into the pool that the server will use to draw on the surfaces.

Methods

impl ShmPool

fn create_buffer<'b>(&self, offset: i32, width: i32, height: i32, stride: i32, format: ShmFormat) -> Option<Buffer>

Creates a new buffer from this memory pool.

  • offset is the number of bytes to skip from the beginning of the pool.
  • width and height are the dimensions of the image the server will read.
  • stride is the number of bytes separating the begining of each line ( for example, on a ARGB888 format, each pixel is 4 bytes long, so on a classic data layout we would have stride = 4*width).
  • format is the format of the data contained in the buffer.

fn resize(&self, size: i32)

Resizes the memory pool to a new size.

Can only be used to make the pool bigger

Trait Implementations

impl Send for ShmPool

impl Sync for ShmPool

impl Drop for ShmPool

fn drop(&mut self)

impl FFI for ShmPool

type Ptr = wl_shm_pool

fn ptr(&self) -> *const wl_shm_pool

unsafe fn ptr_mut(&self) -> *mut wl_shm_pool