Dali 3D User Interface Engine
List of all members | Public Types | Public Member Functions | Static Public Member Functions
Dali::Atlas Class Reference

An Atlas is a large image containing multiple smaller images. More...

#include <atlas.h>

Inheritance diagram for Dali::Atlas:
Inheritance graph
[legend]
Collaboration diagram for Dali::Atlas:
Collaboration graph
[legend]

Public Types

typedef uint32_t SizeType
 
- Public Types inherited from Dali::Image
enum  ReleasePolicy { UNUSED, NEVER }
 .3. More...
 
typedef Signal< void(Image) > ImageSignalType
 Type of signal for Image Uploaded. More...
 
- Public Types inherited from Dali::BaseHandle
typedef void(BaseHandle::* BooleanType )() const
 Pointer-to-member type. More...
 

Public Member Functions

 Atlas ()
 Create an empty handle. More...
 
void Clear (const Vector4 &color)
 Clear the Atlas with the given color. More...
 
bool Upload (BufferImage bufferImage, SizeType xOffset, SizeType yOffset)
 Upload a buffer image to the atlas. More...
 
bool Upload (const std::string &url, SizeType xOffset, SizeType yOffset)
 Upload a resource image to atlas. More...
 
bool Upload (PixelDataPtr pixelData, SizeType xOffset, SizeType yOffset)
 Upload a pixel buffer to atlas. More...
 
 ~Atlas ()
 Destructor. More...
 
 Atlas (const Atlas &handle)
 This copy constructor is required for (smart) pointer semantics. More...
 
Atlasoperator= (const Atlas &rhs)
 This assignment operator is required for (smart) pointer semantics. More...
 
DALI_INTERNAL Atlas (Internal::Atlas *)
 
- Public Member Functions inherited from Dali::Image
 Image ()
 Constructor which creates an empty Image handle. More...
 
 ~Image ()
 Destructor. More...
 
 Image (const Image &handle)
 This copy constructor is required for (smart) pointer semantics. More...
 
Imageoperator= (const Image &rhs)
 This assignment operator is required for (smart) pointer semantics. More...
 
ReleasePolicy GetReleasePolicy () const
 .3 More...
 
unsigned int GetWidth () const
 Returns the width of the image. More...
 
unsigned int GetHeight () const
 Returns the height of the image. More...
 
ImageSignalTypeUploadedSignal ()
 This signal is emitted when the image data gets uploaded to GL. More...
 
DALI_INTERNAL Image (Internal::Image *)
 
- Public Member Functions inherited from Dali::BaseHandle
 BaseHandle (Dali::BaseObject *handle)
 This constructor is used by Dali New() methods. More...
 
 BaseHandle ()
 This constructor provides an uninitialized Dali::BaseHandle. More...
 
 ~BaseHandle ()
 Dali::BaseHandle is intended as a base class. More...
 
 BaseHandle (const BaseHandle &handle)
 This copy constructor is required for (smart) pointer semantics. More...
 
BaseHandleoperator= (const BaseHandle &rhs)
 This assignment operator is required for (smart) pointer semantics. More...
 
template<class T >
bool ConnectSignal (ConnectionTrackerInterface *connectionTracker, const std::string &signalName, const T &functor)
 Connects a void() functor to a specified signal. More...
 
bool DoAction (const std::string &actionName, const Property::Map &attributes)
 Perform action on this object with the given action name and attributes. More...
 
const std::string & GetTypeName () const
 Returns the type name for the Handle. More...
 
bool GetTypeInfo (Dali::TypeInfo &info) const
 Returns the type info for the Handle. More...
 
BaseObjectGetBaseObject ()
 Retrieve the internal Dali resource. More...
 
const BaseObjectGetBaseObject () const
 Retrieve the internal Dali resource. More...
 
void Reset ()
 Resets the handle. More...
 
 operator BooleanType () const
 Converts an handle to a BooleanType. More...
 
bool operator== (const BaseHandle &rhs) const
 Equality operator overload. More...
 
bool operator!= (const BaseHandle &rhs) const
 Inequality operator overload. More...
 
Dali::RefObjectGetObjectPtr () const
 Get the reference counted object pointer. More...
 

Static Public Member Functions

static Atlas New (SizeType width, SizeType height, Pixel::Format pixelFormat=Pixel::RGBA8888, bool recoverContext=true)
 Create a new Atlas. More...
 
static Atlas DownCast (BaseHandle handle)
 Downcast an Object handle to Atlas. More...
 
- Static Public Member Functions inherited from Dali::Image
static Image DownCast (BaseHandle handle)
 Downcast an Object handle to Image handle. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Dali::BaseHandle
void ThisIsSaferThanReturningVoidStar () const
 Used by the safe bool idiom. More...
 

Detailed Description

An Atlas is a large image containing multiple smaller images.

Buffer image and resource image( by providing the url ) are supported for uploading. Images must be uploaded at a specified position, to populate the Atlas. The client is responsible for generating the appropriate geometry (UV coordinates) needed to draw images within the Atlas.

Note
For gles 2.0, matched pixel format is demanded to ensure the correct atlasing. The only exception supported is uploading image of RGB888 to atlas of RGBA8888 format which is converted manually before pushing to GPU.

For context recovery after loss: By default, the atlas will re-upload the resource images automatically, while the buffer images are left to the client to upload again by connecting to the Stage::ContextRegainedSignal(). If resource and buffer images are mixed and they overlap inside the atlas, the recovered contents may be incorrect. In these case, switch off the context recovery by calling SetContextRecovery( false ), and upload both buffer images and resource image to the atlas in order to restore the atlas.

Definition at line 55 of file atlas.h.

Member Typedef Documentation

typedef uint32_t Dali::Atlas::SizeType

Definition at line 59 of file atlas.h.

Constructor & Destructor Documentation

Dali::Atlas::Atlas ( )

Create an empty handle.

Calling member functions of an empty handle is not allowed.

Definition at line 39 of file atlas.cpp.

Referenced by DownCast(), and New().

Here is the caller graph for this function:

Dali::Atlas::~Atlas ( )

Destructor.

This is non-virtual since derived Handle types must not contain data or virtual methods.

Definition at line 74 of file atlas.cpp.

Dali::Atlas::Atlas ( const Atlas handle)

This copy constructor is required for (smart) pointer semantics.

Parameters
[in]handleA reference to the copied handle

Definition at line 78 of file atlas.cpp.

Dali::Atlas::Atlas ( Internal::Atlas internal)
explicit

Definition at line 89 of file atlas.cpp.

Member Function Documentation

void Dali::Atlas::Clear ( const Vector4 color)

Clear the Atlas with the given color.

Note
The Atlas does not clear itself automatically during construction. Application should call this clear function to avoid getting garbage pixels in the atlas. By calling Clear, all the current uploaded image information will be lost.
Parameters
[in]colorThe color used to clear the Atlas.

Definition at line 43 of file atlas.cpp.

References Dali::GetImplementation().

Referenced by Dali::Toolkit::Internal::AtlasManager::CreateAtlas(), and UtcDaliAtlasClear().

Here is the call graph for this function:

Here is the caller graph for this function:

Atlas Dali::Atlas::DownCast ( BaseHandle  handle)
static

Downcast an Object handle to Atlas.

If handle points to a Atlas the downcast produces valid handle. If not the returned handle is left uninitialized.

Parameters
[in]handleto An object
Returns
handle to a Atlas or an empty handle

Definition at line 69 of file atlas.cpp.

References Atlas(), and Dali::BaseHandle::GetObjectPtr().

Referenced by UtcDaliAtlasDownCast(), and UtcDaliImageAtlasGetAtlas().

Here is the call graph for this function:

Here is the caller graph for this function:

Atlas Dali::Atlas::New ( SizeType  width,
SizeType  height,
Pixel::Format  pixelFormat = Pixel::RGBA8888,
bool  recoverContext = true 
)
static

Create a new Atlas.

Precondition
width & height are greater than zero. The maximum size of the atlas is limited by GL_MAX_TEXTURE_SIZE.
Parameters
[in]widthThe atlas width in pixels.
[in]heightThe atlas height in pixels.
[in]pixelFormatThe pixel format (rgba 32 bit by default).
[in]recoverContextWhether re-uploading the resource images automatically when regaining the context( true by default )
Returns
A handle to a new Atlas.

Definition at line 28 of file atlas.cpp.

References Atlas(), DALI_ASSERT_ALWAYS, and Dali::Internal::Atlas::New().

Referenced by Dali::Toolkit::Internal::AtlasManager::CreateAtlas(), Dali::Toolkit::Internal::ImageAtlas::ImageAtlas(), UtcDaliAtlasAssignmentOperator(), UtcDaliAtlasClear(), UtcDaliAtlasCopyConstructor(), UtcDaliAtlasDownCast(), UtcDaliAtlasNew(), UtcDaliAtlasUpload01P(), UtcDaliAtlasUpload02P(), and UtcDaliAtlasUploadN().

Here is the call graph for this function:

Here is the caller graph for this function:

Atlas & Dali::Atlas::operator= ( const Atlas rhs)

This assignment operator is required for (smart) pointer semantics.

Parameters
[in]rhsA reference to the copied handle
Returns
A reference to this

Definition at line 83 of file atlas.cpp.

References Dali::BaseHandle::operator=().

Here is the call graph for this function:

bool Dali::Atlas::Upload ( BufferImage  bufferImage,
SizeType  xOffset,
SizeType  yOffset 
)

Upload a buffer image to the atlas.

Precondition
The pixel format of this buffer image must match the Atlas format.
Parameters
[in]bufferImageThe buffer image to upload.
[in]xOffsetSpecifies an offset in the x direction within the atlas.
[in]yOffsetSpecifies an offset in the y direction within the atlas.
Returns
True if the image has compatible pixel format and fits within the atlas at the specified offset.

Definition at line 48 of file atlas.cpp.

References Dali::GetImplementation().

Referenced by Dali::Toolkit::Internal::AtlasManager::CreateAtlas(), Dali::Toolkit::Internal::ImageAtlas::UploadBrokenImage(), Dali::Toolkit::Internal::ImageAtlas::UploadToAtlas(), UtcDaliAtlasUpload01P(), UtcDaliAtlasUpload02P(), and UtcDaliAtlasUploadN().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Dali::Atlas::Upload ( const std::string &  url,
SizeType  xOffset,
SizeType  yOffset 
)

Upload a resource image to atlas.

Parameters
[in]urlThe URL of the resource image file to use
[in]xOffsetSpecifies an offset in the x direction within the atlas.
[in]yOffsetSpecifies an offset in the y direction within the atlas.
Returns
True if the image has compatible pixel format and fits within the atlas at the specified offset.

Definition at line 55 of file atlas.cpp.

References Dali::GetImplementation().

Here is the call graph for this function:

bool Dali::Atlas::Upload ( PixelDataPtr  pixelData,
SizeType  xOffset,
SizeType  yOffset 
)

Upload a pixel buffer to atlas.

Parameters
[in]pixelDataThe pixel data.
[in]xOffsetSpecifies an offset in the x direction within the atlas.
[in]yOffsetSpecifies an offset in the y direction within the atlas.

Definition at line 62 of file atlas.cpp.

References Dali::GetImplementation().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Dali Docs Home
Read more about Dali