Tizen Native API  7.0
TBM Surface

The tbm_surface stands for the surface in the tizen.

Required Header

#include <tbm_surface.h>

Overview

TBM Surface API provides user interface for The TBM Surface.
The user can get pointer of plane in the surface.
The user can store data to low level graphic buffer by using pointer of each plane.

Features :

  • Support formats RGB format and YUV format.
  • Get format list supported by the system.
  • Access the surface with the access type.
  • Support the multiple plane graphic buffer.
  • Get the information of surface and planes.

Functions

int tbm_surface_query_formats (uint32_t **formats, uint32_t *num)
 Queries surface format list and number of format supported by the system.
tbm_surface_h tbm_surface_create (int width, int height, tbm_format format)
 Creates the tbm_surface.
int tbm_surface_destroy (tbm_surface_h surface)
 Destroys the tbm_surface.
int tbm_surface_map (tbm_surface_h surface, int opt, tbm_surface_info_s *info)
 Maps the tbm_surface according to the access option.
int tbm_surface_unmap (tbm_surface_h surface)
 Unmaps the tbm_surface.
int tbm_surface_get_info (tbm_surface_h surface, tbm_surface_info_s *info)
 Gets the information of the tbm_surface.
int tbm_surface_get_width (tbm_surface_h surface)
 Gets the width of the tbm_surface.
int tbm_surface_get_height (tbm_surface_h surface)
 Gets the height of the tbm_surface.
tbm_format tbm_surface_get_format (tbm_surface_h surface)
 Gets the format of the tbm_surface.

Typedefs

typedef struct _tbm_surface_plane tbm_surface_plane_s
 Definition for the TBM plane struct.
typedef struct _tbm_surface_info tbm_surface_info_s
 Definition for the TBM surface information struct.
typedef struct _tbm_surface * tbm_surface_h
 Definition for the Tizen buffer surface.
typedef uint32_t tbm_format
 Definition for the Tizen buffer surface format.

Defines

#define TBM_SURF_PLANE_MAX   4
 Definition for the max number of TBM surface plane.
#define TBM_SURF_OPTION_READ   (1 << 0)
 Definition for the access option to read.
#define TBM_SURF_OPTION_WRITE   (1 << 1)
 Definition for the access option to write.
#define TBM_FORMAT_C8   __tbm_fourcc_code('C', '8', ' ', ' ')
 Definition for the TBM surface format C8 ([7:0] C).
#define TBM_FORMAT_RGB332   __tbm_fourcc_code('R', 'G', 'B', '8')
 Definition for the TBM surface format RGB322 ([7:0] R:G:B 3:3:2).
#define TBM_FORMAT_BGR233   __tbm_fourcc_code('B', 'G', 'R', '8')
 Definition for the TBM surface format RGB233 ([7:0] B:G:R 2:3:3).
#define TBM_FORMAT_XRGB4444   __tbm_fourcc_code('X', 'R', '1', '2')
 Definition for the TBM surface format XRGB4444 ([15:0] x:R:G:B 4:4:4:4 little endian).
#define TBM_FORMAT_XBGR4444   __tbm_fourcc_code('X', 'B', '1', '2')
 Definition for the TBM surface format XBRG4444 ([15:0] x:B:G:R 4:4:4:4 little endian).
#define TBM_FORMAT_RGBX4444   __tbm_fourcc_code('R', 'X', '1', '2')
 Definition for the TBM surface format RGBX4444 ([15:0] R:G:B:x 4:4:4:4 little endian).
#define TBM_FORMAT_BGRX4444   __tbm_fourcc_code('B', 'X', '1', '2')
 Definition for the TBM surface format BGRX4444 ([15:0] B:G:R:x 4:4:4:4 little endian).
#define TBM_FORMAT_ARGB4444   __tbm_fourcc_code('A', 'R', '1', '2')
 Definition for the TBM surface format ARGB4444 ([15:0] A:R:G:B 4:4:4:4 little endian).
#define TBM_FORMAT_ABGR4444   __tbm_fourcc_code('A', 'B', '1', '2')
 Definition for the TBM surface format ABGR4444 ([15:0] A:B:G:R 4:4:4:4 little endian).
#define TBM_FORMAT_RGBA4444   __tbm_fourcc_code('R', 'A', '1', '2')
 Definition for the TBM surface format RGBA4444 ([15:0] R:G:B:A 4:4:4:4 little endian).
#define TBM_FORMAT_BGRA4444   __tbm_fourcc_code('B', 'A', '1', '2')
 Definition for the TBM surface format BGRA4444 ([15:0] B:G:R:A 4:4:4:4 little endian).
#define TBM_FORMAT_XRGB1555   __tbm_fourcc_code('X', 'R', '1', '5')
 Definition for the TBM surface format XRGB1555 ([15:0] x:R:G:B 1:5:5:5 little endian).
#define TBM_FORMAT_XBGR1555   __tbm_fourcc_code('X', 'B', '1', '5')
 Definition for the TBM surface format XBGR1555 ([15:0] x:B:G:R 1:5:5:5 little endian).
#define TBM_FORMAT_RGBX5551   __tbm_fourcc_code('R', 'X', '1', '5')
 Definition for the TBM surface format RGBX5551 ([15:0] R:G:B:x 5:5:5:1 little endian).
#define TBM_FORMAT_BGRX5551   __tbm_fourcc_code('B', 'X', '1', '5')
 Definition for the TBM surface format BGRX5551 ([15:0] B:G:R:x 5:5:5:1 little endian).
#define TBM_FORMAT_ARGB1555   __tbm_fourcc_code('A', 'R', '1', '5')
 Definition for the TBM surface format ARGB1555 ([15:0] A:R:G:B 1:5:5:5 little endian).
#define TBM_FORMAT_ABGR1555   __tbm_fourcc_code('A', 'B', '1', '5')
 Definition for the TBM surface format ABGR1555 ([15:0] A:B:G:R 1:5:5:5 little endian).
#define TBM_FORMAT_RGBA5551   __tbm_fourcc_code('R', 'A', '1', '5')
 Definition for the TBM surface format RGBA5551 ([15:0] R:G:B:A 5:5:5:1 little endian).
#define TBM_FORMAT_BGRA5551   __tbm_fourcc_code('B', 'A', '1', '5')
 Definition for the TBM surface format BGRA5551 ([15:0] B:G:R:A 5:5:5:1 little endian).
#define TBM_FORMAT_RGB565   __tbm_fourcc_code('R', 'G', '1', '6')
 Definition for the TBM surface format RGB565 ([15:0] R:G:B 5:6:5 little endian).
#define TBM_FORMAT_BGR565   __tbm_fourcc_code('B', 'G', '1', '6')
 Definition for the TBM surface format BGR565 ([15:0] B:G:R 5:6:5 little endian).
#define TBM_FORMAT_RGB888   __tbm_fourcc_code('R', 'G', '2', '4')
 Definition for the TBM surface format RGB888 ([23:0] R:G:B little endian).
#define TBM_FORMAT_BGR888   __tbm_fourcc_code('B', 'G', '2', '4')
 Definition for the TBM surface format BGR888 ([23:0] B:G:R little endian).
#define TBM_FORMAT_XRGB8888   __tbm_fourcc_code('X', 'R', '2', '4')
 Definition for the TBM surface format XRGB8888 ([31:0] x:R:G:B 8:8:8:8 little endian).
#define TBM_FORMAT_XBGR8888   __tbm_fourcc_code('X', 'B', '2', '4')
 Definition for the TBM surface format XBGR8888 ([31:0] x:B:G:R 8:8:8:8 little endian).
#define TBM_FORMAT_RGBX8888   __tbm_fourcc_code('R', 'X', '2', '4')
 Definition for the TBM surface format RGBX8888 ([31:0] R:G:B:x 8:8:8:8 little endian).
#define TBM_FORMAT_BGRX8888   __tbm_fourcc_code('B', 'X', '2', '4')
 Definition for the TBM surface format BGRX8888 ([31:0] B:G:R:x 8:8:8:8 little endian).
#define TBM_FORMAT_ARGB8888   __tbm_fourcc_code('A', 'R', '2', '4')
 Definition for the TBM surface format ARGB8888 ([31:0] A:R:G:B 8:8:8:8 little endian).
#define TBM_FORMAT_ABGR8888   __tbm_fourcc_code('A', 'B', '2', '4')
 Definition for the TBM surface format ABGR8888 ([31:0] [31:0] A:B:G:R 8:8:8:8 little endian).
#define TBM_FORMAT_RGBA8888   __tbm_fourcc_code('R', 'A', '2', '4')
 Definition for the TBM surface format RGBA8888 ([31:0] R:G:B:A 8:8:8:8 little endian).
#define TBM_FORMAT_BGRA8888   __tbm_fourcc_code('B', 'A', '2', '4')
 Definition for the TBM surface format BGRA8888 ([31:0] B:G:R:A 8:8:8:8 little endian).
#define TBM_FORMAT_XRGB2101010   __tbm_fourcc_code('X', 'R', '3', '0')
 Definition for the TBM surface format XRGB2101010 ([31:0] x:R:G:B 2:10:10:10 little endian).
#define TBM_FORMAT_XBGR2101010   __tbm_fourcc_code('X', 'B', '3', '0')
 Definition for the TBM surface format XBGR2101010 ([31:0] x:B:G:R 2:10:10:10 little endian).
#define TBM_FORMAT_RGBX1010102   __tbm_fourcc_code('R', 'X', '3', '0')
 Definition for the TBM surface format RGBX1010102 ([31:0] R:G:B:x 10:10:10:2 little endian).
#define TBM_FORMAT_BGRX1010102   __tbm_fourcc_code('B', 'X', '3', '0')
 Definition for the TBM surface format BGRX1010102 ([31:0] B:G:R:x 10:10:10:2 little endian).
#define TBM_FORMAT_ARGB2101010   __tbm_fourcc_code('A', 'R', '3', '0')
 Definition for the TBM surface format ARGB2101010 ([31:0] A:R:G:B 2:10:10:10 little endian).
#define TBM_FORMAT_ABGR2101010   __tbm_fourcc_code('A', 'B', '3', '0')
 Definition for the TBM surface format ABGR2101010 ([31:0] A:B:G:R 2:10:10:10 little endian).
#define TBM_FORMAT_RGBA1010102   __tbm_fourcc_code('R', 'A', '3', '0')
 Definition for the TBM surface format RGBA1010102 ([31:0] R:G:B:A 10:10:10:2 little endian).
#define TBM_FORMAT_BGRA1010102   __tbm_fourcc_code('B', 'A', '3', '0') /* */
 Definition for the TBM surface format BGRA1010102 ([31:0] B:G:R:A 10:10:10:2 little endian).
#define TBM_FORMAT_YUYV   __tbm_fourcc_code('Y', 'U', 'Y', 'V')
 Definition for the TBM surface format YUYV ([31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian).
#define TBM_FORMAT_YVYU   __tbm_fourcc_code('Y', 'V', 'Y', 'U') /* */
 Definition for the TBM surface format YVYU ([31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian).
#define TBM_FORMAT_UYVY   __tbm_fourcc_code('U', 'Y', 'V', 'Y')
 Definition for the TBM surface format UYVY ([31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian).
#define TBM_FORMAT_VYUY   __tbm_fourcc_code('V', 'Y', 'U', 'Y')
 Definition for the TBM surface format VYUY ([31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian).
#define TBM_FORMAT_AYUV   __tbm_fourcc_code('A', 'Y', 'U', 'V')
 Definition for the TBM surface format AYUV ([31:0] A:Y:Cb:Cr 8:8:8:8 little endian).
#define TBM_FORMAT_NV12   __tbm_fourcc_code('N', 'V', '1', '2')
 Definition for the TBM surface format NV12 (2x2 subsampled Cr:Cb plane).
#define TBM_FORMAT_NV21   __tbm_fourcc_code('N', 'V', '2', '1') /* */
 Definition for the TBM surface format NV21 (2x2 subsampled Cb:Cr plane).
#define TBM_FORMAT_NV16   __tbm_fourcc_code('N', 'V', '1', '6')
 Definition for the TBM surface format NV16 (2x1 subsampled Cr:Cb plane).
#define TBM_FORMAT_NV61   __tbm_fourcc_code('N', 'V', '6', '1')
 Definition for the TBM surface format NV61 (2x1 subsampled Cb:Cr plane).
#define TBM_FORMAT_YUV410   __tbm_fourcc_code('Y', 'U', 'V', '9')
 Definition for the TBM surface format YUV410 (4x4 subsampled Cb (1) and Cr (2) planes).
#define TBM_FORMAT_YVU410   __tbm_fourcc_code('Y', 'V', 'U', '9')
 Definition for the TBM surface format YVU410 (4x4 subsampled Cr (1) and Cb (2) planes).
#define TBM_FORMAT_YUV411   __tbm_fourcc_code('Y', 'U', '1', '1')
 Definition for the TBM surface format YUV411 (4x1 subsampled Cb (1) and Cr (2) planes).
#define TBM_FORMAT_YVU411   __tbm_fourcc_code('Y', 'V', '1', '1')
 Definition for the TBM surface format YVU411 (4x1 subsampled Cr (1) and Cb (2) planes).
#define TBM_FORMAT_YUV420   __tbm_fourcc_code('Y', 'U', '1', '2')
 Definition for the TBM surface format YUV420 (2x2 subsampled Cb (1) and Cr (2) planes).
#define TBM_FORMAT_YVU420   __tbm_fourcc_code('Y', 'V', '1', '2')
 Definition for the TBM surface format YVU420 (2x2 subsampled Cr (1) and Cb (2) planes).
#define TBM_FORMAT_YUV422   __tbm_fourcc_code('Y', 'U', '1', '6')
 Definition for the TBM surface format YUV422 (2x1 subsampled Cb (1) and Cr (2) planes).
#define TBM_FORMAT_YVU422   __tbm_fourcc_code('Y', 'V', '1', '6')
 Definition for the TBM surface format YVU422 (2x1 subsampled Cr (1) and Cb (2) planes).
#define TBM_FORMAT_YUV444   __tbm_fourcc_code('Y', 'U', '2', '4')
 Definition for the TBM surface format YUV444 (non-subsampled Cb (1) and Cr (2) planes).
#define TBM_FORMAT_YVU444   __tbm_fourcc_code('Y', 'V', '2', '4')
 Definition for the TBM surface format YVU444 (non-subsampled Cr (1) and Cb (2) planes).
#define TBM_FORMAT_NV12MT   __tbm_fourcc_code('T', 'M', '1', '2')
 Definition for the TBM surface format NV12MT (tiled '64x32' & multi-plane version of NV12).

Define Documentation

#define TBM_FORMAT_ABGR1555   __tbm_fourcc_code('A', 'B', '1', '5')

Definition for the TBM surface format ABGR1555 ([15:0] A:B:G:R 1:5:5:5 little endian).

Since :
2.3
#define TBM_FORMAT_ABGR2101010   __tbm_fourcc_code('A', 'B', '3', '0')

Definition for the TBM surface format ABGR2101010 ([31:0] A:B:G:R 2:10:10:10 little endian).

Since :
2.3
#define TBM_FORMAT_ABGR4444   __tbm_fourcc_code('A', 'B', '1', '2')

Definition for the TBM surface format ABGR4444 ([15:0] A:B:G:R 4:4:4:4 little endian).

Since :
2.3
#define TBM_FORMAT_ABGR8888   __tbm_fourcc_code('A', 'B', '2', '4')

Definition for the TBM surface format ABGR8888 ([31:0] [31:0] A:B:G:R 8:8:8:8 little endian).

Since :
2.3
#define TBM_FORMAT_ARGB1555   __tbm_fourcc_code('A', 'R', '1', '5')

Definition for the TBM surface format ARGB1555 ([15:0] A:R:G:B 1:5:5:5 little endian).

Since :
2.3
#define TBM_FORMAT_ARGB2101010   __tbm_fourcc_code('A', 'R', '3', '0')

Definition for the TBM surface format ARGB2101010 ([31:0] A:R:G:B 2:10:10:10 little endian).

Since :
2.3
#define TBM_FORMAT_ARGB4444   __tbm_fourcc_code('A', 'R', '1', '2')

Definition for the TBM surface format ARGB4444 ([15:0] A:R:G:B 4:4:4:4 little endian).

Since :
2.3
#define TBM_FORMAT_ARGB8888   __tbm_fourcc_code('A', 'R', '2', '4')

Definition for the TBM surface format ARGB8888 ([31:0] A:R:G:B 8:8:8:8 little endian).

Since :
2.3
#define TBM_FORMAT_AYUV   __tbm_fourcc_code('A', 'Y', 'U', 'V')

Definition for the TBM surface format AYUV ([31:0] A:Y:Cb:Cr 8:8:8:8 little endian).

Since :
2.3
#define TBM_FORMAT_BGR233   __tbm_fourcc_code('B', 'G', 'R', '8')

Definition for the TBM surface format RGB233 ([7:0] B:G:R 2:3:3).

Since :
2.3
#define TBM_FORMAT_BGR565   __tbm_fourcc_code('B', 'G', '1', '6')

Definition for the TBM surface format BGR565 ([15:0] B:G:R 5:6:5 little endian).

Since :
2.3
#define TBM_FORMAT_BGR888   __tbm_fourcc_code('B', 'G', '2', '4')

Definition for the TBM surface format BGR888 ([23:0] B:G:R little endian).

Since :
2.3
#define TBM_FORMAT_BGRA1010102   __tbm_fourcc_code('B', 'A', '3', '0') /* */

Definition for the TBM surface format BGRA1010102 ([31:0] B:G:R:A 10:10:10:2 little endian).

Since :
2.3
#define TBM_FORMAT_BGRA4444   __tbm_fourcc_code('B', 'A', '1', '2')

Definition for the TBM surface format BGRA4444 ([15:0] B:G:R:A 4:4:4:4 little endian).

Since :
2.3
#define TBM_FORMAT_BGRA5551   __tbm_fourcc_code('B', 'A', '1', '5')

Definition for the TBM surface format BGRA5551 ([15:0] B:G:R:A 5:5:5:1 little endian).

Since :
2.3
#define TBM_FORMAT_BGRA8888   __tbm_fourcc_code('B', 'A', '2', '4')

Definition for the TBM surface format BGRA8888 ([31:0] B:G:R:A 8:8:8:8 little endian).

Since :
2.3
#define TBM_FORMAT_BGRX1010102   __tbm_fourcc_code('B', 'X', '3', '0')

Definition for the TBM surface format BGRX1010102 ([31:0] B:G:R:x 10:10:10:2 little endian).

Since :
2.3
#define TBM_FORMAT_BGRX4444   __tbm_fourcc_code('B', 'X', '1', '2')

Definition for the TBM surface format BGRX4444 ([15:0] B:G:R:x 4:4:4:4 little endian).

Since :
2.3
#define TBM_FORMAT_BGRX5551   __tbm_fourcc_code('B', 'X', '1', '5')

Definition for the TBM surface format BGRX5551 ([15:0] B:G:R:x 5:5:5:1 little endian).

Since :
2.3
#define TBM_FORMAT_BGRX8888   __tbm_fourcc_code('B', 'X', '2', '4')

Definition for the TBM surface format BGRX8888 ([31:0] B:G:R:x 8:8:8:8 little endian).

Since :
2.3
#define TBM_FORMAT_C8   __tbm_fourcc_code('C', '8', ' ', ' ')

Definition for the TBM surface format C8 ([7:0] C).

Since :
2.3
#define TBM_FORMAT_NV12   __tbm_fourcc_code('N', 'V', '1', '2')

Definition for the TBM surface format NV12 (2x2 subsampled Cr:Cb plane).

Since :
2.3
#define TBM_FORMAT_NV12MT   __tbm_fourcc_code('T', 'M', '1', '2')

Definition for the TBM surface format NV12MT (tiled '64x32' & multi-plane version of NV12).

Since :
3.0
#define TBM_FORMAT_NV16   __tbm_fourcc_code('N', 'V', '1', '6')

Definition for the TBM surface format NV16 (2x1 subsampled Cr:Cb plane).

Since :
2.3
#define TBM_FORMAT_NV21   __tbm_fourcc_code('N', 'V', '2', '1') /* */

Definition for the TBM surface format NV21 (2x2 subsampled Cb:Cr plane).

Since :
2.3
#define TBM_FORMAT_NV61   __tbm_fourcc_code('N', 'V', '6', '1')

Definition for the TBM surface format NV61 (2x1 subsampled Cb:Cr plane).

Since :
2.3
#define TBM_FORMAT_RGB332   __tbm_fourcc_code('R', 'G', 'B', '8')

Definition for the TBM surface format RGB322 ([7:0] R:G:B 3:3:2).

Since :
2.3
#define TBM_FORMAT_RGB565   __tbm_fourcc_code('R', 'G', '1', '6')

Definition for the TBM surface format RGB565 ([15:0] R:G:B 5:6:5 little endian).

Since :
2.3
#define TBM_FORMAT_RGB888   __tbm_fourcc_code('R', 'G', '2', '4')

Definition for the TBM surface format RGB888 ([23:0] R:G:B little endian).

Since :
2.3
#define TBM_FORMAT_RGBA1010102   __tbm_fourcc_code('R', 'A', '3', '0')

Definition for the TBM surface format RGBA1010102 ([31:0] R:G:B:A 10:10:10:2 little endian).

Since :
2.3
#define TBM_FORMAT_RGBA4444   __tbm_fourcc_code('R', 'A', '1', '2')

Definition for the TBM surface format RGBA4444 ([15:0] R:G:B:A 4:4:4:4 little endian).

Since :
2.3
#define TBM_FORMAT_RGBA5551   __tbm_fourcc_code('R', 'A', '1', '5')

Definition for the TBM surface format RGBA5551 ([15:0] R:G:B:A 5:5:5:1 little endian).

Since :
2.3
#define TBM_FORMAT_RGBA8888   __tbm_fourcc_code('R', 'A', '2', '4')

Definition for the TBM surface format RGBA8888 ([31:0] R:G:B:A 8:8:8:8 little endian).

Since :
2.3
#define TBM_FORMAT_RGBX1010102   __tbm_fourcc_code('R', 'X', '3', '0')

Definition for the TBM surface format RGBX1010102 ([31:0] R:G:B:x 10:10:10:2 little endian).

Since :
2.3
#define TBM_FORMAT_RGBX4444   __tbm_fourcc_code('R', 'X', '1', '2')

Definition for the TBM surface format RGBX4444 ([15:0] R:G:B:x 4:4:4:4 little endian).

Since :
2.3
#define TBM_FORMAT_RGBX5551   __tbm_fourcc_code('R', 'X', '1', '5')

Definition for the TBM surface format RGBX5551 ([15:0] R:G:B:x 5:5:5:1 little endian).

Since :
2.3
#define TBM_FORMAT_RGBX8888   __tbm_fourcc_code('R', 'X', '2', '4')

Definition for the TBM surface format RGBX8888 ([31:0] R:G:B:x 8:8:8:8 little endian).

Since :
2.3
#define TBM_FORMAT_UYVY   __tbm_fourcc_code('U', 'Y', 'V', 'Y')

Definition for the TBM surface format UYVY ([31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian).

Since :
2.3
#define TBM_FORMAT_VYUY   __tbm_fourcc_code('V', 'Y', 'U', 'Y')

Definition for the TBM surface format VYUY ([31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian).

Since :
2.3
#define TBM_FORMAT_XBGR1555   __tbm_fourcc_code('X', 'B', '1', '5')

Definition for the TBM surface format XBGR1555 ([15:0] x:B:G:R 1:5:5:5 little endian).

Since :
2.3
#define TBM_FORMAT_XBGR2101010   __tbm_fourcc_code('X', 'B', '3', '0')

Definition for the TBM surface format XBGR2101010 ([31:0] x:B:G:R 2:10:10:10 little endian).

Since :
2.3
#define TBM_FORMAT_XBGR4444   __tbm_fourcc_code('X', 'B', '1', '2')

Definition for the TBM surface format XBRG4444 ([15:0] x:B:G:R 4:4:4:4 little endian).

Since :
2.3
#define TBM_FORMAT_XBGR8888   __tbm_fourcc_code('X', 'B', '2', '4')

Definition for the TBM surface format XBGR8888 ([31:0] x:B:G:R 8:8:8:8 little endian).

Since :
2.3
#define TBM_FORMAT_XRGB1555   __tbm_fourcc_code('X', 'R', '1', '5')

Definition for the TBM surface format XRGB1555 ([15:0] x:R:G:B 1:5:5:5 little endian).

Since :
2.3
#define TBM_FORMAT_XRGB2101010   __tbm_fourcc_code('X', 'R', '3', '0')

Definition for the TBM surface format XRGB2101010 ([31:0] x:R:G:B 2:10:10:10 little endian).

Since :
2.3
#define TBM_FORMAT_XRGB4444   __tbm_fourcc_code('X', 'R', '1', '2')

Definition for the TBM surface format XRGB4444 ([15:0] x:R:G:B 4:4:4:4 little endian).

Since :
2.3
#define TBM_FORMAT_XRGB8888   __tbm_fourcc_code('X', 'R', '2', '4')

Definition for the TBM surface format XRGB8888 ([31:0] x:R:G:B 8:8:8:8 little endian).

Since :
2.3
#define TBM_FORMAT_YUV411   __tbm_fourcc_code('Y', 'U', '1', '1')

Definition for the TBM surface format YUV411 (4x1 subsampled Cb (1) and Cr (2) planes).

Since :
2.3
#define TBM_FORMAT_YUV420   __tbm_fourcc_code('Y', 'U', '1', '2')

Definition for the TBM surface format YUV420 (2x2 subsampled Cb (1) and Cr (2) planes).

Since :
2.3
#define TBM_FORMAT_YUV422   __tbm_fourcc_code('Y', 'U', '1', '6')

Definition for the TBM surface format YUV422 (2x1 subsampled Cb (1) and Cr (2) planes).

Since :
2.3
#define TBM_FORMAT_YUV444   __tbm_fourcc_code('Y', 'U', '2', '4')

Definition for the TBM surface format YUV444 (non-subsampled Cb (1) and Cr (2) planes).

Since :
2.3
#define TBM_FORMAT_YUYV   __tbm_fourcc_code('Y', 'U', 'Y', 'V')

Definition for the TBM surface format YUYV ([31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian).

Since :
2.3
#define TBM_FORMAT_YVU410   __tbm_fourcc_code('Y', 'V', 'U', '9')

Definition for the TBM surface format YVU410 (4x4 subsampled Cr (1) and Cb (2) planes).

Since :
2.3
#define TBM_FORMAT_YVU411   __tbm_fourcc_code('Y', 'V', '1', '1')

Definition for the TBM surface format YVU411 (4x1 subsampled Cr (1) and Cb (2) planes).

Since :
2.3
#define TBM_FORMAT_YVU420   __tbm_fourcc_code('Y', 'V', '1', '2')

Definition for the TBM surface format YVU420 (2x2 subsampled Cr (1) and Cb (2) planes).

Since :
2.3
#define TBM_FORMAT_YVU422   __tbm_fourcc_code('Y', 'V', '1', '6')

Definition for the TBM surface format YVU422 (2x1 subsampled Cr (1) and Cb (2) planes).

Since :
2.3
#define TBM_FORMAT_YVU444   __tbm_fourcc_code('Y', 'V', '2', '4')

Definition for the TBM surface format YVU444 (non-subsampled Cr (1) and Cb (2) planes).

Since :
2.3
#define TBM_FORMAT_YVYU   __tbm_fourcc_code('Y', 'V', 'Y', 'U') /* */

Definition for the TBM surface format YVYU ([31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian).

Since :
2.3
#define TBM_SURF_OPTION_READ   (1 << 0)

Definition for the access option to read.

Since :
2.3
#define TBM_SURF_OPTION_WRITE   (1 << 1)

Definition for the access option to write.

Since :
2.3
#define TBM_SURF_PLANE_MAX   4

Definition for the max number of TBM surface plane.

Since :
2.3

Typedef Documentation

typedef uint32_t tbm_format

Definition for the Tizen buffer surface format.

Since :
2.3
typedef struct _tbm_surface* tbm_surface_h

Definition for the Tizen buffer surface.

Since :
2.3

Definition for the TBM surface information struct.

Since :
2.3

Definition for the TBM plane struct.

Since :
2.3

Enumeration Type Documentation

Enumeration for tbm_surface error type.

Since :
2.3
Enumerator:
TBM_SURFACE_ERROR_NONE 

Successful

TBM_SURFACE_ERROR_INVALID_PARAMETER 

Invalid parameter

TBM_SURFACE_ERROR_INVALID_OPERATION 

Invalid Operation


Function Documentation

tbm_surface_h tbm_surface_create ( int  width,
int  height,
tbm_format  format 
)

Creates the tbm_surface.

This function creates the tbm_surface with the given width, height, and format.

Since :
2.3
Remarks:
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
Parameters:
[in]widthThe width of surface
[in]heightThe height of surface
[in]formatThe format of surface
Returns:
tbm_surface_h on success, otherwise NULL
Return values:
tbm_surface_hThe TBM surface handle
Exceptions:
TBM_SURFACE_ERROR_NONESuccess
TBM_SURFACE_ERROR_INVALID_PARAMETERInvalid parameter
TBM_SURFACE_ERROR_INVALID_OPERATIONInvalid operation
See also:
tbm_surface_destroy()
Example
   #include <tbm_surface.h>

   tbm_surface_h surface;

   surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);

   ...

   tbm_surface_destroy (surface);

Destroys the tbm_surface.

Since :
2.3
Parameters:
[in]surfaceThe tbm_surface_h
Returns:
TBM_SURFACE_ERROR_NONE on success, otherwise an error status value
Return values:
TBM_SURFACE_ERROR_NONESuccess
TBM_SURFACE_ERROR_INVALID_PARAMETERInvalid parameter
See also:
tbm_surface_create()
Example
   #include <tbm_surface.h>

   tbm_surface_h surface;

   surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);

   ...

   tbm_surface_destroy (surface);

Gets the format of the tbm_surface.

Since :
2.3
Remarks:
The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
Parameters:
[in]surfaceThe tbm_surface_h
Returns:
The format of the tbm_surface on success, otherwise 0 on failure
Return values:
tbm_formatThe format of surface
Exceptions:
TBM_SURFACE_ERROR_NONESuccess
TBM_SURFACE_ERROR_INVALID_PARAMETERInvalid parameter
Example
   #include <tbm_surface.h>

   tbm_surface_s surface;
   tbm_format format;

   surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);

   ...

   format = tbm_surface_get_format (surface);

   ...

   tbm_surface_destroy (surface);

Gets the height of the tbm_surface.

Since :
2.3
Parameters:
[in]surfaceThe tbm_surface_h
Returns:
The height of the tbm_surface if this function succeeds, otherwise an error status value
Return values:
TBM_SURFACE_ERROR_INVALID_PARAMETERInvalid parameter
Example
   #include <tbm_surface.h>

   tbm_surface_h surface;
   int height;

   surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);

   ...

   height = tbm_surface_get_height (surface);

   ...

   tbm_surface_destroy (surface);
int tbm_surface_get_info ( tbm_surface_h  surface,
tbm_surface_info_s info 
)

Gets the information of the tbm_surface.

The information of tbm_surface is assigned in tbm_surface_info_s struct.
The information of tbm_surface has width, height, format, bpp, size, number of planes and information of planes.
The information of planes has stride, offset, size and pointer of plane.

Since :
2.3
Parameters:
[in]surfaceThe tbm_surface_h
[out]infoThe information of the tbm_surface
Returns:
TBM_SURFACE_ERROR_NONE on success, otherwise an error status value
Return values:
TBM_SURFACE_ERROR_NONESuccess
TBM_SURFACE_ERROR_INVALID_PARAMETERInvalid parameter
TBM_SURFACE_ERROR_INVALID_OPERATIONInvalid operation
See also:
tbm_surface_map()
Example
   #include <tbm_surface.h>

   tbm_surface_h surface;
   tbm_surface_info_s info;
   int ret;

   surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
   ret = tbm_surface_get_info (surface, &info);

   ...

   tbm_surface_destroy (surface);

Gets the width of the tbm_surface.

Since :
2.3
Parameters:
[in]surfaceThe tbm_surface_h
Returns:
The width of the tbm_surface on success, otherwise an error status value
Return values:
TBM_SURFACE_ERROR_INVALID_PARAMETERInvalid parameter
Example
   #include <tbm_surface.h>

   tbm_surface_h surface;
   int width;

   surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);

   ...

   width = tbm_surface_get_width (surface);

   ...

   tbm_surface_destroy (surface);
int tbm_surface_map ( tbm_surface_h  surface,
int  opt,
tbm_surface_info_s info 
)

Maps the tbm_surface according to the access option.

After mapping tbm_surface, the information of tbm_surface is assigned in tbm_surface_info_s struct.
The information of tbm_surface has width, height, format, bpp, size, number of planes and information of planes.
The information of planes has stride, offset, size and pointer of plane.
TBM_SURF_OPTION_READ indicates access option to read.
TBM_SURF_OPTION_WRITE indicates access option to write.

Since :
2.3
Parameters:
[in]surfaceThe tbm_surface_h
[in]optThe option to access the tbm_surface
[out]infoThe information of the tbm_surface
Returns:
TBM_SURFACE_ERROR_NONE on success, otherwise an error status value
Return values:
TBM_SURFACE_ERROR_NONESuccess
TBM_SURFACE_ERROR_INVALID_PARAMETERInvalid parameter
TBM_SURFACE_ERROR_INVALID_OPERATIONInvalid operation
See also:
tbm_surface_unmap();
Example
   #include <tbm_surface.h>

   tbm_surface_h surface;
   tbm_surface_info_s info;
   int ret;

   surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
   ret = tbm_surface_map (surface, TBM_SURF_OPTION_WRITE|TBM_SURF_OPTION_READ, &info);

   ...

   tbm_surface_unmap (surface);
   tbm_surface_destroy (surface);
int tbm_surface_query_formats ( uint32_t **  formats,
uint32_t *  num 
)

Queries surface format list and number of format supported by the system.

Since :
2.3
Remarks:
You must release the formats using free().
Parameters:
[out]formatsThe format array which the system can support
This pointer has to be freed by user.
[out]numThe number of formats
Returns:
TBM_SURFACE_ERROR_NONE if this function succeeds, otherwise an error status value
Return values:
TBM_SURFACE_ERROR_NONESuccess
TBM_SURFACE_ERROR_INVALID_OPERATIONInvalid operation
Example
   #include <tbm_surface.h>

   uint32_t *formats;
   uint32_t format_num;
   int ret, i;
   tbm_surface_error_e tse;

   tse = tbm_surface_query_formats (&formats, &format_num))

   for( i = 0 ; i < format_num ; i++)
   {
       if (formats[i] == TBM_FORMAT_RGB332)
       {
   ....

   free (formats);
int tbm_surface_unmap ( tbm_surface_h  surface)

Unmaps the tbm_surface.

Since :
2.3
Parameters:
[in]surfaceThe tbm_surface_h
Returns:
TBM_SURFACE_ERROR_NONE on success, otherwise an error status value
Return values:
TBM_SURFACE_ERROR_NONESuccess
TBM_SURFACE_ERROR_INVALID_PARAMETERInvalid parameter
See also:
tbm_surface_map()
Example
   #include <tbm_surface.h>

   tbm_surface_h surface;
   tbm_surface_info_s info;
   int ret;

   surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
   ret = tbm_surface_map (surface, TBM_SURF_OPTION_WRITE|TBM_SURF_OPTION_READ, &info);

   ...

   tbm_surface_unmap (surface);
   tbm_surface_destroy (surface);