1 #ifndef _TBM_SURFACE_H_
2 #define _TBM_SURFACE_H_
5 * @addtogroup CAPI_UI_TBM_SURFACE_MODULE
18 * @brief Enumeration for tbm_surface error type.
19 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
22 TBM_SURFACE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
23 TBM_SURFACE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
24 TBM_SURFACE_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid Operation */
25 } tbm_surface_error_e;
28 * @brief Definition for the max number of TBM surface plane.
29 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
31 #define TBM_SURF_PLANE_MAX 4
33 /* option to map the tbm_surface */
35 * @brief Definition for the access option to read.
36 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
38 #define TBM_SURF_OPTION_READ (1 << 0)
40 * @brief Definition for the access option to write.
41 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
43 #define TBM_SURF_OPTION_WRITE (1 << 1)
46 * @brief Definition for the TBM plane struct.
47 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
49 typedef struct _tbm_surface_plane {
50 unsigned char *ptr; /**< Plane pointer */
51 uint32_t size; /**< Plane size */
52 uint32_t offset; /**< Plane offset */
53 uint32_t stride; /**< Plane stride */
55 void *reserved1; /**< Reserved pointer1 */
56 void *reserved2; /**< Reserved pointer2 */
57 void *reserved3; /**< Reserved pointer3 */
58 } tbm_surface_plane_s;
61 * @brief Definition for the TBM surface information struct.
62 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
64 typedef struct _tbm_surface_info {
65 uint32_t width; /**< TBM surface width */
66 uint32_t height; /**< TBM surface height */
67 tbm_format format; /**< TBM surface format*/
68 uint32_t bpp; /**< TBM surface bbp */
69 uint32_t size; /**< TBM surface size */
71 uint32_t num_planes; /**< The number of planes */
72 tbm_surface_plane_s planes[TBM_SURF_PLANE_MAX]; /**< Array of planes */
74 void *reserved4; /**< Reserved pointer4 */
75 void *reserved5; /**< Reserved pointer5 */
76 void *reserved6; /**< Reserved pointer6 */
79 #define __tbm_fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
80 ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
84 * @brief Definition for the TBM surface format C8 ([7:0] C).
85 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
87 #define TBM_FORMAT_C8 __tbm_fourcc_code('C', '8', ' ', ' ')
91 * @brief Definition for the TBM surface format RGB322 ([7:0] R:G:B 3:3:2).
92 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
94 #define TBM_FORMAT_RGB332 __tbm_fourcc_code('R', 'G', 'B', '8')
96 * @brief Definition for the TBM surface format RGB233 ([7:0] B:G:R 2:3:3).
97 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
99 #define TBM_FORMAT_BGR233 __tbm_fourcc_code('B', 'G', 'R', '8')
103 * @brief Definition for the TBM surface format XRGB4444 ([15:0] x:R:G:B 4:4:4:4 little endian).
104 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
106 #define TBM_FORMAT_XRGB4444 __tbm_fourcc_code('X', 'R', '1', '2')
108 * @brief Definition for the TBM surface format XBRG4444 ([15:0] x:B:G:R 4:4:4:4 little endian).
109 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
111 #define TBM_FORMAT_XBGR4444 __tbm_fourcc_code('X', 'B', '1', '2')
113 * @brief Definition for the TBM surface format RGBX4444 ([15:0] R:G:B:x 4:4:4:4 little endian).
114 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
116 #define TBM_FORMAT_RGBX4444 __tbm_fourcc_code('R', 'X', '1', '2')
118 * @brief Definition for the TBM surface format BGRX4444 ([15:0] B:G:R:x 4:4:4:4 little endian).
119 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
121 #define TBM_FORMAT_BGRX4444 __tbm_fourcc_code('B', 'X', '1', '2')
124 * @brief Definition for the TBM surface format ARGB4444 ([15:0] A:R:G:B 4:4:4:4 little endian).
125 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
127 #define TBM_FORMAT_ARGB4444 __tbm_fourcc_code('A', 'R', '1', '2')
129 * @brief Definition for the TBM surface format ABGR4444 ([15:0] A:B:G:R 4:4:4:4 little endian).
130 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
132 #define TBM_FORMAT_ABGR4444 __tbm_fourcc_code('A', 'B', '1', '2')
134 * @brief Definition for the TBM surface format RGBA4444 ([15:0] R:G:B:A 4:4:4:4 little endian).
135 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
137 #define TBM_FORMAT_RGBA4444 __tbm_fourcc_code('R', 'A', '1', '2')
139 * @brief Definition for the TBM surface format BGRA4444 ([15:0] B:G:R:A 4:4:4:4 little endian).
140 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
142 #define TBM_FORMAT_BGRA4444 __tbm_fourcc_code('B', 'A', '1', '2')
145 * @brief Definition for the TBM surface format XRGB1555 ([15:0] x:R:G:B 1:5:5:5 little endian).
146 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
148 #define TBM_FORMAT_XRGB1555 __tbm_fourcc_code('X', 'R', '1', '5')
150 * @brief Definition for the TBM surface format XBGR1555 ([15:0] x:B:G:R 1:5:5:5 little endian).
151 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
153 #define TBM_FORMAT_XBGR1555 __tbm_fourcc_code('X', 'B', '1', '5')
155 * @brief Definition for the TBM surface format RGBX5551 ([15:0] R:G:B:x 5:5:5:1 little endian).
156 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
158 #define TBM_FORMAT_RGBX5551 __tbm_fourcc_code('R', 'X', '1', '5')
160 * @brief Definition for the TBM surface format BGRX5551 ([15:0] B:G:R:x 5:5:5:1 little endian).
161 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
163 #define TBM_FORMAT_BGRX5551 __tbm_fourcc_code('B', 'X', '1', '5')
166 * @brief Definition for the TBM surface format ARGB1555 ([15:0] A:R:G:B 1:5:5:5 little endian).
167 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
169 #define TBM_FORMAT_ARGB1555 __tbm_fourcc_code('A', 'R', '1', '5')
171 * @brief Definition for the TBM surface format ABGR1555 ([15:0] A:B:G:R 1:5:5:5 little endian).
172 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
174 #define TBM_FORMAT_ABGR1555 __tbm_fourcc_code('A', 'B', '1', '5')
176 * @brief Definition for the TBM surface format RGBA5551 ([15:0] R:G:B:A 5:5:5:1 little endian).
177 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
179 #define TBM_FORMAT_RGBA5551 __tbm_fourcc_code('R', 'A', '1', '5')
181 * @brief Definition for the TBM surface format BGRA5551 ([15:0] B:G:R:A 5:5:5:1 little endian).
182 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
184 #define TBM_FORMAT_BGRA5551 __tbm_fourcc_code('B', 'A', '1', '5')
187 * @brief Definition for the TBM surface format RGB565 ([15:0] R:G:B 5:6:5 little endian).
188 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
190 #define TBM_FORMAT_RGB565 __tbm_fourcc_code('R', 'G', '1', '6')
192 * @brief Definition for the TBM surface format BGR565 ([15:0] B:G:R 5:6:5 little endian).
193 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
195 #define TBM_FORMAT_BGR565 __tbm_fourcc_code('B', 'G', '1', '6')
199 * @brief Definition for the TBM surface format RGB888 ([23:0] R:G:B little endian).
200 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
202 #define TBM_FORMAT_RGB888 __tbm_fourcc_code('R', 'G', '2', '4')
204 * @brief Definition for the TBM surface format BGR888 ([23:0] B:G:R little endian).
205 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
207 #define TBM_FORMAT_BGR888 __tbm_fourcc_code('B', 'G', '2', '4')
211 * @brief Definition for the TBM surface format XRGB8888 ([31:0] x:R:G:B 8:8:8:8 little endian).
212 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
214 #define TBM_FORMAT_XRGB8888 __tbm_fourcc_code('X', 'R', '2', '4')
216 * @brief Definition for the TBM surface format XBGR8888 ([31:0] x:B:G:R 8:8:8:8 little endian).
217 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
219 #define TBM_FORMAT_XBGR8888 __tbm_fourcc_code('X', 'B', '2', '4')
221 * @brief Definition for the TBM surface format RGBX8888 ([31:0] R:G:B:x 8:8:8:8 little endian).
222 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
224 #define TBM_FORMAT_RGBX8888 __tbm_fourcc_code('R', 'X', '2', '4')
226 * @brief Definition for the TBM surface format BGRX8888 ([31:0] B:G:R:x 8:8:8:8 little endian).
227 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
229 #define TBM_FORMAT_BGRX8888 __tbm_fourcc_code('B', 'X', '2', '4')
232 * @brief Definition for the TBM surface format ARGB8888 ([31:0] A:R:G:B 8:8:8:8 little endian).
233 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
235 #define TBM_FORMAT_ARGB8888 __tbm_fourcc_code('A', 'R', '2', '4')
237 * @brief Definition for the TBM surface format ABGR8888 ([31:0] [31:0] A:B:G:R 8:8:8:8 little endian).
238 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
240 #define TBM_FORMAT_ABGR8888 __tbm_fourcc_code('A', 'B', '2', '4')
242 * @brief Definition for the TBM surface format RGBA8888 ([31:0] R:G:B:A 8:8:8:8 little endian).
243 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
245 #define TBM_FORMAT_RGBA8888 __tbm_fourcc_code('R', 'A', '2', '4')
247 * @brief Definition for the TBM surface format BGRA8888 ([31:0] B:G:R:A 8:8:8:8 little endian).
248 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
250 #define TBM_FORMAT_BGRA8888 __tbm_fourcc_code('B', 'A', '2', '4')
253 * @brief Definition for the TBM surface format XRGB2101010 ([31:0] x:R:G:B 2:10:10:10 little endian).
254 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
256 #define TBM_FORMAT_XRGB2101010 __tbm_fourcc_code('X', 'R', '3', '0')
258 * @brief Definition for the TBM surface format XBGR2101010 ([31:0] x:B:G:R 2:10:10:10 little endian).
259 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
261 #define TBM_FORMAT_XBGR2101010 __tbm_fourcc_code('X', 'B', '3', '0')
263 * @brief Definition for the TBM surface format RGBX1010102 ([31:0] R:G:B:x 10:10:10:2 little endian).
264 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
266 #define TBM_FORMAT_RGBX1010102 __tbm_fourcc_code('R', 'X', '3', '0')
268 * @brief Definition for the TBM surface format BGRX1010102 ([31:0] B:G:R:x 10:10:10:2 little endian).
269 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
271 #define TBM_FORMAT_BGRX1010102 __tbm_fourcc_code('B', 'X', '3', '0')
274 * @brief Definition for the TBM surface format ARGB2101010 ([31:0] A:R:G:B 2:10:10:10 little endian).
275 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
277 #define TBM_FORMAT_ARGB2101010 __tbm_fourcc_code('A', 'R', '3', '0')
279 * @brief Definition for the TBM surface format ABGR2101010 ([31:0] A:B:G:R 2:10:10:10 little endian).
280 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
282 #define TBM_FORMAT_ABGR2101010 __tbm_fourcc_code('A', 'B', '3', '0')
284 * @brief Definition for the TBM surface format RGBA1010102 ([31:0] R:G:B:A 10:10:10:2 little endian).
285 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
287 #define TBM_FORMAT_RGBA1010102 __tbm_fourcc_code('R', 'A', '3', '0')
289 * @brief Definition for the TBM surface format BGRA1010102 ([31:0] B:G:R:A 10:10:10:2 little endian).
290 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
292 #define TBM_FORMAT_BGRA1010102 __tbm_fourcc_code('B', 'A', '3', '0') /* */
296 * @brief Definition for the TBM surface format YUYV ([31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian).
297 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
299 #define TBM_FORMAT_YUYV __tbm_fourcc_code('Y', 'U', 'Y', 'V')
301 * @brief Definition for the TBM surface format YVYU ([31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian).
302 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
304 #define TBM_FORMAT_YVYU __tbm_fourcc_code('Y', 'V', 'Y', 'U') /* */
306 * @brief Definition for the TBM surface format UYVY ([31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian).
307 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
309 #define TBM_FORMAT_UYVY __tbm_fourcc_code('U', 'Y', 'V', 'Y')
311 * @brief Definition for the TBM surface format VYUY ([31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian).
312 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
314 #define TBM_FORMAT_VYUY __tbm_fourcc_code('V', 'Y', 'U', 'Y')
317 * @brief Definition for the TBM surface format AYUV ([31:0] A:Y:Cb:Cr 8:8:8:8 little endian).
318 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
320 #define TBM_FORMAT_AYUV __tbm_fourcc_code('A', 'Y', 'U', 'V')
324 * index 0 = Y plane, [7:0] Y
325 * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
327 * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
330 * @brief Definition for the TBM surface format NV12 (2x2 subsampled Cr:Cb plane).
331 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
333 #define TBM_FORMAT_NV12 __tbm_fourcc_code('N', 'V', '1', '2')
335 * @brief Definition for the TBM surface format NV21 (2x2 subsampled Cb:Cr plane).
336 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
338 #define TBM_FORMAT_NV21 __tbm_fourcc_code('N', 'V', '2', '1') /* */
340 * @brief Definition for the TBM surface format NV16 (2x1 subsampled Cr:Cb plane).
341 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
343 #define TBM_FORMAT_NV16 __tbm_fourcc_code('N', 'V', '1', '6')
345 * @brief Definition for the TBM surface format NV61 (2x1 subsampled Cb:Cr plane).
346 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
348 #define TBM_FORMAT_NV61 __tbm_fourcc_code('N', 'V', '6', '1')
352 * index 0: Y plane, [7:0] Y
353 * index 1: Cb plane, [7:0] Cb
354 * index 2: Cr plane, [7:0] Cr
356 * index 1: Cr plane, [7:0] Cr
357 * index 2: Cb plane, [7:0] Cb
360 * @brief Definition for the TBM surface format YUV410 (4x4 subsampled Cb (1) and Cr (2) planes).
362 #define TBM_FORMAT_YUV410 __tbm_fourcc_code('Y', 'U', 'V', '9')
364 * @brief Definition for the TBM surface format YVU410 (4x4 subsampled Cr (1) and Cb (2) planes).
365 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
367 #define TBM_FORMAT_YVU410 __tbm_fourcc_code('Y', 'V', 'U', '9')
369 * @brief Definition for the TBM surface format YUV411 (4x1 subsampled Cb (1) and Cr (2) planes).
370 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
372 #define TBM_FORMAT_YUV411 __tbm_fourcc_code('Y', 'U', '1', '1')
374 * @brief Definition for the TBM surface format YVU411 (4x1 subsampled Cr (1) and Cb (2) planes).
375 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
377 #define TBM_FORMAT_YVU411 __tbm_fourcc_code('Y', 'V', '1', '1')
379 * @brief Definition for the TBM surface format YUV420 (2x2 subsampled Cb (1) and Cr (2) planes).
380 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
382 #define TBM_FORMAT_YUV420 __tbm_fourcc_code('Y', 'U', '1', '2')
384 * @brief Definition for the TBM surface format YVU420 (2x2 subsampled Cr (1) and Cb (2) planes).
385 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
387 #define TBM_FORMAT_YVU420 __tbm_fourcc_code('Y', 'V', '1', '2')
389 * @brief Definition for the TBM surface format YUV422 (2x1 subsampled Cb (1) and Cr (2) planes).
390 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
392 #define TBM_FORMAT_YUV422 __tbm_fourcc_code('Y', 'U', '1', '6')
394 * @brief Definition for the TBM surface format YVU422 (2x1 subsampled Cr (1) and Cb (2) planes).
395 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
397 #define TBM_FORMAT_YVU422 __tbm_fourcc_code('Y', 'V', '1', '6')
399 * @brief Definition for the TBM surface format YUV444 (non-subsampled Cb (1) and Cr (2) planes).
400 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
402 #define TBM_FORMAT_YUV444 __tbm_fourcc_code('Y', 'U', '2', '4')
404 * @brief Definition for the TBM surface format YVU444 (non-subsampled Cr (1) and Cb (2) planes).
405 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
407 #define TBM_FORMAT_YVU444 __tbm_fourcc_code('Y', 'V', '2', '4')
411 * @brief Definition for the TBM surface format NV12MT (tiled '64x32' & multi-plane version of NV12).
412 * @since_tizen 3.0 @endif
414 #define TBM_FORMAT_NV12MT __tbm_fourcc_code('T', 'M', '1', '2')
421 * @brief Queries surface format list and number of format supported by the system.
422 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
424 * @remarks You must release the formats using free().
426 * @param[out] formats The format array which the system can support \n
427 * This pointer has to be freed by user.
428 * @param[out] num The number of formats
430 * @return #TBM_SURFACE_ERROR_NONE if this function succeeds,
431 * otherwise an error status value
433 * @retval #TBM_SURFACE_ERROR_NONE Success
434 * @retval #TBM_SURFACE_ERROR_INVALID_OPERATION Invalid operation
438 #include <tbm_surface.h>
444 if (tbm_surface_query_formats (&formats, &format_num))
446 for( i = 0 ; i < format_num ; i++)
448 if (formats[i] == TBM_FORMAT_RGB332)
456 int tbm_surface_query_formats(uint32_t **formats, uint32_t *num);
459 * @brief Creates the tbm_surface.
460 * @details This function creates the tbm_surface with the given width, height, and format.
462 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
464 * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
466 * @param[in] width The width of surface
467 * @param[in] height The height of surface
468 * @param[in] format The format of surface
470 * @return #tbm_surface_h on success,
473 * @retval #tbm_surface_h The TBM surface handle
475 * @exception #TBM_SURFACE_ERROR_NONE Success
476 * @exception #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
477 * @exception #TBM_SURFACE_ERROR_INVALID_OPERATION Invalid operation
479 * @see tbm_surface_destroy()
483 #include <tbm_surface.h>
485 tbm_surface_h surface;
487 surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
491 tbm_surface_destroy (surface);
494 tbm_surface_h tbm_surface_create(int width, int height, tbm_format format);
497 * @brief Destroys the tbm_surface.
498 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
500 * @param[in] surface The #tbm_surface_h
502 * @return #TBM_SURFACE_ERROR_NONE on success,
503 * otherwise an error status value
505 * @retval #TBM_SURFACE_ERROR_NONE Success
506 * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
508 * @see tbm_surface_create()
512 #include <tbm_surface.h>
514 tbm_surface_h surface;
516 surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
520 tbm_surface_destroy (surface);
523 int tbm_surface_destroy(tbm_surface_h surface);
526 * @brief Maps the tbm_surface according to the access option.
527 * @details After mapping tbm_surface, the information of tbm_surface is assigned in #tbm_surface_info_s struct. \n
528 * The information of tbm_surface has width, height, format, bpp, size, number of planes and information of planes. \n
529 * The information of planes has stride, offset, size and pointer of plane. \n
530 * #TBM_SURF_OPTION_READ indicates access option to read. \n
531 * #TBM_SURF_OPTION_WRITE indicates access option to write.
533 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
535 * @param[in] surface The #tbm_surface_h
536 * @param[in] opt The option to access the tbm_surface
537 * @param[out] info The information of the tbm_surface
539 * @return #TBM_SURFACE_ERROR_NONE on success,
540 * otherwise an error status value
542 * @retval #TBM_SURFACE_ERROR_NONE Success
543 * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
544 * @retval #TBM_SURFACE_ERROR_INVALID_OPERATION Invalid operation
546 * @see tbm_surface_unmap();
550 #include <tbm_surface.h>
552 tbm_surface_h surface;
553 tbm_surface_info_s info;
556 surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
557 ret = tbm_surface_map (surface, TBM_SURF_OPTION_WRITE|TBM_SURF_OPTION_READ, &info);
561 tbm_surface_unmap (surface);
562 tbm_surface_destroy (surface);
565 int tbm_surface_map(tbm_surface_h surface, int opt, tbm_surface_info_s *info);
568 * @brief Unmaps the tbm_surface.
569 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
571 * @param[in] surface The #tbm_surface_h
573 * @return #TBM_SURFACE_ERROR_NONE on success,
574 * otherwise an error status value
576 * @retval #TBM_SURFACE_ERROR_NONE Success
577 * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
579 * @see tbm_surface_map()
583 #include <tbm_surface.h>
585 tbm_surface_h surface;
586 tbm_surface_info_s info;
589 surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
590 ret = tbm_surface_map (surface, TBM_SURF_OPTION_WRITE|TBM_SURF_OPTION_READ, &info);
594 tbm_surface_unmap (surface);
595 tbm_surface_destroy (surface);
598 int tbm_surface_unmap(tbm_surface_h surface);
601 * @brief Gets the information of the tbm_surface.
602 * @details The information of tbm_surface is assigned in #tbm_surface_info_s struct. \n
603 * The information of tbm_surface has width, height, format, bpp, size, number of planes and information of planes. \n
604 * The information of planes has stride, offset, size and pointer of plane.
606 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
608 * @param[in] surface The #tbm_surface_h
609 * @param[out] info The information of the tbm_surface
611 * @return #TBM_SURFACE_ERROR_NONE on success,
612 * otherwise an error status value
614 * @retval #TBM_SURFACE_ERROR_NONE Success
615 * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
616 * @retval #TBM_SURFACE_ERROR_INVALID_OPERATION Invalid operation
618 * @see tbm_surface_map()
622 #include <tbm_surface.h>
624 tbm_surface_h surface;
625 tbm_surface_info_s info;
628 surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
629 ret = tbm_surface_get_info (surface, &info);
633 tbm_surface_destroy (surface);
636 int tbm_surface_get_info(tbm_surface_h surface, tbm_surface_info_s *info);
639 * @brief Gets the width of the tbm_surface.
640 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
642 * @param[in] surface The #tbm_surface_h
644 * @return The width of the tbm_surface on success,
645 * otherwise an error status value
647 * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
651 #include <tbm_surface.h>
653 tbm_surface_h surface;
656 surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
660 width = tbm_surface_get_width (surface);
664 tbm_surface_destroy (surface);
667 int tbm_surface_get_width(tbm_surface_h surface);
670 * @brief Gets the height of the tbm_surface.
671 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
673 * @param[in] surface The #tbm_surface_h
675 * @return The height of the tbm_surface if this function succeeds,
676 * otherwise an error status value
678 * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
682 #include <tbm_surface.h>
684 tbm_surface_h surface;
687 surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
691 height = tbm_surface_get_height (surface);
695 tbm_surface_destroy (surface);
698 int tbm_surface_get_height(tbm_surface_h surface);
701 * @brief Gets the format of the tbm_surface.
702 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
704 * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
706 * @param[in] surface The #tbm_surface_h
708 * @return The format of the tbm_surface on success,
709 * otherwise @c 0 on failure
711 * @retval #tbm_format The format of surface
713 * @exception #TBM_SURFACE_ERROR_NONE Success
714 * @exception #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
718 #include <tbm_surface.h>
720 tbm_surface_s surface;
723 surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
727 format = tbm_surface_get_format (surface);
731 tbm_surface_destroy (surface);
734 tbm_format tbm_surface_get_format(tbm_surface_h surface);
742 #endif /* _TBM_SURFACE_H_ */