wayland.client.memory_pool ¤
SharedMemoryPool ¤
A helper that provides a simple method of managing surface memory pools and buffers.
Simply call create_buffer(width, height) any time a buffer is required for updating a surface. A wayland.wl_buffer instance and a pointer to the buffer are returned. This class handles everything else, double buffering (quad-buffering by default in fact), pool resizing, etc.
See examples/30-main-window.py
for an example using SharedMemoryPool to display a main application window surface.
Parameters:
Methods:
-
create_buffer
–Get a pointer to a buffer, creating it if necessary.
create_buffer ¤
create_buffer(
width: int, height: int, pixel_format: format = argb8888
) -> tuple[wl_buffer, POINTER[c_uint8]] | tuple[None, None]
Get a pointer to a buffer, creating it if necessary.
The buffer pointer returned is cast to ctypes.c_uint8
(unsigned byte), it is suitable for directly writing into, either from Python or with an external library, such as cv2, pillow, etc.
Parameters:
-
width
¤int
) –Width of the buffer in pixels
-
height
¤int
) –Height of the buffer in pixels
-
pixel_format
¤format
, default:argb8888
) –The pixel format of the surface.
Returns:
SharedMemoryPoolError ¤
Exception for SharedMemoryPool errors.