gf_cursor_set()

Set the current hardware cursor bitmap definition

Synopsis:

#include <gf/gf.h>

int gf_cursor_set( gf_display_t         display,
                   unsigned             cursor_index,
                   const gf_cursor_t *  cursor );

Arguments:

display
The display you want to set the hardware cursor for.
cursor_index
Currently ignored. Set to 0.
cursor
A pointer to a gf_cursor_t that describes the cursor to set (see below).

Library:

gf

Description:

This function replaces the hardware cursor bitmap definition for a display.


Note: By default, the hardware cursor is disabled. If the cursor isn't already enabled on the display, you must explicitly enable it using gf_cursor_enable().


WARNING: Threads should not call this function between calls to gf_draw_begin() and gf_draw_end(), or a deadlock will occur.

The gf_cursor_t structure defines a cursor:

typedef struct {

    enum {
        GF_CURSOR_BITMAP,
    }
    type;
    gf_point_t hotspot;
    union {
        struct {
            int w;
            int h;
            int stride;
            gf_color_t color0;
            const uint8_t *image0;
            const uint8_t *image1;
            gf_color_t color1;
        } bitmap;
    } cursor;
} gf_cursor_t;

It has at least these members:

type
The type of the cursor. The value of this field dictates which member of the gf_cursor_t::cursor union is valid. Only bitmap cursors are currently supported, so you must always set this value to GF_CURSOR_BITMAP.
hotspot
The offset into the cursor's top left corner to consider as the actual pointer position. See gf_point_t.
cursor
A union of type-dependent data describing the cursor entity. Since only bitmap cursors are supported, this union has one possible value, a structure that describes a cursor as two planar bitmaps:
w, h
Width and height of the bitmaps, in pixels. The same values are assumed for both bitmaps.
stride
Bytes per line for the bitmaps. This includes the bytes required to represent a single line as well as any padding imposed by the application. The same stride is assumed for both bitmaps).
color0
The color for the first bitmap.
image0
A pointer to the bitmap data for the first plane. The data represents a w × h, single bit per pixel bitmap, packing 8 pixels per byte. There should be h contiguous lines of stride bytes each. On bits (1) are rendered in the color specified by color0, and off bits (0) are treated as transparent.
image1
A pointer to the bitmap data for the second plane, which will be laid over the first. This image is treated identically to image0, except color is specified by color1.
color1
The color for the second bitmap.

Returns:

GF_ERR_OK
Success.
GF_ERR_MEM
Error allocating memory for message.
GF_ERR_PARM
Unsupported cursor type.
GF_ERR_IODISPLAY
Error communicating with io-display. Check to ensure that io-display is still running. The sloginfo utility may provide more information.

Classification:

QNX Graphics Framework

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

gf_cursor_disable(), gf_cursor_enable(), gf_cursor_set_pos(), gf_point_t