screen_fill()

Fill an area of a buffer

Function type:

Delayed execution

Synopsis:

#include <screen/screen.h>

int screen_fill( screen_context_t ctx, 
                 screen_buffer_t dst, 
                 const int *attribs)

Arguments:

ctx
A connection to screen (acquired with screen_create_context()).
dst
Specifies the buffer the data will be copied to. Typically this handle is acquired by querying the render buffers of a screen pixmap or window with screen_get_pixmap_property() or screen_get_window_property().
attribs
This should contain a list of attributes that will define the blit. This list must consist of a series of token value pairs terminated with a SCREEN_BLIT_END token. The list of supported attributes is as follows:
SCREEN_BLIT_DESTINATION_X
The following element contains the horizontal position of the rectangle into the destination buffer that defines the area that will be filled. The offset is the distance in pixels from the left edge of the destination buffer.

If SCREEN_BLIT_DESTINATION_X is not specified, 0 will be used. If SCREEN_BLIT_DESTINATION_Y is not specified, 0 will be used. IF SCREEN_BLIT_DESTINATION_WIDTH is not specified, the destination buffer width will be used. If SCREEN_BLIT_DESTINATION_HEIGHT is not specified, the destination buffer height will be used.

SCREEN_BLIT_DESTINATION_Y
The following element contains the vertical position of the rectangle into the destination buffer that defines the area that will be filled. The offset is the distance in pixels from the top edge of the destination buffer.
SCREEN_BLIT_DESTINATION_WIDTH
The following element contains width of the rectangle into the destination buffer that defines the area that will be filled. The width is in pixels. The width does not have to match the source width. If the destination width is larger, the source rectangle will be stretched. If the destination width is smaller than the source width, the image will be compressed.
SCREEN_BLIT_DESTINATION_HEIGHT
The following element contains the height of the rectangle into the destination buffer that defines the area that will be copied into. The height is also in pixels. The height does not have to match the source height. If the destination height is larger, the source rectangle will be stretched. If the destination height is smaller than the source height, the image will be compressed. Note that the horizontal and vertical scale factors don’t have to be equal. It is acceptable to specify a source width that is larger than the destination width while the source height is smaller than the destination height, and vice versa.
SCREEN_BLIT_GLOBAL_ALPHA
The following element contains a global transparency value that should be used to blend the source onto the destination. If SCREEN_BLIT_GLOBAL_ALPHA is not specified, 255 will be used.
SCREEN_BLIT_COLOR
The following element contains the color to be used by the fill operation. The color format is red in bits 16 to 23, green in bits 8 to 15, and blue in bits 0 to 7. If SCREEN_BLIT_COLOR is not specified, white (#ffffff) will be used.

Library:

screen

Description:

This function requests that a rectangular area of the destination buffer be filled with a solid color. Global transparency can be applied using the SCREEN_BLIT_GLOBAL_ALPHA attribute.

Returns:

If the function succeeds, it returns 0 and the buffer is filled. Otherwise, the function returns -1 and errno is set.

Classification:

Windowing API

Safety  Value  
Interrupt handler No
Signal handler No
Thread Yes