summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/osd.h
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2012-12-02 01:09:44 -0500
committerMichael Sevakis <jethead71@rockbox.org>2012-12-05 02:03:58 +0100
commit0f8aedbe9492a5226fddd4ad27dae21b8a39e1b4 (patch)
treefa337438065d277926a254af74d3843b060b37eb /apps/plugins/lib/osd.h
parente1ea08417bca57c607df6686472fa0a86f38b6d1 (diff)
downloadrockbox-0f8aedbe9492a5226fddd4ad27dae21b8a39e1b4.tar.gz
rockbox-0f8aedbe9492a5226fddd4ad27dae21b8a39e1b4.zip
Add a true waveform display to the oscilloscope plugin.
* Adds some additional niftyness like a floating popup display that is implemented in an OSD library for use by other plugins. * Speed changes are now gradual for both views and follow a curve derived from some fiddling around to get a nice feel. * Refined a few behavioral things overall. It needs a bit of help from a direct PCM channel callback so it may capture PCM for waveform display. Also need a few other core routines to help out for the OSD. Messes with some keymaps. Some targets need keymaps to access the different views. Some devices can't support the additional view because it requires a large buffer ( > 1 s) for samples. If the plugin buffer is small, they can still use the popup display since the plugin is also much smaller in that case. Slow speed waveform needs some refining so it draws gradually like a real oscilloscope but I'll stick with what it is, for the moment. Change-Id: Ieb5b7922a2238264e9b19a58cb437739194eb036 Reviewed-on: http://gerrit.rockbox.org/245 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
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 */