# Surface ## **Overview** Provides the capabilities of applying for and releasing shared memory in multimedia and graphics scenarios. Provides shared memory for multimedia and graphics. This module is used to apply for and release shared memory and is used by the multimedia and graphics modules across processes. **Since:** 1.0 **Version:** 1.0 **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Files
Called to notify a consumer that a buffer is available for consumption. |
|
static Surface * A constructor used to create a Surface object for consumers to use. |
|
A destructor used to delete the Surface instance. |
|
OHOS::Surface::SetQueueSize (uint8_t queueSize)=0 |
Sets the number of buffers that can be allocated to the surface. The default value is 1. The value range is [1, 10]. |
Obtains the number of surface buffers that can be allocated to the surface. The default value is 1. The value range is [1, 10]. |
|
OHOS::Surface::SetWidthAndHeight (uint32_t width, uint32_t height)=0 |
Sets the width and height of the surface for calculating its stride and size. The default value range of width and height is (0,7680]. |
OHOS::Surface::SetFormat (uint32_t format)=0 |
Sets the pixel format of the surface. For details, see ImageFormat. The default pixel format is IMAGE_PIXEL_FORMAT_RGB565. |
Obtains the pixel format of the surface. For details, see ImageFormat. The default pixel format is IMAGE_PIXEL_FORMAT_RGB565. |
|
OHOS::Surface::SetStrideAlignment (uint32_t strideAlignment)=0 |
|
Obtains the number of bytes for stride alignment. By default, 4-byte aligned is used. |
|
OHOS::Surface::SetSize (uint32_t size)=0 |
|
OHOS::Surface::SetUsage (uint32_t usage)=0 |
Sets the usage scenario of the buffer. Physically contiguous memory and virtual memory (by default) are supported. By default, virtual memory is allocated. |
Obtains the usage scenario of the buffer. Physically contiguous memory and virtual memory are supported. |
|
OHOS::Surface::SetUserData (const std::string &key, const std::string &value)=0 |
Sets surface user data, which is stored in the format of <key, value>. |
OHOS::Surface::GetUserData (const std::string &key)=0 |
|
OHOS::Surface::RequestBuffer (uint8_t wait=0)=0 |
virtual SurfaceBuffer * |
OHOS::Surface::FlushBuffer (SurfaceBuffer *buffer)=0 |
|
virtual SurfaceBuffer * |
|
OHOS::Surface::ReleaseBuffer (SurfaceBuffer *buffer)=0 |
|
OHOS::Surface::CancelBuffer (SurfaceBuffer *buffer)=0 |
|
OHOS::Surface::RegisterConsumerListener (IBufferConsumerListener &listener)=0 |
|
OHOS::SurfaceBuffer::GetVirAddr () const =0 |
Obtains the virtual address of shared memory for producers and consumers. |
OHOS::SurfaceBuffer::GetPhyAddr () const =0 |
|
OHOS::SurfaceBuffer::GetSize () const =0 |
|
OHOS::SurfaceBuffer::SetSize (uint32_t size)=0 |
|
OHOS::SurfaceBuffer::SetInt32 (uint32_t key, int32_t value)=0 |
|
OHOS::SurfaceBuffer::GetInt32 (uint32_t key, int32_t &value)=0 |
|
OHOS::SurfaceBuffer::SetInt64 (uint32_t key, int64_t value)=0 |
|
OHOS::SurfaceBuffer::GetInt64 (uint32_t key, int64_t &value)=0 |
SurfaceBuffer | Indicates the pointer to the buffer to be released by producers. |
SurfaceBuffer | Indicates the pointer to the buffer flushed by producers. |
key | Indicates the key of a key-value pair for which the value is to be obtained. |
value | Indicates the value of the key-value pair obtained. |
key | Indicates the key of a key-value pair for which the value is to be obtained. |
value | Indicates the value of the key-value pair obtained. |
key | Indicates the key of a key-value pair for which the value is to be obtained. |
IBufferConsumerListener | Indicates the listener to register. |
SurfaceBuffer | Indicates the pointer to the buffer released. |
format | Indicates the pixel format to be set. |
key | Indicates the key of a key-value pair to set. |
value | Indicates the value of the key-value pair to set. |
key | Indicates the key of a key-value pair to set. |
value | Indicates the value of the key-value pair to set. |
queueSize | Indicates the number of buffers to set. |
size | Indicates the size of shared memory to set. |
size | Indicates the size of the shared memory. The value range is (0,58982400]. |
strideAlignment | Indicates the number of bytes for stride alignment. |
usage | Indicates the usage scenario of the buffer. For details, see BUFFER_CONSUMER_USAGE. |
key | Indicates the key of a key-value pair to store. |
value | Indicates the value of the key-value pair to store. |
width | Indicates the surface width, in pixels. |
height | Indicates the surface height, in pixels. |