6dc84f0470d8c5e14baa74979dcefee71d131761
[platform/core/uifw/libpui.git] / include / PUI_backend.h
1 /*
2  * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial
14  * portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  */
25
26 #ifndef _LIBPUI_BACKEND_H_
27 #define _LIBPUI_BACKEND_H_
28
29 #include "PUI_common.h"
30
31 #define PUI_BACKEND_ABI_MAJOR_MASK      0xFFFF0000
32 #define PUI_BACKEND_ABI_MINOR_MASK      0x0000FFFF
33
34 #define PUI_BACKEND_GET_ABI_MAJOR(m)    (((m) & PUI_BACKEND_ABI_MAJOR_MASK) >> 16)
35 #define PUI_BACKEND_GET_ABI_MINOR(m)    ((m) & PUI_BACKEND_ABI_MINOR_MASK)
36
37 #define PUI_BACKEND_SET_ABI_VERSION(major, minor)       \
38                 ((((major) << 16) & PUI_BACKEND_ABI_MAJOR_MASK) | ((minor) & PUI_BACKEND_ABI_MINOR_MASK))
39
40 #define PUI_BACKEND_ABI_VERSION_1_0             PUI_BACKEND_SET_ABI_VERSION(1, 0)
41 #define PUI_BACKEND_AB_VERSION_LAST     PUI_BACKEND_ABI_VERSION_1_0
42
43 typedef struct _pui_backend_ani_func pui_backend_ani_func;
44 struct _pui_backend_ani_func
45 {
46         pui_error (*ani_start)(pui_ani_t *ani, int repeat);
47         pui_error (*ani_stop)(pui_ani_t *ani, pui_bool force);
48
49         void (*reserved1)(void);
50         void (*reserved2)(void);
51         void (*reserved3)(void);
52         void (*reserved4)(void);
53         void (*reserved5)(void);
54 };
55
56 typedef void pui_backend_ani_info;
57
58 struct _pui_backend_ani_data
59 {
60         pui_backend_ani_func *ani_func;
61         pui_backend_ani_info *ani_info;
62 };
63
64 struct _pui_backend_module_data
65 {
66         void *data;
67
68         pui_int_error (*create_ani_collection)(void);
69         pui_bool (*geometry_get)(int *width, int *height);
70         pui_backend_ani_data *(*ani_create)(pui_id id);
71         void (*ani_destroy)(pui_backend_ani_data *ani_data);
72
73         void (*reserved1)(void);
74         void (*reserved2)(void);
75         void (*reserved3)(void);
76         void (*reserved4)(void);
77         void (*reserved5)(void);
78 };
79
80 struct _pui_backend_module
81 {
82         const char *name;                       /**< The name of a backend module */
83         const char *vendor;             /**< The vendor name of a backend module */
84         unsigned long abi_version;      /**< The API version of a backend module */
85
86         pui_backend_module_data *(*backend_init)(void);
87         void (*backend_deinit)(pui_backend_module_data *backend_data);
88 };
89
90 #ifdef __cplusplus
91 extern "C" {
92 #endif
93
94 pui_ani_control_buffer *
95 pui_backend_ani_get_buffer(pui_ani_t *ani);
96
97 pui_int_error
98 pui_backend_ani_set_buffer(pui_ani_t *ani, pui_ani_control_buffer *buffer);
99
100 pui_int_error
101 pui_backend_ani_update(pui_ani_t *ani);
102
103 pui_bool
104 pui_backend_ani_add_frame_cb(pui_ani_t *ani, pui_bool (*frame_cb)(void *data, int serial), double frame_interval);
105
106 void
107 pui_backend_ani_remove_frame_cb(pui_ani_t *ani);
108
109 void
110 pui_backend_ani_status_update(pui_ani_t *ani, pui_ani_status status);
111
112 pui_backend_ani_func *
113 pui_backend_ani_alloc_ani_func(void);
114
115 void
116 pui_backend_ani_free_ani_func(pui_backend_ani_func *func);
117
118 pui_backend_ani_data *
119 pui_backend_ani_get_ani_data(pui_ani_t *ani);
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif//_LIBPUI_BACKEND_H_