1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#ifndef _LIBNSFB_H
#define _LIBNSFB_H 1
#include <stdint.h>
typedef struct nsfb_cursor_s nsfb_cursor_t;
typedef struct nsfb_s nsfb_t;
typedef uint32_t nsfb_colour_t;
/* bounding box */
typedef struct nsfb_bbox_s {
int x0;
int y0;
int x1;
int y1;
} nsfb_bbox_t;
/** The type of frontend for a framebuffer context. */
enum nsfb_frontend_e {
NSFB_FRONTEND_NONE = 0, /* Empty frontend. */
NSFB_FRONTEND_SDL,
NSFB_FRONTEND_LINUX,
NSFB_FRONTEND_VNC,
NSFB_FRONTEND_ABLE,
NSFB_FRONTEND_RAM,
};
/** Initialise nsfb context.
*
* This initialises a framebuffer context.
*
* @param frontend The type of frontend to create a context for.
*/
nsfb_t *nsfb_init(enum nsfb_frontend_e frontend);
/** Initialise selected frontend.
*
* @param nsfb The context frturned from ::nsfb_init
*/
int nsfb_init_frontend(nsfb_t *nsfb);
/** Process input from a frontend.
*/
int nsfb_input(nsfb_t *nsfb);
/** Claim an area of screen to be redrawn.
*
* Informs the nsfb library that an area of screen will be updated by the user
* program, used for soft cursor plotting.
*
* @param box The bounding box of the area which might be altered.
*/
int nsfb_claim(nsfb_t *nsfb, nsfb_bbox_t *box);
/** Release an area of screen which has been redrawn.
*
* Informs the nsfb library that an area of screen has been updated by the user
* program. Some frontends only update on area release.
*
* @param box The bounding box of the area which has been altered.
*/
int nsfb_release(nsfb_t *nsfb, nsfb_bbox_t *box);
/** Obtain the geometry of a nsfb context.
*
* @param width a variable to store the framebuffer width in or NULL
* @param height a variable to store the framebuffer height in or NULL
* @param bpp a variable to store the framebuffer bpp in or NULL
*/
int nsfb_get_geometry(nsfb_t *nsfb, int *width, int *height, int *bpp);
/** Obtain the framebuffer memory base and stride. */
int nsfb_get_framebuffer(nsfb_t *nsfb, uint8_t **ptr, int *linelen);
#endif
|