summaryrefslogtreecommitdiff
path: root/ivi-shell/ivi-layout-export.h
blob: 41e1dee1dcaac50219d69136121bd3e7a90faded (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
/*
 * Copyright (C) 2013 DENSO CORPORATION
 *
 * Permission to use, copy, modify, distribute, and sell this software and
 * its documentation for any purpose is hereby granted without fee, provided
 * that the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of the copyright holders not be used in
 * advertising or publicity pertaining to distribution of the software
 * without specific, written prior permission.  The copyright holders make
 * no representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 *
 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

/**
 * The ivi-layout library supports API set of controlling properties of
 * surface and layer which groups surfaces. An unique ID whose type is integer
 * is required to create surface and layer. With the unique ID, surface and
 * layer are identified to control them. The API set consists of APIs to control
 * properties of surface and layers about followings,
 * - visibility.
 * - opacity.
 * - clipping (x,y,width,height).
 * - position and size of it to be displayed.
 * - orientation per 90 degree.
 * - add or remove surfaces to a layer.
 * - order of surfaces/layers in layer/screen to be displayed.
 * - commit to apply property changes.
 * - notifications of property change.
 *
 * Management of surfaces and layers grouping these surfaces are common way in
 * In-Vehicle Infotainment system, which integrate several domains in one system.
 * A layer is allocated to a domain in order to control application surfaces
 * grouped to the layer all together.
 */

#ifndef _IVI_LAYOUT_EXPORT_H_
#define _IVI_LAYOUT_EXPORT_H_

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include "compositor.h"
#include "ivi-layout.h"

enum ivi_layout_notification_mask {
    IVI_NOTIFICATION_NONE        = 0,
    IVI_NOTIFICATION_OPACITY     = (1 << 1),
    IVI_NOTIFICATION_SOURCE_RECT = (1 << 2),
    IVI_NOTIFICATION_DEST_RECT   = (1 << 3),
    IVI_NOTIFICATION_DIMENSION   = (1 << 4),
    IVI_NOTIFICATION_POSITION    = (1 << 5),
    IVI_NOTIFICATION_ORIENTATION = (1 << 6),
    IVI_NOTIFICATION_VISIBILITY  = (1 << 7),
    IVI_NOTIFICATION_PIXELFORMAT = (1 << 8),
    IVI_NOTIFICATION_ADD         = (1 << 9),
    IVI_NOTIFICATION_REMOVE      = (1 << 10),
    IVI_NOTIFICATION_ALL         = 0xFFFF
};

typedef void(*layerPropertyNotificationFunc)(struct ivi_layout_layer *ivilayer,
                                            struct ivi_layout_LayerProperties*,
                                            enum ivi_layout_notification_mask mask,
                                            void *userdata);

typedef void(*surfacePropertyNotificationFunc)(struct ivi_layout_surface *ivisurf,
                                            struct ivi_layout_SurfaceProperties*,
                                            enum ivi_layout_notification_mask mask,
                                            void *userdata);

typedef void(*layerCreateNotificationFunc)(struct ivi_layout_layer *ivilayer,
                                            void *userdata);

typedef void(*layerRemoveNotificationFunc)(struct ivi_layout_layer *ivilayer,
                                            void *userdata);

typedef void(*surfaceCreateNotificationFunc)(struct ivi_layout_surface *ivisurf,
                                            void *userdata);

typedef void(*surfaceRemoveNotificationFunc)(struct ivi_layout_surface *ivisurf,
                                            void *userdata);

typedef void(*surfaceConfigureNotificationFunc)(struct ivi_layout_surface *ivisurf,
                                            void *userdata);

typedef void(*ivi_controller_surface_content_callback)(struct ivi_layout_surface *ivisurf,
                                            int32_t content,
                                            void *userdata);

/**
 * \brief to be called by ivi-shell in order to set initail view of
 * weston_surface.
 */
/*
struct weston_view *
ivi_layout_get_weston_view(struct ivi_layout_surface *surface);
*/

/**
 * \brief initialize ivi-layout
 */
/*
void
ivi_layout_initWithCompositor(struct weston_compositor *ec);
*/

/**
 * \brief register for notification when layer is created
 */
int32_t
ivi_layout_addNotificationCreateLayer(layerCreateNotificationFunc callback,
                                      void *userdata);

void
ivi_layout_removeNotificationCreateLayer(layerCreateNotificationFunc callback,
                                         void *userdata);

/**
 * \brief register for notification when layer is removed
 */
int32_t
ivi_layout_addNotificationRemoveLayer(layerRemoveNotificationFunc callback,
                                      void *userdata);

void
ivi_layout_removeNotificationRemoveLayer(layerRemoveNotificationFunc callback,
                                         void *userdata);

/**
 * \brief register for notification when surface is created
 */
int32_t
ivi_layout_addNotificationCreateSurface(surfaceCreateNotificationFunc callback,
                                        void *userdata);

void
ivi_layout_removeNotificationCreateSurface(surfaceCreateNotificationFunc callback,
                                           void *userdata);

/**
 * \brief register for notification when surface is removed
 */
int32_t
ivi_layout_addNotificationRemoveSurface(surfaceRemoveNotificationFunc callback,
                                        void *userdata);

void
ivi_layout_removeNotificationRemoveSurface(surfaceRemoveNotificationFunc callback,
                                           void *userdata);

/**
 * \brief register for notification when surface is configured
 */
int32_t
ivi_layout_addNotificationConfigureSurface(surfaceConfigureNotificationFunc callback,
                                           void *userdata);

void
ivi_layout_removeNotificationConfigureSurface(surfaceConfigureNotificationFunc callback,
                                              void *userdata);

/**
 * \brief get id of surface from ivi_layout_surface
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
uint32_t
ivi_layout_getIdOfSurface(struct ivi_layout_surface *ivisurf);

/**
 * \brief get id of layer from ivi_layout_layer
 *
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
uint32_t
ivi_layout_getIdOfLayer(struct ivi_layout_layer *ivilayer);

/**
 * \brief get ivi_layout_layer from id of layer
 *
 * \return (struct ivi_layout_layer *)
 *              if the method call was successful
 * \return NULL if the method call was failed
 */
struct ivi_layout_layer *
ivi_layout_getLayerFromId(uint32_t id_layer);

/**
 * \brief get ivi_layout_surface from id of surface
 *
 * \return (struct ivi_layout_surface *)
 *              if the method call was successful
 * \return NULL if the method call was failed
 */
struct ivi_layout_surface *
ivi_layout_getSurfaceFromId(uint32_t id_surface);

/**
 * \brief get ivi_layout_screen from id of screen
 *
 * \return (struct ivi_layout_screen *)
 *              if the method call was successful
 * \return NULL if the method call was failed
 */
struct ivi_layout_screen *
ivi_layout_getScreenFromId(uint32_t id_screen);

/**
 * \brief Get the screen resolution of a specific screen
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_getScreenResolution(struct ivi_layout_screen *iviscrn,
                                  uint32_t *pWidth,
                                  uint32_t *pHeight);

/**
 * \brief register for notification on property changes of surface
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceAddNotification(struct ivi_layout_surface *ivisurf,
                                     surfacePropertyNotificationFunc callback,
                                     void *userdata);

/**
 * \brief remove notification on property changes of surface
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceRemoveNotification(struct ivi_layout_surface *ivisurf);

/**
 * \brief Create a surface
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
/*
struct ivi_layout_surface *
ivi_layout_surfaceCreate(struct weston_surface *wl_surface,
                            uint32_t id_surface);
*/

/**
 * \brief Set the native content of an application to be used as surface content.
 *        If wl_surface is NULL, remove the native content of a surface
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
/*
int32_t
ivi_layout_surfaceSetNativeContent(struct weston_surface *wl_surface,
                                      uint32_t width,
                                      uint32_t height,
                                      uint32_t id_surface);
*/

/**
 * \brief Set an observer callback for surface content status change.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceSetContentObserver(struct ivi_layout_surface *ivisurf,
                                     ivi_controller_surface_content_callback callback,
                                     void* userdata);

/**
 * \brief initialize ivi_layout_surface dest/source width and height
 */
/*
void
ivi_layout_surfaceConfigure(struct ivi_layout_surface *ivisurf,
                               uint32_t width, uint32_t height);
*/

/**
 * \brief Remove a surface
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceRemove(struct ivi_layout_surface *ivisurf);

/**
 * \brief Set from which kind of devices the surface can accept input events.
 * By default, a surface accept input events from all kind of devices (keyboards, pointer, ...)
 * By calling this function, you can adjust surface preferences. Note that this function only
 * adjust the acceptance for the specified devices. Non specified are keept untouched.
 *
 * Typicall use case for this function is when dealing with pointer or touch events.
 * Those are normally dispatched to the first visible surface below the coordinate.
 * If you want a different behavior (i.e. forward events to an other surface below the coordinate,
 * you can set all above surfaces to refuse input events)
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_UpdateInputEventAcceptanceOn(struct ivi_layout_surface *ivisurf,
                                           uint32_t devices,
                                           uint32_t acceptance);

/**
 * \brief  Get the layer properties
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_getPropertiesOfLayer(struct ivi_layout_layer *ivilayer,
                struct ivi_layout_LayerProperties *pLayerProperties);

/**
 * \brief  Get the number of hardware layers of a screen
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_getNumberOfHardwareLayers(uint32_t id_screen,
                                        uint32_t *pNumberOfHardwareLayers);

/**
 * \brief Get the screens
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_getScreens(uint32_t *pLength, struct ivi_layout_screen ***ppArray);

/**
 * \brief Get the screens under the given layer
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_getScreensUnderLayer(struct ivi_layout_layer *ivilayer,
                                   uint32_t *pLength,
                                   struct ivi_layout_screen ***ppArray);

/**
 * \brief Get all Layers which are currently registered and managed by the services
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_getLayers(uint32_t *pLength, struct ivi_layout_layer ***ppArray);

/**
 * \brief Get all Layers of the given screen
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_getLayersOnScreen(struct ivi_layout_screen *iviscrn,
                                uint32_t *pLength,
                                struct ivi_layout_layer ***ppArray);

/**
 * \brief Get all Layers under the given surface
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_getLayersUnderSurface(struct ivi_layout_surface *ivisurf,
                                    uint32_t *pLength,
                                    struct ivi_layout_layer ***ppArray);

/**
 * \brief Get all Surfaces which are currently registered and managed by the services
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_getSurfaces(uint32_t *pLength, struct ivi_layout_surface ***ppArray);

/**
 * \brief Get all Surfaces which are currently registered to a given layer and are managed by the services
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_getSurfacesOnLayer(struct ivi_layout_layer *ivilayer,
                                 uint32_t *pLength,
                                 struct ivi_layout_surface ***ppArray);

/**
 * \brief Create a layer which should be managed by the service
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
struct ivi_layout_layer *
ivi_layout_layerCreateWithDimension(uint32_t id_layer,
                                       uint32_t width, uint32_t height);

/**
 * \brief Removes a layer which is currently managed by the service
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerRemove(struct ivi_layout_layer *ivilayer);

/**
 * \brief Get the current type of the layer.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerGetType(struct ivi_layout_layer *ivilayer,
                           uint32_t *pLayerType);

/**
 * \brief Set the visibility of a layer. If a layer is not visible, the layer and its
 * surfaces will not be rendered.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerSetVisibility(struct ivi_layout_layer *ivilayer,
                                 uint32_t newVisibility);

/**
 * \brief Get the visibility of a layer. If a layer is not visible, the layer and its
 * surfaces will not be rendered.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerGetVisibility(struct ivi_layout_layer *ivilayer,
                                 uint32_t *pVisibility);

/**
 * \brief Set the opacity of a layer.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerSetOpacity(struct ivi_layout_layer *ivilayer, float opacity);

/**
 * \brief Get the opacity of a layer.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerGetOpacity(struct ivi_layout_layer *ivilayer, float *pOpacity);

/**
 * \brief Set the area of a layer which should be used for the rendering.
 *        Only this part will be visible.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerSetSourceRectangle(struct ivi_layout_layer *ivilayer,
                                      uint32_t x, uint32_t y,
                                      uint32_t width, uint32_t height);

/**
 * \brief Set the destination area on the display for a layer.
 *        The layer will be scaled and positioned to this rectangle for rendering
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerSetDestinationRectangle(struct ivi_layout_layer *ivilayer,
                                           int32_t x, int32_t y,
                                           uint32_t width, uint32_t height);

/**
 * \brief Get the horizontal and vertical dimension of the layer.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerGetDimension(struct ivi_layout_layer *ivilayer,
                                uint32_t *pDimension);

/**
 * \brief Set the horizontal and vertical dimension of the layer.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerSetDimension(struct ivi_layout_layer *ivilayer,
                                uint32_t *pDimension);

/**
 * \brief Get the horizontal and vertical position of the layer.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerGetPosition(struct ivi_layout_layer *ivilayer,
                               int32_t *pPosition);

/**
 * \brief Sets the horizontal and vertical position of the layer.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerSetPosition(struct ivi_layout_layer *ivilayer,
                               int32_t *pPosition);

/**
 * \brief Sets the orientation of a layer.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerSetOrientation(struct ivi_layout_layer *ivilayer,
                                  uint32_t orientation);

/**
 * \brief Gets the orientation of a layer.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerGetOrientation(struct ivi_layout_layer *ivilayer,
                                  uint32_t *pOrientation);

/**
 * \brief Sets the color value which defines the transparency value.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerSetChromaKey(struct ivi_layout_layer *ivilayer,
                                uint32_t* pColor);

/**
 * \brief Sets render order of surfaces within one layer
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerSetRenderOrder(struct ivi_layout_layer *ivilayer,
                                  struct ivi_layout_surface **pSurface,
                                  uint32_t number);

/**
 * \brief Get the capabilities of a layer
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerGetCapabilities(struct ivi_layout_layer *ivilayer,
                                   uint32_t *pCapabilities);

/**
 * \brief Get the possible capabilities of a layertype
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerTypeGetCapabilities(uint32_t layerType,
                                       uint32_t *pCapabilities);

/**
 * \brief Create the logical surface, which has no native buffer associated
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceInitialize(struct ivi_layout_surface **pSurface);

/**
 * \brief Set the visibility of a surface.
 *        If a surface is not visible it will not be rendered.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceSetVisibility(struct ivi_layout_surface *ivisurf,
                                   uint32_t newVisibility);

/**
 * \brief Get the visibility of a surface.
 *        If a surface is not visible it will not be rendered.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceGetVisibility(struct ivi_layout_surface *ivisurf,
                                   uint32_t *pVisibility);

/**
 * \brief Set the opacity of a surface.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceSetOpacity(struct ivi_layout_surface *ivisurf,
                                float opacity);

/**
 * \brief Get the opacity of a surface.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceGetOpacity(struct ivi_layout_surface *ivisurf,
                                float *pOpacity);

/**
 * \brief Set the keyboard focus on a certain surface
 * To receive keyboard events, 2 conditions must be fulfilled:
 *  1- The surface must accept events from keyboard. See ilm_UpdateInputEventAcceptanceOn
 *  2- The keyboard focus must be set on that surface
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_SetKeyboardFocusOn(struct ivi_layout_surface *ivisurf);

/**
 * \brief Get the indentifier of the surface which hold the keyboard focus
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_GetKeyboardFocusSurfaceId(struct ivi_layout_surface **pSurfaceId);

/**
 * \brief Set the destination area of a surface within a layer for rendering.
 *        The surface will be scaled to this rectangle for rendering.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceSetDestinationRectangle(struct ivi_layout_surface *ivisurf,
                                             int32_t x, int32_t y,
                                             uint32_t width, uint32_t height);

/**
 * \brief Set the horizontal and vertical dimension of the surface.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceSetDimension(struct ivi_layout_surface *ivisurf,
                                  uint32_t *pDimension);

/**
 * \brief Get the horizontal and vertical dimension of the surface.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceGetDimension(struct ivi_layout_surface *ivisurf,
                                  uint32_t *pDimension);

/**
 * \brief Sets the horizontal and vertical position of the surface.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceSetPosition(struct ivi_layout_surface *ivisurf,
                                 int32_t *pPosition);

/**
 * \brief Get the horizontal and vertical position of the surface.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceGetPosition(struct ivi_layout_surface *ivisurf,
                                 int32_t *pPosition);

/**
 * \brief Sets the orientation of a surface.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceSetOrientation(struct ivi_layout_surface *ivisurf,
                                    uint32_t orientation);

/**
 * \brief Gets the orientation of a surface.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceGetOrientation(struct ivi_layout_surface *ivisurf,
                                    uint32_t *pOrientation);

/**
 * \brief Gets the pixelformat of a surface.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceGetPixelformat(struct ivi_layout_layer *ivisurf,
                                    uint32_t *pPixelformat);

/**
 * \brief Sets the color value which defines the transparency value of a surface.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceSetChromaKey(struct ivi_layout_surface *ivisurf,
                                  uint32_t* pColor);

/**
 * \brief Add a layer to a screen which is currently managed by the service
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_screenAddLayer(struct ivi_layout_screen *iviscrn,
                             struct ivi_layout_layer *addlayer);

/**
 * \brief Sets render order of layers on a display
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_screenSetRenderOrder(struct ivi_layout_screen *iviscrn,
                                   struct ivi_layout_layer **pLayer,
                                   const uint32_t number);

/**
 * \brief Take a screenshot from the current displayed layer scene.
 * The screenshot is saved as bmp file with the corresponding filename.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_takeScreenshot(struct ivi_layout_screen *iviscrn,
                             const char *filename);

/**
 * \brief Take a screenshot of a certain layer
 * The screenshot is saved as bmp file with the corresponding filename.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_takeLayerScreenshot(const char *filename,
                                  struct ivi_layout_layer *ivilayer);

/**
 * \brief Take a screenshot of a certain surface
 * The screenshot is saved as bmp file with the corresponding filename.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_takeSurfaceScreenshot(const char *filename,
                                    struct ivi_layout_surface *ivisurf);

/**
 * \brief Enable or disable a rendering optimization
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_SetOptimizationMode(uint32_t id, uint32_t mode);

/**
 * \brief Get the current enablement for an optimization
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_GetOptimizationMode(uint32_t id, uint32_t *pMode);

/**
 * \brief register for notification on property changes of layer
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerAddNotification(struct ivi_layout_layer *ivilayer,
                                   layerPropertyNotificationFunc callback,
                                   void *userdata);

/**
 * \brief remove notification on property changes of layer
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerRemoveNotification(struct ivi_layout_layer *ivilayer);

/**
 * \brief Get the surface properties
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_getPropertiesOfSurface(struct ivi_layout_surface *ivisurf,
                struct ivi_layout_SurfaceProperties *pSurfaceProperties);

/**
 * \brief Add a surface to a layer which is currently managed by the service
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerAddSurface(struct ivi_layout_layer *ivilayer,
                              struct ivi_layout_surface *addsurf);

/**
 * \brief Removes a surface from a layer which is currently managed by the service
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_layerRemoveSurface(struct ivi_layout_layer *ivilayer,
                                 struct ivi_layout_surface *remsurf);

/**
 * \brief Set the area of a surface which should be used for the rendering.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_surfaceSetSourceRectangle(struct ivi_layout_surface *ivisurf,
                                        uint32_t x, uint32_t y,
                                        uint32_t width, uint32_t height);

/**
 * \brief Commit all changes and execute all enqueued commands since last commit.
 *
 * \return  0 if the method call was successful
 * \return -1 if the method call was failed
 */
int32_t
ivi_layout_commitChanges(void);

#ifdef __cplusplus
} /**/
#endif /* __cplusplus */

#endif /* _IVI_LAYOUT_EXPORT_H_ */