GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_sw_cursor.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2/*
3 * Copyright (C) 2024 Cyril Hrubis <metan@ucw.cz>
4 */
5
6#ifndef GP_SW_CURSOR
7#define GP_SW_CURSOR
8
9#include <stdint.h>
10#include <core/gp_types.h>
11#include <core/gp_pixel.h>
12
13typedef struct gp_cursor {
14 /*
15 * Offset to start drawing the cursor in pixels.
16 */
17 int8_t x_off, y_off;
18 /*
19 * Cursor pixmap size.
20 */
21 uint8_t w, h;
22 /*
23 * Four pixels per byte with value:
24 *
25 * The rows have to be byte aligned.
26 *
27 * 0 - do not draw anything
28 * 1 - foreground (all pixel bits set to 1)
29 * 2 - background (all pixel bits set to 0)
30 */
31 uint8_t pixmap[];
32} gp_cursor;
33
42extern gp_cursor *gp_cursors_32[];
43
49void gp_cursor_render(gp_cursor *self, gp_pixmap *dst, uint32_t x_off, uint32_t y_off);
50
51
52typedef struct gp_sw_cursor {
53 /* Current cursor position */
54 uint32_t x;
55 uint32_t y;
56
57 uint32_t wh;
58
59 uint32_t hidden:1;
60
61} gp_sw_cursor;
62
63int gp_sw_cursor_init(gp_sw_cursor *self, gp_pixel_type type);
64
75void gp_sw_cursor_update_rect(gp_pixmap *src, void *dst,
76 uint32_t x_start, uint32_t y_start,
77 uint32_t x_end, uint32_t y_end);
78
87void gp_sw_cursor_move(gp_pixmap *src, void *dst, uint32_t x, uint32_t y);
88
89#endif /* GP_SW_CURSOR */
A common types.
gp_pixel_type
List of all pixel types.
A pixel description.
A pixmap buffer.
Definition gp_pixmap.h:33