screen_blit()
Graphics and Screen4.0 (8.x)Screen Graphics Subsystem Developer's GuideAPIProgrammingUtilities
Copy pixel data from one buffer to another
Synopsis:
#include <screen/screen.h>
int screen_blit(screen_context_t ctx,
screen_buffer_t dst,
screen_buffer_t src,
const int *attribs)
Arguments:
- ctx
- A connection to Screen
- dst
- The buffer which data is copied to. The source rectangle must be located entirely within the source buffer (src) and the destination rectangle must be located entirely within the destination buffer (dst); otherwise screen_blit() returns an error.
- src
- The buffer which the pixels are copied from.
- attribs
- A list that contains the attributes that define the blit. This list must consist of a series of token-value pairs terminated with a SCREEN_BLIT_END token. The tokens used in this list must be of type Screen blit types.
Library:
libscreenDescription:
Function Type: Delayed Execution
This function requests pixels from one buffer be copied to another. Note that this blit operation may not execute immediately; therefore, you could still encounter an error when you actually trigger the blit operation despite the call to this function having returned successfully.
The attribs argument is allowed to be NULL or empty (i.e. contains a single element that is set to SCREEN_BLIT_END). When attribs is empty or NULL, the attribute defaults are used. See the attribute default values found in Screen blit types.
You can change the default behaviour. To do so, set attribs with pairings of the following valid tokens and their desired values:
- SCREEN_BLIT_SOURCE_X
- SCREEN_BLIT_SOURCE_Y
- SCREEN_BLIT_SOURCE_WIDTH
- SCREEN_BLIT_SOURCE_HEIGHT
- SCREEN_BLIT_DESTINATION_X
- SCREEN_BLIT_DESTINATION_Y
- SCREEN_BLIT_DESTINATION_WIDTH
- SCREEN_BLIT_DESTINATION_HEIGHT
- SCREEN_BLIT_SCALE_QUALITY
- SCREEN_BLIT_GLOBAL_ALPHA
- SCREEN_BLIT_ROTATION
- SCREEN_BLIT_TRANSPARENCY
Returns:
0
if successful, or -1
if an error occurred (errno
is set; refer to errno.h
for more details).
Page updated: