downstream: ivi-controller: consitent use of opacity
[profile/ivi/wayland-ivi-extension.git] / weston-ivi-shell / src / ivi-layout.h
1 /*
2  * Copyright (C) 2013 DENSO CORPORATION
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and
5  * its documentation for any purpose is hereby granted without fee, provided
6  * that the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation, and that the name of the copyright holders not be used in
9  * advertising or publicity pertaining to distribution of the software
10  * without specific, written prior permission.  The copyright holders make
11  * no representations about the suitability of this software for any
12  * purpose.  It is provided "as is" without express or implied warranty.
13  *
14  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
15  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
16  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
17  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
18  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
19  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  */
22
23 /**
24  * The ivi-layout library supports API set of controlling properties of
25  * surface and layer which groups surfaces. An unique ID whose type is integer
26  * is required to create surface and layer. With the unique ID, surface and
27  * layer are identified to control them. The API set consists of APIs to control
28  * properties of surface and layers about followings,
29  * - visibility.
30  * - opacity.
31  * - clipping (x,y,width,height).
32  * - position and size of it to be displayed.
33  * - orientation per 90 degree.
34  * - add or remove surfaces to a layer.
35  * - order of surfaces/layers in layer/screen to be displayed.
36  * - commit to apply property changes.
37  * - notifications of property change.
38  *
39  * Management of surfaces and layers grouping these surfaces are common way in
40  * In-Vehicle Infotainment system, which integrate several domains in one system.
41  * A layer is allocated to a domain in order to control application surfaces
42  * grouped to the layer all together.
43  */
44
45 #ifndef _IVI_LAYOUT_H_
46 #define _IVI_LAYOUT_H_
47
48 #ifdef __cplusplus
49 extern "C" {
50 #endif /* __cplusplus */
51
52 #include "compositor.h"
53
54 struct ivi_layout_surface;
55 struct ivi_layout_layer;
56 struct ivi_layout_screen;
57
58 struct ivi_layout_SurfaceProperties
59 {
60     float    opacity;
61     uint32_t sourceX;
62     uint32_t sourceY;
63     uint32_t sourceWidth;
64     uint32_t sourceHeight;
65     uint32_t origSourceWidth;
66     uint32_t origSourceHeight;
67     int32_t  startX;
68     int32_t  startY;
69     uint32_t startWidth;
70     uint32_t startHeight;
71     int32_t  destX;
72     int32_t  destY;
73     uint32_t destWidth;
74     uint32_t destHeight;
75     uint32_t orientation;
76     uint32_t visibility;
77     uint32_t frameCounter;
78     uint32_t drawCounter;
79     uint32_t updateCounter;
80     uint32_t pixelformat;
81     uint32_t nativeSurface;
82     uint32_t inputDevicesAcceptance;
83     uint32_t chromaKeyEnabled;
84     uint32_t chromaKeyRed;
85     uint32_t chromaKeyGreen;
86     uint32_t chromaKeyBlue;
87     int32_t  creatorPid;
88     int32_t  transitionType;
89     uint32_t transitionDuration;
90     uint32_t hasKeyboardFocus;
91 };
92
93 struct ivi_layout_LayerProperties
94 {
95     float    opacity;
96     uint32_t sourceX;
97     uint32_t sourceY;
98     uint32_t sourceWidth;
99     uint32_t sourceHeight;
100     uint32_t origSourceWidth;
101     uint32_t origSourceHeight;
102     int32_t  destX;
103     int32_t  destY;
104     uint32_t destWidth;
105     uint32_t destHeight;
106     uint32_t orientation;
107     uint32_t visibility;
108     uint32_t type;
109     uint32_t chromaKeyEnabled;
110     uint32_t chromaKeyRed;
111     uint32_t chromaKeyGreen;
112     uint32_t chromaKeyBlue;
113     int32_t  creatorPid;
114     int32_t  transitionType;
115     uint32_t transitionDuration;
116     double   startAlpha;
117     double   endAlpha;
118     uint32_t isFadeIn;
119 };
120
121 enum ivi_layout_warning_flag {
122     IVI_WARNING_INVALID_WL_SURFACE,
123     IVI_WARNING_IVI_ID_IN_USE
124 };
125
126 struct ivi_layout_interface {
127         struct weston_view* (*get_weston_view)(struct ivi_layout_surface *surface);
128         void (*surfaceConfigure)(struct ivi_layout_surface *ivisurf,
129                                  int32_t width, int32_t height);
130         int32_t (*surfaceSetNativeContent)(struct weston_surface *wl_surface,
131                                            int32_t width,
132                                            int32_t height,
133                                            uint32_t id_surface);
134         struct ivi_layout_surface* (*surfaceCreate)(struct weston_surface *wl_surface,
135                                                               uint32_t id_surface);
136         void (*initWithCompositor)(struct weston_compositor *ec);
137         void (*emitWarningSignal)(uint32_t id_surface,
138                                 enum ivi_layout_warning_flag flag);
139 };
140
141 WL_EXPORT struct ivi_layout_interface ivi_layout_interface;
142
143 #ifdef __cplusplus
144 } /**/
145 #endif /* __cplusplus */
146
147 #endif /* _IVI_LAYOUT_H_ */