Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3584 | sourcerer | 1 | /* libnsfb framebuffer surface support */ |
2 | |||
3 | #include "libnsfb.h" |
||
4 | #include "libnsfb_plot.h" |
||
5 | #include "nsfb.h" |
||
6 | |||
7 | /* surface default options */ |
||
8 | typedef int (nsfb_surfacefn_defaults_t)(nsfb_t *nsfb); |
||
9 | |||
10 | /* surface init */ |
||
11 | typedef int (nsfb_surfacefn_init_t)(nsfb_t *nsfb); |
||
12 | |||
13 | /* surface finalise */ |
||
14 | typedef int (nsfb_surfacefn_fini_t)(nsfb_t *nsfb); |
||
15 | |||
16 | /* surface set geometry */ |
||
17 | typedef int (nsfb_surfacefn_geometry_t)(nsfb_t *nsfb, int width, int height, enum nsfb_format_e format); |
||
18 | |||
19 | /* surface set parameters */ |
||
20 | typedef int (nsfb_surfacefn_parameters_t)(nsfb_t *nsfb, const char *parameters); |
||
21 | |||
22 | /* surface input */ |
||
23 | typedef bool (nsfb_surfacefn_input_t)(nsfb_t *nsfb, nsfb_event_t *event, int timeout); |
||
24 | |||
25 | /* surface area claim */ |
||
26 | typedef int (nsfb_surfacefn_claim_t)(nsfb_t *nsfb, nsfb_bbox_t *box); |
||
27 | |||
28 | /* surface area update */ |
||
29 | typedef int (nsfb_surfacefn_update_t)(nsfb_t *nsfb, nsfb_bbox_t *box); |
||
30 | |||
31 | /* surface cursor display */ |
||
32 | typedef int (nsfb_surfacefn_cursor_t)(nsfb_t *nsfb, struct nsfb_cursor_s *cursor); |
||
33 | |||
34 | typedef struct nsfb_surface_rtns_s { |
||
35 | nsfb_surfacefn_defaults_t *defaults; |
||
36 | nsfb_surfacefn_init_t *initialise; |
||
37 | nsfb_surfacefn_fini_t *finalise; |
||
38 | nsfb_surfacefn_geometry_t *geometry; |
||
39 | nsfb_surfacefn_parameters_t *parameters; |
||
40 | nsfb_surfacefn_input_t *input; |
||
41 | nsfb_surfacefn_claim_t *claim; |
||
42 | nsfb_surfacefn_update_t *update; |
||
43 | nsfb_surfacefn_cursor_t *cursor; |
||
44 | } nsfb_surface_rtns_t; |
||
45 | |||
46 | void _nsfb_register_surface(const enum nsfb_type_e type, const nsfb_surface_rtns_t *rtns, const char *name); |
||
47 | |||
48 | |||
49 | /* macro which adds a builtin command with no argument limits */ |
||
50 | #define NSFB_SURFACE_DEF(__name, __type, __rtns) \ |
||
51 | static void __name##_register_surface(void) __attribute__((constructor)); \ |
||
52 | void __name##_register_surface(void) { \ |
||
53 | _nsfb_register_surface(__type, __rtns, #__name); \ |
||
54 | } |
||
55 | |||
56 | /** Obtain routines for a surface |
||
57 | * |
||
58 | * Obtain a vlist of methods for a surface type. |
||
59 | * |
||
60 | * @param type The surface type. |
||
61 | * @return A vtable of routines which teh caller must deallocate or |
||
62 | * NULL on error |
||
63 | */ |
||
64 | nsfb_surface_rtns_t *nsfb_surface_get_rtns(enum nsfb_type_e type); |
||
65 |