summaryrefslogtreecommitdiff
path: root/src/lib/ecore_buffer/Ecore_Buffer.h
blob: 36c82daad7c992825bddb06bd056fb15a17e3ba8 (plain) (blame)
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
#ifndef _ECORE_BUFFER_H_
# define _ECORE_BUFFER_H_

#ifdef EAPI
# undef EAPI
#endif

#ifdef _WIN32
# ifdef EFL_ECORE_BUFFER_BUILD
#  ifdef DLL_EXPORT
#   define EAPI __declspec(dllexport)
#  else
#   define EAPI
#  endif /* ! DLL_EXPORT */
# else
#  define EAPI __declspec(dllimport)
# endif /* ! EFL_ECORE_BUFFER_BUILD */
#else
# ifdef __GNUC__
#  if __GNUC__ >= 4
#   define EAPI __attribute__ ((visibility("default")))
#  else
#   define EAPI
#  endif
# else
#  define EAPI
# endif
#endif /* ! _WIN32 */

/**
 * @defgroup Ecore_Buffer_Group Ecore_Buffer - Graphics buffer functions
 * @ingroup Ecore
 *
 * The Ecore Buffer is an abstraction of graphic buffer.
 *
 * This library also provides simple mechanisms for sharing graphic buffer bet-
 * ween processes using wayland socket. Ecore Buffer Queue is for this
 * function, and it consists of two main object,
 * The Ecore_Buffer_Consumer and the Ecore_Buffer_Provider.
 */

#ifdef __cplusplus
extern "C" {
#endif

#define __ecore_buffer_fourcc_code(a,b,c,d) ((unsigned int)(a) | ((unsigned int)(b) << 8) | \
                  ((unsigned int)(c) << 16) | ((unsigned int)(d) << 24))

/* color index */
/**
 * @brief Definition for the Ecore_Buffer format C8 ([7:0] C).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_C8       __ecore_buffer_fourcc_code('C', '8', ' ', ' ')
/* 8 bpp RGB */
/**
 * @brief Definition for the Ecore_Buffer format RGB332 ([7:0] R:G:B 3:3:2).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_RGB332   __ecore_buffer_fourcc_code('R', 'G', 'B', '8')
/**
 * @brief Definition for the Ecore_Buffer format RGB233 ([7:0] B:G:R 2:3:3).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_BGR233   __ecore_buffer_fourcc_code('B', 'G', 'R', '8')
/* 16 bpp RGB */
/**
 * @brief Definition for the Ecore_Buffer format XRGB4444 ([15:0] x:R:G:B 4:4:4:4 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_XRGB4444 __ecore_buffer_fourcc_code('X', 'R', '1', '2')
/**
 * @brief Definition for the Ecore_Buffer format XBRG4444 ([15:0] x:B:G:R 4:4:4:4 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_XBGR4444 __ecore_buffer_fourcc_code('X', 'B', '1', '2')
/**
 * @brief Definition for the Ecore_Buffer format RGBX4444 ([15:0] R:G:B:x 4:4:4:4 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_RGBX4444 __ecore_buffer_fourcc_code('R', 'X', '1', '2')
/**
 * @brief Definition for the Ecore_Buffer format BGRX4444 ([15:0] B:G:R:x 4:4:4:4 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_BGRX4444 __ecore_buffer_fourcc_code('B', 'X', '1', '2')
/**
 * @brief Definition for the Ecore_Buffer format ARGB4444 ([15:0] A:R:G:B 4:4:4:4 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_ARGB4444 __ecore_buffer_fourcc_code('A', 'R', '1', '2')
/**
 * @brief Definition for the Ecore_Buffer format ABGR4444 ([15:0] A:B:G:R 4:4:4:4 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_ABGR4444 __ecore_buffer_fourcc_code('A', 'B', '1', '2')
/**
 * @brief Definition for the Ecore_Buffer format RGBA4444 ([15:0] R:G:B:A 4:4:4:4 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_RGBA4444 __ecore_buffer_fourcc_code('R', 'A', '1', '2')
/**
 * @brief Definition for the Ecore_Buffer format BGRA4444 ([15:0] B:G:R:A 4:4:4:4 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_BGRA4444 __ecore_buffer_fourcc_code('B', 'A', '1', '2')
/**
 * @brief Definition for the Ecore_Buffer format XRGB1555 ([15:0] x:R:G:B 1:5:5:5 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_XRGB1555 __ecore_buffer_fourcc_code('X', 'R', '1', '5')
/**
 * @brief Definition for the Ecore_Buffer format XBGR1555 ([15:0] x:B:G:R 1:5:5:5 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_XBGR1555 __ecore_buffer_fourcc_code('X', 'B', '1', '5')
/**
 * @brief Definition for the Ecore_Buffer format RGBX5551 ([15:0] R:G:B:x 5:5:5:1 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_RGBX5551 __ecore_buffer_fourcc_code('R', 'X', '1', '5')
/**
 * @brief Definition for the Ecore_Buffer format BGRX5551 ([15:0] B:G:R:x 5:5:5:1 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_BGRX5551 __ecore_buffer_fourcc_code('B', 'X', '1', '5')
/**
 * @brief Definition for the Ecore_Buffer format ARGB1555 ([15:0] A:R:G:B 1:5:5:5 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_ARGB1555 __ecore_buffer_fourcc_code('A', 'R', '1', '5')
/**
 * @brief Definition for the Ecore_Buffer format ABGR1555 ([15:0] A:B:G:R 1:5:5:5 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_ABGR1555 __ecore_buffer_fourcc_code('A', 'B', '1', '5')
/**
 * @brief Definition for the Ecore_Buffer format RGBA5551 ([15:0] R:G:B:A 5:5:5:1 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_RGBA5551 __ecore_buffer_fourcc_code('R', 'A', '1', '5')
/**
 * @brief Definition for the Ecore_Buffer format BGRA5551 ([15:0] B:G:R:A 5:5:5:1 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_BGRA5551 __ecore_buffer_fourcc_code('B', 'A', '1', '5')
/**
 * @brief Definition for the Ecore_Buffer format RGB565 ([15:0] R:G:B 5:6:5 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_RGB565   __ecore_buffer_fourcc_code('R', 'G', '1', '6')
/**
 * @brief Definition for the Ecore_Buffer format BGR565 ([15:0] B:G:R 5:6:5 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_BGR565   __ecore_buffer_fourcc_code('B', 'G', '1', '6')
/* 24 bpp RGB */
/**
 * @brief Definition for the Ecore_Buffer format RGB888 ([23:0] R:G:B little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_RGB888   __ecore_buffer_fourcc_code('R', 'G', '2', '4')
/**
 * @brief Definition for the Ecore_Buffer format BGR888 ([23:0] B:G:R little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_BGR888   __ecore_buffer_fourcc_code('B', 'G', '2', '4')
/* 32 bpp RGB */
/**
 * @brief Definition for the Ecore_Buffer format XRGB8888 ([31:0] x:R:G:B 8:8:8:8 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_XRGB8888 __ecore_buffer_fourcc_code('X', 'R', '2', '4')
/**
 * @brief Definition for the Ecore_Buffer format XBGR8888 ([31:0] x:B:G:R 8:8:8:8 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_XBGR8888 __ecore_buffer_fourcc_code('X', 'B', '2', '4')
/**
 * @brief Definition for the Ecore_Buffer format RGBX8888 ([31:0] R:G:B:x 8:8:8:8 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_RGBX8888 __ecore_buffer_fourcc_code('R', 'X', '2', '4')
/**
 * @brief Definition for the Ecore_Buffer format BGRX8888 ([31:0] B:G:R:x 8:8:8:8 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_BGRX8888 __ecore_buffer_fourcc_code('B', 'X', '2', '4')
/**
 * @brief Definition for the Ecore_Buffer format ARGB8888 ([31:0] A:R:G:B 8:8:8:8 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_ARGB8888 __ecore_buffer_fourcc_code('A', 'R', '2', '4')
/**
 * @brief Definition for the Ecore_Buffer format ABGR8888 ([31:0] [31:0] A:B:G:R 8:8:8:8 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_ABGR8888 __ecore_buffer_fourcc_code('A', 'B', '2', '4')
/**
 * @brief Definition for the Ecore_Buffer format RGBA8888 ([31:0] R:G:B:A 8:8:8:8 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_RGBA8888 __ecore_buffer_fourcc_code('R', 'A', '2', '4')
/**
 * @brief Definition for the Ecore_Buffer format BGRA8888 ([31:0] B:G:R:A 8:8:8:8 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_BGRA8888 __ecore_buffer_fourcc_code('B', 'A', '2', '4')
/**
 * @brief Definition for the Ecore_Buffer format XRGB2101010 ([31:0] x:R:G:B 2:10:10:10 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_XRGB2101010  __ecore_buffer_fourcc_code('X', 'R', '3', '0')
/**
 * @brief Definition for the Ecore_Buffer format XBGR2101010 ([31:0] x:B:G:R 2:10:10:10 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_XBGR2101010  __ecore_buffer_fourcc_code('X', 'B', '3', '0')
/**
 * @brief Definition for the Ecore_Buffer format RGBX1010102 ([31:0] R:G:B:x 10:10:10:2 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_RGBX1010102  __ecore_buffer_fourcc_code('R', 'X', '3', '0')
/**
 * @brief Definition for the Ecore_Buffer format BGRX1010102 ([31:0] B:G:R:x 10:10:10:2 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_BGRX1010102  __ecore_buffer_fourcc_code('B', 'X', '3', '0')
/**
 * @brief Definition for the Ecore_Buffer format ARGB2101010 ([31:0] A:R:G:B 2:10:10:10 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_ARGB2101010  __ecore_buffer_fourcc_code('A', 'R', '3', '0')
/**
 * @brief Definition for the Ecore_Buffer format ABGR2101010 ([31:0] A:B:G:R 2:10:10:10 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_ABGR2101010  __ecore_buffer_fourcc_code('A', 'B', '3', '0')
/**
 * @brief Definition for the Ecore_Buffer format RGBA1010102 ([31:0] R:G:B:A 10:10:10:2 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_RGBA1010102  __ecore_buffer_fourcc_code('R', 'A', '3', '0')
/**
 * @brief Definition for the Ecore_Buffer format BGRA1010102 ([31:0] B:G:R:A 10:10:10:2 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_BGRA1010102  __ecore_buffer_fourcc_code('B', 'A', '3', '0')
/* packed YCbCr */
/**
 * @brief Definition for the Ecore_Buffer format YUYV ([31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_YUYV     __ecore_buffer_fourcc_code('Y', 'U', 'Y', 'V')
/**
 * @brief Definition for the Ecore_Buffer format YVYU ([31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_YVYU     __ecore_buffer_fourcc_code('Y', 'V', 'Y', 'U')
/**
 * @brief Definition for the Ecore_Buffer format UYVY ([31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_UYVY     __ecore_buffer_fourcc_code('U', 'Y', 'V', 'Y')
/**
 * @brief Definition for the Ecore_Buffer format VYUY ([31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_VYUY     __ecore_buffer_fourcc_code('V', 'Y', 'U', 'Y')
/**
 * @brief Definition for the Ecore_Buffer format AYUV ([31:0] A:Y:Cb:Cr 8:8:8:8 little endian).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_AYUV     __ecore_buffer_fourcc_code('A', 'Y', 'U', 'V')
/*
 * 2 plane YCbCr
 * index 0 = Y plane, [7:0] Y
 * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
 * or
 * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
 */
/**
 * @brief Definition for the Ecore_Buffer format NV12 (2x2 subsampled Cr:Cb plane).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_NV12     __ecore_buffer_fourcc_code('N', 'V', '1', '2')
/**
 * @brief Definition for the Ecore_Buffer format NV21 (2x2 subsampled Cb:Cr plane).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_NV21     __ecore_buffer_fourcc_code('N', 'V', '2', '1')
/**
 * @brief Definition for the Ecore_Buffer format NV16 (2x1 subsampled Cr:Cb plane).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_NV16     __ecore_buffer_fourcc_code('N', 'V', '1', '6')
/**
 * @brief Definition for the Ecore_Buffer format NV61 (2x1 subsampled Cb:Cr plane).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_NV61     __ecore_buffer_fourcc_code('N', 'V', '6', '1')
/*
 * 3 plane YCbCr
 * index 0: Y plane, [7:0] Y
 * index 1: Cb plane, [7:0] Cb
 * index 2: Cr plane, [7:0] Cr
 * or
 * index 1: Cr plane, [7:0] Cr
 * index 2: Cb plane, [7:0] Cb
 */
/**
 * @brief Definition for the Ecore_Buffer format YUV410 (4x4 subsampled Cb (1) and Cr (2) planes).
 */
#define ECORE_BUFFER_FORMAT_YUV410   __ecore_buffer_fourcc_code('Y', 'U', 'V', '9')
/**
 * @brief Definition for the Ecore_Buffer format YVU410 (4x4 subsampled Cr (1) and Cb (2) planes).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_YVU410   __ecore_buffer_fourcc_code('Y', 'V', 'U', '9')
/**
 * @brief Definition for the Ecore_Buffer format YUV411 (4x1 subsampled Cb (1) and Cr (2) planes).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_YUV411   __ecore_buffer_fourcc_code('Y', 'U', '1', '1')
/**
 * @brief Definition for the Ecore_Buffer format YVU411 (4x1 subsampled Cr (1) and Cb (2) planes).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_YVU411   __ecore_buffer_fourcc_code('Y', 'V', '1', '1')
/**
 * @brief Definition for the Ecore_Buffer format YUV420 (2x2 subsampled Cb (1) and Cr (2) planes).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_YUV420   __ecore_buffer_fourcc_code('Y', 'U', '1', '2')
/**
 * @brief Definition for the Ecore_Buffer format YVU420 (2x2 subsampled Cr (1) and Cb (2) planes).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_YVU420   __ecore_buffer_fourcc_code('Y', 'V', '1', '2')
/**
 * @brief Definition for the Ecore_Buffer format YUV422 (2x1 subsampled Cb (1) and Cr (2) planes).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_YUV422   __ecore_buffer_fourcc_code('Y', 'U', '1', '6')
/**
 * @brief Definition for the Ecore_Buffer format YVU422 (2x1 subsampled Cr (1) and Cb (2) planes).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_YVU422   __ecore_buffer_fourcc_code('Y', 'V', '1', '6')
/**
 * @brief Definition for the Ecore_Buffer format YUV444 (non-subsampled Cb (1) and Cr (2) planes).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_YUV444   __ecore_buffer_fourcc_code('Y', 'U', '2', '4')
/**
 * @brief Definition for the Ecore_Buffer format YVU444 (non-subsampled Cr (1) and Cb (2) planes).
 * @since 1.15
 */
#define ECORE_BUFFER_FORMAT_YVU444   __ecore_buffer_fourcc_code('Y', 'V', '2', '4')

/**
 * @defgroup Ecore_Buffer_Lib_Group Ecore Buffer Library Functions
 * @ingroup Ecore_Buffer_Group
 *
 * Utility functions that set up and shut down the Ecore Buffer library.
 * This group of functions is applied to an Ecore_Buffer object.
 *
 * @{
 */

/**
 * @typedef Ecore_Buffer
 * An object representing a graphic buffer.
 * @since 1.15
 */
typedef struct _Ecore_Buffer Ecore_Buffer;
/**
 * @typedef Ecore_Buffer_Backend
 * The interfaces for backend of buffer.
 * @since 1.15
 */
typedef struct _Ecore_Buffer_Backend Ecore_Buffer_Backend;
/**
 * @typedef Ecore_Export_Type
 * Types for export buffer.
 * @since 1.15
 */
typedef enum _Ecore_Export_Type Ecore_Export_Type;
/**
 * @typedef Ecore_Buffer_Format
 * The format of Ecore_Buffer.
 * @since 1.15
 */
typedef unsigned int Ecore_Buffer_Format;
/**
 * @typedef Ecore_Buffer_Pixmap
 * An Id of Pixmap.
 * @since 1.15
 */
typedef unsigned long Ecore_Pixmap;
/**
 * @typedef Ecore_Buffer_Module_Data
 * The data of module.
 * @since 1.15
 */
typedef void* Ecore_Buffer_Module_Data;
/**
 * @typedef Ecore_Buffer_Data
 * The data of Ecore_Buffer.
 * @since 1.15
 */
typedef void* Ecore_Buffer_Data;
/**
 * @typedef Ecore_Buffer_Cb
 * Called whenever Ecore_Buffer is freed.
 * @since 1.15
 */
typedef void (*Ecore_Buffer_Cb)(Ecore_Buffer* buf, void* data);

/**
 * @enum _Ecore_Export_Type
 * Types for export buffer.
 * @since 1.15
 */
enum _Ecore_Export_Type
{
   EXPORT_TYPE_INVALID,
   EXPORT_TYPE_ID,
   EXPORT_TYPE_FD
};

/**
 * @struct _Ecore_Buffer_Backend
 * @brief Structure used when initializing Ecore Buffer Backend. This structure
 * is mainly used by modules implementing the Ecore Buffer Backend interface.
 * @since 1.15
 */
struct _Ecore_Buffer_Backend
{
   const char *name; /**< The name of backend */

   Ecore_Buffer_Module_Data    (*init)(const char *context, const char *options); /**< Initialize the backend */
   void                        (*shutdown)(Ecore_Buffer_Module_Data bmdata); /**< Shut down the backend */
   Ecore_Buffer_Data           (*buffer_alloc)(Ecore_Buffer_Module_Data bmdata,
                                               int width, int height,
                                               Ecore_Buffer_Format format,
                                               unsigned int flags); /**< Newly allocate memory for buffer */
   void                        (*buffer_free)(Ecore_Buffer_Module_Data bmdata,
                                              Ecore_Buffer_Data bdata); /**< Free allocated memory */
   Ecore_Export_Type           (*buffer_export)(Ecore_Buffer_Module_Data bmdata,
                                                Ecore_Buffer_Data bdata, int *id); /**< Get the id or fd of Ecore_Buffer for exporting it */
   Ecore_Buffer_Data           (*buffer_import)(Ecore_Buffer_Module_Data bmdata,
                                                int w, int h,
                                                Ecore_Buffer_Format format,
                                                Ecore_Export_Type type,
                                                int export_id,
                                                unsigned int flags); /**< Import and create Ecore_Buffer from id or fd */
   void                       *(*data_get)(Ecore_Buffer_Module_Data bmdata,
                                           Ecore_Buffer_Data bdata);
   Ecore_Pixmap                (*pixmap_get)(Ecore_Buffer_Module_Data bmdata,
                                             Ecore_Buffer_Data bdata); /**< Get the pixmap handle */
   void                       *(*tbm_surface_get)(Ecore_Buffer_Module_Data bmdata,
                                                  Ecore_Buffer_Data bdata); /**< Get the tbm_surface_h handle */
};

/**
 * @brief Initialize the Ecore_Buffer system.
 *
 * @since 1.15
 *
 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
 *
 * @see ecore_buffer_shutdown()
 */
EAPI Eina_Bool     ecore_buffer_init(void);
/**
 * @brief Shut down the Ecore_Buffer system.
 *
 * @since 1.15
 *
 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
 *
 * @see ecore_buffer_init()
 */
EAPI Eina_Bool     ecore_buffer_shutdown(void);
/**
 * @brief Registers the given buffer backend.
 *
 * @since 1.15
 *
 * @param[in] be The backend
 *
 * @return @c EINA_TRUE if backend has been correctly registered, @c EINA_FALSE otherwise.
 */
EAPI Eina_Bool     ecore_buffer_register(Ecore_Buffer_Backend *be);
/**
 * @brief Unregisters the given buffer backend.
 *
 * @since 1.15
 *
 * @param[in] be The backend
 */
EAPI void          ecore_buffer_unregister(Ecore_Buffer_Backend *be);
/**
 * @brief Creates a new Ecore_Buffer given type
 *
 * @since 1.15
 *
 * @param[in] engine the name of backend
 * @param[in] width width for Ecore_Buffer
 * @param[in] height height for Ecore_Buffer
 * @param[in] format format for Ecore_Buffer
 * @param[in] flags flags for Ecore_Buffer
 *
 * @return Newly allocated Ecore_Buffer instance, NULL otherwise.
 */
EAPI Ecore_Buffer *ecore_buffer_new(const char *engine, unsigned int width, unsigned int height, Ecore_Buffer_Format format, unsigned int flags);
/**
 * @brief Free the given Ecore_Buffer.
 *
 * @since 1.15
 *
 * @param[in] buf The Ecore_Buffer to free
 */
EAPI void          ecore_buffer_free(Ecore_Buffer *buf);
/**
 * @brief Set a callback for Ecore_Buffer free events.
 *
 * @since 1.15
 *
 * @param[in] buf The Ecore_Buffer to set callbacks on
 * @param[in] func The function to call
 * @param[in] data A pointer to the user data to store.
 *
 * A call to this function will set a callback on an Ecore_Buffer, causing
 * @p func to be called whenever @p buf is freed.
 *
 * @see ecore_buffer_free_callback_remove()
 */
EAPI void          ecore_buffer_free_callback_add(Ecore_Buffer *buf, Ecore_Buffer_Cb  func, void *data);
/**
 * @brief Remove a callback for Ecore_Buffer free events.
 *
 * @since 1.15
 *
 * @param[in] buf The Ecore_Buffer to remove callbacks on
 * @param[in] func The function to remove
 * @param[in] data A pointer to the user data to remove
 *
 * @see ecore_buffer_free_callback_add()
 */
EAPI void          ecore_buffer_free_callback_remove(Ecore_Buffer *buf, Ecore_Buffer_Cb func, void *data);
/**
 * @brief Get a pointer to the raw data of the given Ecore_Buffer.
 *
 * @param[in] buf The Ecore_Buffer.
 *
 * @return The pointer of raw data.
 */
EAPI void         *ecore_buffer_data_get(Ecore_Buffer *buf);
/**
 * @brief Return the Pixmap of given Ecore_Buffer.
 *
 * @since 1.15
 *
 * @param[in] buf The Ecore_Buffer
 *
 * @return The Pixmap instance, 0 otherwise.
 */
EAPI Ecore_Pixmap  ecore_buffer_pixmap_get(Ecore_Buffer *buf);
/**
 * @brief Return the tbm surface handle of given Ecore_Buffer.
 *
 * @since 1.15
 *
 * @param[in] buf The Ecore_Buffer
 *
 * @return The tbm surface handle, NULL otherwise.
 *
 * The tbm surface handle will be used for the API of libtbm.
 * The API is described in tbm_surface.h in libtbm.
 */
EAPI void         *ecore_buffer_tbm_surface_get(Ecore_Buffer *buf);
/**
 * @brief Return size of given Ecore_Buffer.
 *
 * @since 1.15
 *
 * @param[in] buf The Ecore_Buffer
 * @param[out] width where to return the width value. May be @c NULL.
 * @param[out] height  where to return the height value. May be @c NULL.
 *
 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
 */
EAPI Eina_Bool     ecore_buffer_size_get(Ecore_Buffer *buf, unsigned int *width, unsigned int *height);
/**
 * @brief Return format of given Ecore_Buffer.
 *
 * @since 1.15
 *
 * @param[in] buf The Ecore_Buffer
 *
 * @return The format of given Ecore_Buffer.
 *
 * return value can be one of those pre-defined value such as ECORE_BUFFER_FORMAT_XRGB8888.
 */
EAPI Ecore_Buffer_Format ecore_buffer_format_get(Ecore_Buffer *buf);
/**
 * @brief Return flags of given Ecore_Buffer.
 *
 * @since 1.15
 *
 * @param[in] buf The Ecore_Buffer
 *
 * @return The flags of given Ecore_Buffer.
 *
 * NOTE: Not Defined yet.
 */
EAPI unsigned int  ecore_buffer_flags_get(Ecore_Buffer *buf);

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif