Debian Codegraph @

plugin/plugingizmo/inline-display.h

raw
1 /*
2 Copyright 2012 David Robillard <http://drobilla.net>
3 Copyright 2016 Robin Gareus <[email protected]>
4 Permission to use, copy, modify, and/or distribute this software for any
5 purpose with or without fee is hereby granted, provided that the above
6 copyright notice and this permission notice appear in all copies.
7 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 */
15
16 /**
17 @defgroup inlinedisplay Inline-Display
18 Support for displaying a miniaturized, non-interactive view
19 in the host's mixer strip.
20 @{
21 */
22
23 #ifndef LV2_INLINE_DISPLAY_H
24 #define LV2_INLINE_DISPLAY_H
25
26 #include <stdint.h>
27
28 #include "lv2/lv2plug.in/ns/lv2core/lv2.h"
29
30 #define LV2_INLINEDISPLAY_URI "http://harrisonconsoles.com/lv2/inlinedisplay"
31 #define LV2_INLINEDISPLAY_PREFIX LV2_INLINEDISPLAY_URI "#"
32 #define LV2_INLINEDISPLAY__interface LV2_INLINEDISPLAY_PREFIX "interface"
33 #define LV2_INLINEDISPLAY__queue_draw LV2_INLINEDISPLAY_PREFIX "queue_draw"
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /** Opaque handle for LV2_Inline_Display::queue_draw() */
40 typedef void* LV2_Inline_Display_Handle;
41
42 /** raw image pixmap format is ARGB32,
43 * the data pointer is owned by the plugin and must be valid
44 * from the first call to render until cleanup.
45 */
46 typedef struct {
47 unsigned char *data;
48 int width;
49 int height;
50 int stride;
51 } LV2_Inline_Display_Image_Surface;
52
53 /** a LV2 Feature provided by the Host to the plugin
54 *
55 * This allows a the plugin during in realtime context to
56 * invalidate the currently displayed data and request from
57 * the host to call render() as soon as feasible.
58 */
59 typedef struct {
60 /** Opaque host data */
61 LV2_Inline_Display_Handle handle;
62 /** Request from run() that the host should call render() at a later
63 * time to update the inline display
64 */
65 void (*queue_draw)(LV2_Inline_Display_Handle handle);
66 } LV2_Inline_Display;
67
68 /**
69 * Plugin Inline-Display Interface.
70 */
71 typedef struct {
72 /**
73 * The render method. This is called by the host in the main GUI thread
74 * (non realtime, the context with access to graphics drawing APIs).
75 *
76 * The data pointer is owned by the plugin and must be valid
77 * from the first call to render until cleanup.
78 *
79 * The host specifies a maxium available area for the plugin to draw.
80 * the returned Image Surface contains the actual area which
81 * the plugin allocated.
82 *
83 * @param instance The LV2 instance
84 * @param w the max available width
85 * @param h the max available height
86 * @return pointer to a LV2_Inline_Display_Image_Surface or NULL
87 */
88 LV2_Inline_Display_Image_Surface* (*render)(
89 LV2_Handle instance,
90 uint32_t w, uint32_t h);
91 } LV2_Inline_Display_Interface;
92
93 #ifdef __cplusplus
94 } /* extern "C" */
95 #endif
96
97 #endif /* LV2_INLINE_DISPLAY_H */
98
99 /**
100 @}
101 */