2 * Copyright (C) 2013 DENSO CORPORATION
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.
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.
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,
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.
39 * Management of surfaces and layers grouping these surfaces are common
40 * way in In-Vehicle Infotainment system, which integrate several domains
41 * in one system. A layer is allocated to a domain in order to control
42 * application surfaces grouped to the layer all together.
44 * This API and ABI follow following specifications.
45 * http://projects.genivi.org/wayland-ivi-extension/layer-manager-apis
48 #ifndef _IVI_LAYOUT_EXPORT_H_
49 #define _IVI_LAYOUT_EXPORT_H_
53 #endif /* __cplusplus */
56 #include "compositor.h"
58 #define IVI_SUCCEEDED (0)
59 #define IVI_FAILED (-1)
61 struct ivi_layout_layer;
62 struct ivi_layout_screen;
63 struct ivi_layout_surface;
65 struct ivi_layout_surface_properties
71 int32_t source_height;
80 enum wl_output_transform orientation;
82 int32_t transition_type;
83 uint32_t transition_duration;
86 struct ivi_layout_layer_properties
92 int32_t source_height;
97 enum wl_output_transform orientation;
99 int32_t transition_type;
100 uint32_t transition_duration;
106 enum ivi_layout_notification_mask {
107 IVI_NOTIFICATION_NONE = 0,
108 IVI_NOTIFICATION_OPACITY = (1 << 1),
109 IVI_NOTIFICATION_SOURCE_RECT = (1 << 2),
110 IVI_NOTIFICATION_DEST_RECT = (1 << 3),
111 IVI_NOTIFICATION_DIMENSION = (1 << 4),
112 IVI_NOTIFICATION_POSITION = (1 << 5),
113 IVI_NOTIFICATION_ORIENTATION = (1 << 6),
114 IVI_NOTIFICATION_VISIBILITY = (1 << 7),
115 IVI_NOTIFICATION_PIXELFORMAT = (1 << 8),
116 IVI_NOTIFICATION_ADD = (1 << 9),
117 IVI_NOTIFICATION_REMOVE = (1 << 10),
118 IVI_NOTIFICATION_CONFIGURE = (1 << 11),
119 IVI_NOTIFICATION_ALL = 0xFFFF
122 enum ivi_layout_transition_type{
123 IVI_LAYOUT_TRANSITION_NONE,
124 IVI_LAYOUT_TRANSITION_VIEW_DEFAULT,
125 IVI_LAYOUT_TRANSITION_VIEW_DEST_RECT_ONLY,
126 IVI_LAYOUT_TRANSITION_VIEW_FADE_ONLY,
127 IVI_LAYOUT_TRANSITION_LAYER_FADE,
128 IVI_LAYOUT_TRANSITION_LAYER_MOVE,
129 IVI_LAYOUT_TRANSITION_LAYER_VIEW_ORDER,
130 IVI_LAYOUT_TRANSITION_VIEW_MOVE_RESIZE,
131 IVI_LAYOUT_TRANSITION_VIEW_RESIZE,
132 IVI_LAYOUT_TRANSITION_VIEW_FADE,
133 IVI_LAYOUT_TRANSITION_MAX,
136 typedef void (*layer_property_notification_func)(
137 struct ivi_layout_layer *ivilayer,
138 const struct ivi_layout_layer_properties *,
139 enum ivi_layout_notification_mask mask,
142 typedef void (*surface_property_notification_func)(
143 struct ivi_layout_surface *ivisurf,
144 const struct ivi_layout_surface_properties *,
145 enum ivi_layout_notification_mask mask,
148 typedef void (*layer_create_notification_func)(
149 struct ivi_layout_layer *ivilayer,
152 typedef void (*layer_remove_notification_func)(
153 struct ivi_layout_layer *ivilayer,
156 typedef void (*surface_create_notification_func)(
157 struct ivi_layout_surface *ivisurf,
160 typedef void (*surface_remove_notification_func)(
161 struct ivi_layout_surface *ivisurf,
164 typedef void (*surface_configure_notification_func)(
165 struct ivi_layout_surface *ivisurf,
168 typedef void (*ivi_controller_surface_content_callback)(
169 struct ivi_layout_surface *ivisurf,
174 * \brief register for notification when layer is created
177 ivi_layout_add_notification_create_layer(
178 layer_create_notification_func callback,
182 ivi_layout_remove_notification_create_layer(
183 layer_create_notification_func callback,
187 * \brief register for notification when layer is removed
190 ivi_layout_add_notification_remove_layer(
191 layer_remove_notification_func callback,
195 ivi_layout_remove_notification_remove_layer(
196 layer_remove_notification_func callback,
200 * \brief register for notification when surface is created
203 ivi_layout_add_notification_create_surface(
204 surface_create_notification_func callback,
208 ivi_layout_remove_notification_create_surface(
209 surface_create_notification_func callback,
213 * \brief register for notification when surface is removed
216 ivi_layout_add_notification_remove_surface(
217 surface_remove_notification_func callback,
221 ivi_layout_remove_notification_remove_surface(
222 surface_remove_notification_func callback,
226 * \brief register for notification when surface is configured
229 ivi_layout_add_notification_configure_surface(
230 surface_configure_notification_func callback,
234 ivi_layout_remove_notification_configure_surface(
235 surface_configure_notification_func callback,
239 * \brief get id of surface from ivi_layout_surface
241 * \return id of surface
244 ivi_layout_get_id_of_surface(struct ivi_layout_surface *ivisurf);
247 * \brief get id of layer from ivi_layout_layer
250 * \return id of layer
253 ivi_layout_get_id_of_layer(struct ivi_layout_layer *ivilayer);
256 * \brief get ivi_layout_surface from id of surface
258 * \return (struct ivi_layout_surface *)
259 * if the method call was successful
260 * \return NULL if the method call was failed
262 struct ivi_layout_surface *
263 ivi_layout_get_surface_from_id(uint32_t id_surface);
266 * \brief get ivi_layout_screen from id of screen
268 * \return (struct ivi_layout_screen *)
269 * if the method call was successful
270 * \return NULL if the method call was failed
272 struct ivi_layout_screen *
273 ivi_layout_get_screen_from_id(uint32_t id_screen);
276 * \brief Get the screen resolution of a specific screen
278 * \return IVI_SUCCEEDED if the method call was successful
279 * \return IVI_FAILED if the method call was failed
282 ivi_layout_get_screen_resolution(struct ivi_layout_screen *iviscrn,
287 * \brief Set an observer callback for surface content status change.
289 * \return IVI_SUCCEEDED if the method call was successful
290 * \return IVI_FAILED if the method call was failed
293 ivi_layout_surface_set_content_observer(
294 struct ivi_layout_surface *ivisurf,
295 ivi_controller_surface_content_callback callback,
299 * \brief Get the layer properties
301 * \return (const struct ivi_layout_layer_properties *)
302 * if the method call was successful
303 * \return NULL if the method call was failed
305 const struct ivi_layout_layer_properties *
306 ivi_layout_get_properties_of_layer(struct ivi_layout_layer *ivilayer);
309 * \brief Get the screens
311 * \return IVI_SUCCEEDED if the method call was successful
312 * \return IVI_FAILED if the method call was failed
315 ivi_layout_get_screens(int32_t *pLength, struct ivi_layout_screen ***ppArray);
318 * \brief Get the screens under the given layer
320 * \return IVI_SUCCEEDED if the method call was successful
321 * \return IVI_FAILED if the method call was failed
324 ivi_layout_get_screens_under_layer(struct ivi_layout_layer *ivilayer,
326 struct ivi_layout_screen ***ppArray);
329 * \brief Get all Layers which are currently registered and managed
332 * \return IVI_SUCCEEDED if the method call was successful
333 * \return IVI_FAILED if the method call was failed
336 ivi_layout_get_layers(int32_t *pLength, struct ivi_layout_layer ***ppArray);
339 * \brief Get all Layers under the given surface
341 * \return IVI_SUCCEEDED if the method call was successful
342 * \return IVI_FAILED if the method call was failed
345 ivi_layout_get_layers_under_surface(struct ivi_layout_surface *ivisurf,
347 struct ivi_layout_layer ***ppArray);
350 * \brief Get all Surfaces which are currently registered and managed
353 * \return IVI_SUCCEEDED if the method call was successful
354 * \return IVI_FAILED if the method call was failed
357 ivi_layout_get_surfaces(int32_t *pLength, struct ivi_layout_surface ***ppArray);
360 * \brief Create a layer which should be managed by the service
362 * \return (struct ivi_layout_layer *)
363 * if the method call was successful
364 * \return NULL if the method call was failed
366 struct ivi_layout_layer *
367 ivi_layout_layer_create_with_dimension(uint32_t id_layer,
368 int32_t width, int32_t height);
371 * \brief Removes a layer which is currently managed by the service
374 ivi_layout_layer_remove(struct ivi_layout_layer *ivilayer);
377 * \brief Set the visibility of a layer. If a layer is not visible, the
378 * layer and its surfaces will not be rendered.
380 * \return IVI_SUCCEEDED if the method call was successful
381 * \return IVI_FAILED if the method call was failed
384 ivi_layout_layer_set_visibility(struct ivi_layout_layer *ivilayer,
388 * \brief Set the opacity of a layer.
390 * \return IVI_SUCCEEDED if the method call was successful
391 * \return IVI_FAILED if the method call was failed
394 ivi_layout_layer_set_opacity(struct ivi_layout_layer *ivilayer,
398 * \brief Get the opacity of a layer.
400 * \return opacity if the method call was successful
401 * \return wl_fixed_from_double(0.0) if the method call was failed
404 ivi_layout_layer_get_opacity(struct ivi_layout_layer *ivilayer);
407 * \brief Set the area of a layer which should be used for the rendering.
409 * Only this part will be visible.
411 * \return IVI_SUCCEEDED if the method call was successful
412 * \return IVI_FAILED if the method call was failed
415 ivi_layout_layer_set_source_rectangle(struct ivi_layout_layer *ivilayer,
416 int32_t x, int32_t y,
417 int32_t width, int32_t height);
420 * \brief Set the destination area on the display for a layer.
422 * The layer will be scaled and positioned to this rectangle
425 * \return IVI_SUCCEEDED if the method call was successful
426 * \return IVI_FAILED if the method call was failed
429 ivi_layout_layer_set_destination_rectangle(struct ivi_layout_layer *ivilayer,
430 int32_t x, int32_t y,
431 int32_t width, int32_t height);
434 * \brief Get the horizontal and vertical position of the layer.
436 * \return IVI_SUCCEEDED if the method call was successful
437 * \return IVI_FAILED if the method call was failed
440 ivi_layout_layer_get_position(struct ivi_layout_layer *ivilayer,
441 int32_t *dest_x, int32_t *dest_y);
444 * \brief Sets the horizontal and vertical position of the layer.
446 * \return IVI_SUCCEEDED if the method call was successful
447 * \return IVI_FAILED if the method call was failed
450 ivi_layout_layer_set_position(struct ivi_layout_layer *ivilayer,
451 int32_t dest_x, int32_t dest_y);
454 * \brief Sets the orientation of a layer.
456 * \return IVI_SUCCEEDED if the method call was successful
457 * \return IVI_FAILED if the method call was failed
460 ivi_layout_layer_set_orientation(struct ivi_layout_layer *ivilayer,
461 enum wl_output_transform orientation);
464 * \brief Sets render order of surfaces within one layer
466 * \return IVI_SUCCEEDED if the method call was successful
467 * \return IVI_FAILED if the method call was failed
470 ivi_layout_layer_set_render_order(struct ivi_layout_layer *ivilayer,
471 struct ivi_layout_surface **pSurface,
475 * \brief Set the visibility of a surface.
477 * If a surface is not visible it will not be rendered.
479 * \return IVI_SUCCEEDED if the method call was successful
480 * \return IVI_FAILED if the method call was failed
483 ivi_layout_surface_set_visibility(struct ivi_layout_surface *ivisurf,
487 * \brief Get the visibility of a surface.
489 * If a surface is not visible it will not be rendered.
491 * \return true if surface is visible
492 * \return false if surface is invisible or the method call was failed
495 ivi_layout_surface_get_visibility(struct ivi_layout_surface *ivisurf);
498 * \brief Set the opacity of a surface.
500 * \return IVI_SUCCEEDED if the method call was successful
501 * \return IVI_FAILED if the method call was failed
504 ivi_layout_surface_set_opacity(struct ivi_layout_surface *ivisurf,
508 * \brief Get the opacity of a surface.
510 * \return opacity if the method call was successful
511 * \return wl_fixed_from_double(0.0) if the method call was failed
514 ivi_layout_surface_get_opacity(struct ivi_layout_surface *ivisurf);
517 * \brief Set the destination area of a surface within a layer for rendering.
519 * The surface will be scaled to this rectangle for rendering.
521 * \return IVI_SUCCEEDED if the method call was successful
522 * \return IVI_FAILED if the method call was failed
525 ivi_layout_surface_set_destination_rectangle(struct ivi_layout_surface *ivisurf,
526 int32_t x, int32_t y,
527 int32_t width, int32_t height);
530 * \brief Sets the orientation of a surface.
532 * \return IVI_SUCCEEDED if the method call was successful
533 * \return IVI_FAILED if the method call was failed
536 ivi_layout_surface_set_orientation(struct ivi_layout_surface *ivisurf,
537 enum wl_output_transform orientation);
540 * \brief Add a layer to a screen which is currently managed by the service
542 * \return IVI_SUCCEEDED if the method call was successful
543 * \return IVI_FAILED if the method call was failed
546 ivi_layout_screen_add_layer(struct ivi_layout_screen *iviscrn,
547 struct ivi_layout_layer *addlayer);
550 * \brief Sets render order of layers on a display
552 * \return IVI_SUCCEEDED if the method call was successful
553 * \return IVI_FAILED if the method call was failed
556 ivi_layout_screen_set_render_order(struct ivi_layout_screen *iviscrn,
557 struct ivi_layout_layer **pLayer,
558 const int32_t number);
561 * \brief register for notification on property changes of layer
563 * \return IVI_SUCCEEDED if the method call was successful
564 * \return IVI_FAILED if the method call was failed
567 ivi_layout_layer_add_notification(struct ivi_layout_layer *ivilayer,
568 layer_property_notification_func callback,
572 * \brief remove notification on property changes of layer
575 ivi_layout_layer_remove_notification(struct ivi_layout_layer *ivilayer);
578 * \brief register for notification on property changes of surface
580 * \return IVI_SUCCEEDED if the method call was successful
581 * \return IVI_FAILED if the method call was failed
584 ivi_layout_surface_add_notification(struct ivi_layout_surface *ivisurf,
585 surface_property_notification_func callback,
589 * \brief remove notification on property changes of surface
592 ivi_layout_surface_remove_notification(struct ivi_layout_surface *ivisurf);
595 * \brief Get the surface properties
597 * \return (const struct ivi_surface_layer_properties *)
598 * if the method call was successful
599 * \return NULL if the method call was failed
601 const struct ivi_layout_surface_properties *
602 ivi_layout_get_properties_of_surface(struct ivi_layout_surface *ivisurf);
605 * \brief Add a surface to a layer which is currently managed by the service
607 * \return IVI_SUCCEEDED if the method call was successful
608 * \return IVI_FAILED if the method call was failed
611 ivi_layout_layer_add_surface(struct ivi_layout_layer *ivilayer,
612 struct ivi_layout_surface *addsurf);
615 * \brief Removes a surface from a layer which is currently managed by the service
618 ivi_layout_layer_remove_surface(struct ivi_layout_layer *ivilayer,
619 struct ivi_layout_surface *remsurf);
622 * \brief Set the area of a surface which should be used for the rendering.
624 * \return IVI_SUCCEEDED if the method call was successful
625 * \return IVI_FAILED if the method call was failed
628 ivi_layout_surface_set_source_rectangle(struct ivi_layout_surface *ivisurf,
629 int32_t x, int32_t y,
630 int32_t width, int32_t height);
633 * \brief get weston_output from ivi_layout_screen.
635 * \return (struct weston_output *)
636 * if the method call was successful
637 * \return NULL if the method call was failed
639 struct weston_output *
640 ivi_layout_screen_get_output(struct ivi_layout_screen *);
642 struct weston_surface *
643 ivi_layout_surface_get_weston_surface(struct ivi_layout_surface *ivisurf);
646 ivi_layout_layer_set_transition(struct ivi_layout_layer *ivilayer,
647 enum ivi_layout_transition_type type,
651 ivi_layout_layer_set_fade_info(struct ivi_layout_layer* layer,
653 double start_alpha, double end_alpha);
656 ivi_layout_surface_set_transition(struct ivi_layout_surface *ivisurf,
657 enum ivi_layout_transition_type type,
661 ivi_layout_transition_layer_render_order(struct ivi_layout_layer* layer,
662 struct ivi_layout_surface** new_order,
663 uint32_t surface_num,
667 ivi_layout_transition_move_layer_cancel(struct ivi_layout_layer* layer);
670 * \brief Commit all changes and execute all enqueued commands since
673 * \return IVI_SUCCEEDED if the method call was successful
674 * \return IVI_FAILED if the method call was failed
677 ivi_layout_commit_changes(void);
681 #endif /* __cplusplus */
683 #endif /* _IVI_LAYOUT_EXPORT_H_ */