summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/osd.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lib/osd.h')
-rw-r--r--apps/plugins/lib/osd.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/apps/plugins/lib/osd.h b/apps/plugins/lib/osd.h
new file mode 100644
index 0000000000..89441ae273
--- /dev/null
+++ b/apps/plugins/lib/osd.h
@@ -0,0 +1,94 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Floating on-screen display
11*
12* Copyright (C) 2012 Michael Sevakis
13*
14* This program is free software; you can redistribute it and/or
15* modify it under the terms of the GNU General Public License
16* as published by the Free Software Foundation; either version 2
17* of the License, or (at your option) any later version.
18*
19* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20* KIND, either express or implied.
21*
22****************************************************************************/
23#ifndef OSD_H
24#define OSD_H
25
26/* At this time: assumes use of the default viewport for normal drawing */
27
28/* Callback implemented by user. Paramters are OSD vp-relative coordinates */
29typedef void (* osd_draw_cb_fn_t)(int x, int y, int width, int height);
30
31/* Initialize the OSD, set its backbuffer, update callback and enable it if
32 * the call succeeded. */
33bool osd_init(void *backbuf, size_t backbuf_size,
34 osd_draw_cb_fn_t draw_cb);
35
36enum
37{
38 OSD_HIDE = 0x0, /* Hide from view */
39 OSD_SHOW = 0x1, /* Bring into view, updating if needed */
40 OSD_UPDATENOW = 0x2, /* Force update even if nothing changed */
41};
42
43/* Show/Hide the OSD on screen returning previous status */
44bool osd_show(unsigned flags);
45
46/* Redraw the entire OSD returning true if screen update occurred */
47bool osd_update(void);
48
49/* Redraw part of the OSD (OSD viewport-relative coordinates) returning true
50 if any screen update occurred */
51bool osd_update_rect(int x, int y, int width, int height);
52
53/* Set a new screen location and size (screen coordinates) */
54bool osd_update_pos(int x, int y, int width, int height);
55
56/* Call periodically to have the OSD timeout and hide itself */
57void osd_monitor_timeout(void);
58
59/* Set the OSD timeout value. 'timeout' <= 0 == never timeout */
60void osd_set_timeout(long timeout);
61
62/* Use the OSD viewport context */
63struct viewport * osd_get_viewport(void);
64
65/* Get the maximum buffer dimensions calculated by osd_init() */
66void osd_get_max_dims(int *maxwidth, int *maxheight);
67
68/* Is the OSD enabled? */
69bool osd_enabled(void);
70
71/** Functions that must be used in lieu of regular LCD functions for this
72 ** to work.
73 **
74 ** To be efficient, as much drawing as possible should be combined between
75 ** *prepare and *update.
76 **
77 ** osd_lcd_update_prepare();
78 ** <draw stuff using lcd_* routines>
79 ** osd_lcd_update[_rect]();
80 **
81 ** TODO: Make it work seamlessly with greylib and regular LCD functions.
82 **/
83
84/* Prepare LCD frambuffer for regular drawing - call before any other LCD
85 function */
86void osd_lcd_update_prepare(void);
87
88/* Update the whole screen and restore OSD if it is visible */
89void osd_lcd_update(void);
90
91/* Update a part of the screen and restore OSD if it is visible */
92void osd_lcd_update_rect(int x, int y, int width, int height);
93
94#endif /* OSD_H */