Tizen Native API
3.0
|
BufferImage represents an image resource as a pixel data buffer. More...
Public Member Functions | |
BufferImage () | |
Constructor which creates an uninitialized BufferImage object. | |
~BufferImage () | |
Destructor. | |
BufferImage (const BufferImage &handle) | |
This copy constructor is required for (smart) pointer semantics. | |
BufferImage & | operator= (const BufferImage &rhs) |
This assignment operator is required for (smart) pointer semantics. | |
PixelBuffer * | GetBuffer () |
Returns the pixel buffer of the Image. | |
unsigned int | GetBufferSize () const |
Returns buffer size in bytes. | |
unsigned int | GetBufferStride () const |
Returns buffer stride (in bytes). | |
Pixel::Format | GetPixelFormat () const |
Returns the pixel format of the contained buffer. | |
void | Update () |
Inform Dali that the contents of the buffer have changed. | |
void | Update (RectArea updateArea) |
bool | IsDataExternal () const |
Returns whether BufferImage uses external data source or not. | |
Static Public Member Functions | |
static BufferImage | New (unsigned int width, unsigned int height, Pixel::Format pixelformat=Pixel::RGBA8888) |
Creates a new BufferImage. | |
static BufferImage | New (PixelBuffer *pixelBuffer, unsigned int width, unsigned int height, Pixel::Format pixelFormat=Pixel::RGBA8888, unsigned int stride=0) |
Creates a new BufferImage, which uses an external data source. | |
static BufferImage | DownCast (BaseHandle handle) |
Downcasts a handle to BufferImage handle. | |
static const BufferImage | WHITE () |
White pixel as image data. |
Detailed Description
BufferImage represents an image resource as a pixel data buffer.
Its pixel buffer data is provided by the application developer.
If the pixel format of the pixel buffer contains an alpha channel, then the image is considered to be have transparent pixels without regard for the actual content of the channel, and will be blended.
- Since:
- 2.4, DALi version 1.0.0
Constructor & Destructor Documentation
Constructor which creates an uninitialized BufferImage object.
Use BufferImage::New(...) to create an initialized object.
- Since:
- 2.4, DALi version 1.0.0
Destructor.
This is non-virtual since derived Handle types must not contain data or virtual methods.
- Since:
- 2.4, DALi version 1.0.0
Dali::BufferImage::BufferImage | ( | const BufferImage & | handle | ) |
This copy constructor is required for (smart) pointer semantics.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] handle A reference to the copied handle
Member Function Documentation
static BufferImage Dali::BufferImage::DownCast | ( | BaseHandle | handle | ) | [static] |
Downcasts a handle to BufferImage handle.
If the handle points to a BufferImage, the downcast produces valid handle. If not, the returned handle is left uninitialized.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] handle Handle to an object
- Returns:
- Handle to a BufferImage or an uninitialized handle
Reimplemented from Dali::Image.
Returns the pixel buffer of the Image.
The application can write to the buffer to modify its contents.
Whilst the image is on stage, after writing to the buffer the application should call Update() and wait for the Image::UploadedSignal() method before writing again.
- Since:
- 2.4, DALi version 1.0.0
- Returns:
- The pixel buffer
unsigned int Dali::BufferImage::GetBufferSize | ( | ) | const |
Returns buffer size in bytes.
- Since:
- 2.4, DALi version 1.0.0
- Returns:
- The buffer size in bytes
unsigned int Dali::BufferImage::GetBufferStride | ( | ) | const |
Returns buffer stride (in bytes).
- Since:
- 2.4, DALi version 1.0.0
- Returns:
- The buffer stride
Returns the pixel format of the contained buffer.
- Since:
- 2.4, DALi version 1.0.0
- Returns:
- The pixel format
bool Dali::BufferImage::IsDataExternal | ( | ) | const |
Returns whether BufferImage uses external data source or not.
If not, dali holds ownership of the PixelBuffer, otherwise the application is responsible for freeing it.
The application must not destroy an external PixelBuffer on a staged image if it has called Update() and hasn't received a Image::UploadedSignal.
- Since:
- 2.4, DALi version 1.0.0
- Returns:
true
if application owns data,false
otherwise
static BufferImage Dali::BufferImage::New | ( | unsigned int | width, |
unsigned int | height, | ||
Pixel::Format | pixelformat = Pixel::RGBA8888 |
||
) | [static] |
Creates a new BufferImage.
Also a pixel buffer for image data is allocated. Dali has ownership of the buffer. For better performance and portability use power of two dimensions. The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] width Image width in pixels [in] height Image height in pixels [in] pixelformat The pixel format (rgba 32 bit by default)
- Returns:
- A handle to a new instance of BufferImage
- Precondition:
- width & height are greater than zero
- Note:
- default resource management policies are Immediate and Never
static BufferImage Dali::BufferImage::New | ( | PixelBuffer * | pixelBuffer, |
unsigned int | width, | ||
unsigned int | height, | ||
Pixel::Format | pixelFormat = Pixel::RGBA8888 , |
||
unsigned int | stride = 0 |
||
) | [static] |
Creates a new BufferImage, which uses an external data source.
The PixelBuffer has to be allocated by application.
The application holds ownership of the buffer. It must not destroy the PixelBuffer on a staged image if it has called Update() and hasn't received a Image::UploadedSignal, or if it has just added it to the stage and has not received a Image::UploadedSignal.
For better performance and portability use power of two dimensions. The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] pixelBuffer Pixel buffer has to be allocated by application [in] width Image width in pixels [in] height Image height in pixels [in] pixelFormat The pixel format (rgba 32 bit by default) [in] stride The internal stride of the pixelbuffer in pixels
- Returns:
- A handle to a new instance of BufferImage
- Precondition:
- width & height are greater than zero
BufferImage& Dali::BufferImage::operator= | ( | const BufferImage & | rhs | ) |
This assignment operator is required for (smart) pointer semantics.
- Since:
- 2.4, DALi version 1.0.0
- Parameters:
-
[in] rhs A reference to the copied handle
- Returns:
- A reference to this
void Dali::BufferImage::Update | ( | ) |
Inform Dali that the contents of the buffer have changed.
Image::UploadedSignal will be sent in response if the image is on stage and the image data has been successfully copied to graphics memory. To avoid visual tearing, the application should wait for the Image::UploadedSignal before modifying the data.
The application must not destroy an external PixelBuffer on a staged image after calling this method until the Image::UploadedSignal has been successfully received.
- Since:
- 2.4, DALi version 1.0.0
- Note:
- BufferImage::Update might not work with BGR/BGRA formats!
- Some GPUs may not support Non power of two buffer updates (for example C110/SGX540)
void Dali::BufferImage::Update | ( | RectArea | updateArea | ) |
Inform Dali that the contents of the buffer have changed.
Image::UploadedSignal will be sent in response if the image is on stage and the image data has been successfully copied to graphics memory. To avoid visual tearing, the application should wait for the Image::UploadedSignal before modifying the data.
The application must not destroy an external PixelBuffer on a staged image after calling this method until the Image::UploadedSignal has been successfully received.
- Since:
- 2.4, DALi version 1.0.0
- Note:
- BufferImage::Update might not work with BGR/BGRA formats!
- Some GPUs may not support Non power of two buffer updates (for example C110/SGX540)
- Parameters:
-
[in] updateArea Area that has changed in buffer
static const BufferImage Dali::BufferImage::WHITE | ( | ) | [static] |
White pixel as image data.
Can be used to create solid color actors.
- Since:
- 2.4, DALi version 1.0.0
- Returns:
- 1 white pixel with 32 bit colordepth