screen_attach_pixmap_buffer()

Associate an externally allocated buffer with a pixmap

Synopsis:

#include <screen/screen.h>
int screen_attach_pixmap_buffer(screen_pixmap_t pix,
                                screen_buffer_t buf)

Arguments:

pix
The handle of a pixmap that does not already have a buffer created or associated to it.
buf
A buffer that was allocated by the application.

Library:

libscreen

Description:

Function Type: Flushing Execution

This function allows a pixmap to use a buffer that was allocated by the application or Screen. Note that pixmaps can have only one buffer.

Whoever allocates the buffer is required to meet all alignment and granularity constraints that are required for the usage flags. Before calling this function, ensure that you set the SCREEN_PROPERTY_USAGE property on the pixmap to indicate your intended usage of the pixmap's buffer. For example, to retrieve SCREEN_PROPERTY_POINTER from the buffer, you must have set the SCREEN_USAGE_READ and/or SCREEN_USAGE_WRITE flags on the pixmap's buffer prior to calling screen_attach_pixmap_buffer().

Returns:

0 if successful, or -1 if an error occurred (errno is set; refer to errno.h for more details).