Tizen Native API  6.5
Dali::NativeImageSource Class Reference

Used for displaying native images. More...

Inheritance diagram for Dali::NativeImageSource:
Dali::NativeImageInterface Dali::RefObject

Public Types

enum  ColorDepth
 Enumeration for the instance when creating a native image, the color depth has to be specified. More...

Public Member Functions

Any GetNativeImageSource ()
 Retrieves the internal native image.
bool GetPixels (std::vector< unsigned char > &pixbuf, unsigned int &width, unsigned int &height, Pixel::Format &pixelFormat) const
 Gets a copy of the pixels used by NativeImageSource.
bool EncodeToFile (const std::string &filename) const
 Converts the current pixel contents to either a JPEG or PNG format and write that to the filesystem.
void SetSource (Any source)
 Sets an existing source.
bool IsColorDepthSupported (ColorDepth colorDepth)
 Checks if the specified color depth is supported.

Static Public Member Functions

static NativeImageSourcePtr New (unsigned int width, unsigned int height, ColorDepth depth)
 Creates a new NativeImageSource.
static NativeImageSourcePtr New (Any nativeImageSource)
 Creates a new NativeImageSource from an existing native image source.

Detailed Description

Used for displaying native images.

NativeImageSource can be created internally or externally by native image source. NativeImage is a platform specific way of providing pixel data to the GPU for rendering, for example via an EGL image.

Since:
3.0, DALi version 1.1.4
See also:
NativeImage

Member Enumeration Documentation

Enumeration for the instance when creating a native image, the color depth has to be specified.

Since:
2.4, DALi version 1.0.0
Enumerator:
COLOR_DEPTH_DEFAULT 

Uses the current screen default depth (recommended)

Since:
2.4, DALi version 1.0.0
COLOR_DEPTH_8 

8 bits per pixel

Since:
2.4, DALi version 1.0.0
COLOR_DEPTH_16 

16 bits per pixel

Since:
2.4, DALi version 1.0.0
COLOR_DEPTH_24 

24 bits per pixel

Since:
2.4, DALi version 1.0.0
COLOR_DEPTH_32 

32 bits per pixel

Since:
2.4, DALi version 1.0.0

Member Function Documentation

bool Dali::NativeImageSource::EncodeToFile ( const std::string &  filename) const

Converts the current pixel contents to either a JPEG or PNG format and write that to the filesystem.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]filenameIdentify the filesystem location at which to write the encoded image. The extension determines the encoding used. The two valid encoding are (".jpeg"|".jpg") and ".png".
Returns:
true if the pixels were written, and false otherwise

Retrieves the internal native image.

Since:
2.4, DALi version 1.0.0
Returns:
Any object containing the internal native image source
bool Dali::NativeImageSource::GetPixels ( std::vector< unsigned char > &  pixbuf,
unsigned int &  width,
unsigned int &  height,
Pixel::Format pixelFormat 
) const

Gets a copy of the pixels used by NativeImageSource.

This is only supported for 24 bit RGB and 32 bit RGBA internal formats (COLOR_DEPTH_24 and COLOR_DEPTH_32).

Since:
2.4, DALi version 1.0.0
Parameters:
[out]pixbufA vector to store the pixels in
[out]widthThe width of image
[out]heightThe height of image
[out]pixelFormatpixel format used by image
Returns:
true if the pixels were gotten, and false otherwise

Checks if the specified color depth is supported.

Since:
3.0, DALi version 1.1.34
Parameters:
[in]colorDepthThe color depth to check
Returns:
true if colorDepth is supported, false otherwise
static NativeImageSourcePtr Dali::NativeImageSource::New ( unsigned int  width,
unsigned int  height,
ColorDepth  depth 
) [static]

Creates a new NativeImageSource.

Depending on hardware, the width and height may have to be a power of two.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]widthThe width of the image
[in]heightThe height of the image
[in]depthcolor depth of the image
Returns:
A smart-pointer to a newly allocated image
static NativeImageSourcePtr Dali::NativeImageSource::New ( Any  nativeImageSource) [static]

Creates a new NativeImageSource from an existing native image source.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]nativeImageSourceNativeImageSource must be a any handle with native image source
Returns:
A smart-pointer to a newly allocated image
See also:
NativeImageInterface

Sets an existing source.

Since:
3.0, DALi version 1.1.19
Parameters:
[in]sourceAny handle with the source