Dali 3D User Interface Engine
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
Dali::Internal::Image Class Reference

Image represents an image resource that can be added to actors etc. More...

#include <image-impl.h>

Inheritance diagram for Dali::Internal::Image:
Inheritance graph
[legend]
Collaboration diagram for Dali::Internal::Image:
Collaboration graph
[legend]

Public Member Functions

ReleasePolicy GetReleasePolicy () const
 .3 More...
 
Dali::Image::ImageSignalTypeUploadedSignal ()
 This signal is emitted when the image data gets uploaded to GL. More...
 
ResourceId GetResourceId () const
 returns the Id used for lookups More...
 
virtual unsigned int GetWidth () const
 Get the width of the image. More...
 
virtual unsigned int GetHeight () const
 Get the height of the image. More...
 
virtual Vector2 GetNaturalSize () const
 Return the natural size of the image. More...
 
virtual void ResourceLoadingFailed (const ResourceTicket &ticket)
 Called when a resource fails to load. More...
 
virtual void ResourceLoadingSucceeded (const ResourceTicket &ticket)
 Called when a resource loads successfully. More...
 
virtual void ResourceUploaded (const ResourceTicket &ticket)
 Called when a resource is uploaded to graphics memory. More...
 
virtual void Connect ()
 Indicates that the image is used. More...
 
virtual void Disconnect ()
 Indicates that the image is not used anymore. More...
 
- Public Member Functions inherited from Dali::BaseObject
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...
 
bool DoConnectSignal (ConnectionTrackerInterface *connectionTracker, const std::string &signalName, FunctorDelegate *functorDelegate)
 Not intended for application developers. More...
 
- Public Member Functions inherited from Dali::RefObject
void Reference ()
 Increment the object's reference count. More...
 
void Unreference ()
 Decrement the object's reference count. More...
 
int ReferenceCount ()
 Retrieve the object's reference count. More...
 

Static Public Member Functions

static bool DoConnectSignal (BaseObject *object, ConnectionTrackerInterface *tracker, const std::string &signalName, FunctorDelegate *functor)
 Connects a callback function with the object's signals. More...
 

Protected Member Functions

virtual ~Image ()
 A reference counted object may only be deleted by calling Unreference() More...
 
 Image (ReleasePolicy releasePol=IMAGE_RELEASE_POLICY_DEFAULT)
 Constructor, with default parameters. More...
 
void Initialize ()
 Second stage initialization. More...
 
- Protected Member Functions inherited from Dali::BaseObject
 BaseObject ()
 Default constructor. More...
 
virtual ~BaseObject ()
 A reference counted object may only be deleted by calling Unreference(). More...
 
void RegisterObject ()
 Registers the object as created with the Object registry. More...
 
void UnregisterObject ()
 Unregisters the object from Object registry. More...
 
- Protected Member Functions inherited from Dali::RefObject
 RefObject ()
 Default constructor. More...
 
virtual ~RefObject ()
 RefObject is intended as a base class. More...
 
 RefObject (const RefObject &rhs)
 Copy constructor. More...
 
RefObjectoperator= (const RefObject &rhs)
 Assignment operator. More...
 

Protected Attributes

ResourceTicketPtr mTicket
 smart pointer to the ticket object that gets completed when load finishes More...
 
unsigned int mWidth
 natural width of the image, needs to be mutable for lazy resolving and as the API for GetWidth is const More...
 
unsigned int mHeight
 natural height of the image, needs to be mutable for lazy resolving and as the API for GetHeight is const More...
 
unsigned int mConnectionCount
 number of on-stage objects using this image More...
 
ReleasePolicy mReleasePolicy: 2
 2 bits is enough space More...
 

Private Attributes

Dali::Image::ImageSignalType mUploaded
 

Detailed Description

Image represents an image resource that can be added to actors etc.

When the Image object is created, resource loading will be attempted. Provided this is successful, the resource will exist until the Image is destroyed.

Definition at line 49 of file image-impl.h.

Constructor & Destructor Documentation

Dali::Internal::Image::~Image ( )
protectedvirtual

A reference counted object may only be deleted by calling Unreference()

Definition at line 119 of file image-impl.cpp.

References Dali::Internal::Stage::IsInstalled(), mTicket, Dali::IntrusivePtr< T >::Reset(), and Dali::BaseObject::UnregisterObject().

Here is the call graph for this function:

Dali::Internal::Image::Image ( ReleasePolicy  releasePol = IMAGE_RELEASE_POLICY_DEFAULT)
protected

Constructor, with default parameters.

Definition at line 111 of file image-impl.cpp.

Member Function Documentation

virtual void Dali::Internal::Image::Connect ( )
inlinevirtual

Indicates that the image is used.

Reimplemented in Dali::Internal::BufferImage, Dali::Internal::ResourceImage, Dali::Internal::NinePatchImage, Dali::Internal::Atlas, and Dali::Internal::FrameBufferImage.

Definition at line 127 of file image-impl.h.

Referenced by Dali::Internal::Material::SetTextureImage().

Here is the caller graph for this function:

virtual void Dali::Internal::Image::Disconnect ( )
inlinevirtual

Indicates that the image is not used anymore.

Reimplemented in Dali::Internal::BufferImage, Dali::Internal::ResourceImage, Dali::Internal::NinePatchImage, Dali::Internal::Atlas, and Dali::Internal::FrameBufferImage.

Definition at line 132 of file image-impl.h.

bool Dali::Internal::Image::DoConnectSignal ( BaseObject object,
ConnectionTrackerInterface tracker,
const std::string &  signalName,
FunctorDelegate functor 
)
static

Connects a callback function with the object's signals.

Parameters
[in]objectThe object providing the signal.
[in]trackerUsed to disconnect the signal.
[in]signalNameThe signal to connect to.
[in]functorA newly allocated FunctorDelegate.
Returns
True if the signal was connected.
Postcondition
If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.

Definition at line 55 of file image-impl.cpp.

References DALI_ASSERT_DEBUG, Dali::Internal::anonymous_namespace{image-impl.cpp}::SIGNAL_IMAGE_UPLOADED, and UploadedSignal().

Here is the call graph for this function:

unsigned int Dali::Internal::Image::GetHeight ( ) const
virtual

Get the height of the image.

Only to be used after the image has finished loading. (Ticket's LoadingSucceeded callback was called) The returned value will reflect the true image dimensions once the asynchronous loading has finished.

Precondition
image should be loaded

Reimplemented in Dali::Internal::ResourceImage.

Definition at line 101 of file image-impl.cpp.

Referenced by Dali::Internal::Atlas::Upload().

Here is the caller graph for this function:

Vector2 Dali::Internal::Image::GetNaturalSize ( ) const
virtual

Return the natural size of the image.

This is the size that the loaded image will take

Reimplemented in Dali::Internal::ResourceImage.

Definition at line 106 of file image-impl.cpp.

ReleasePolicy Dali::Internal::Image::GetReleasePolicy ( ) const
inline

.3

Return resource release policy.

.0

Returns
resource release policy

Definition at line 56 of file image-impl.h.

References mReleasePolicy.

ResourceId Dali::Internal::Image::GetResourceId ( ) const

returns the Id used for lookups

Note
if LoadPolicy::OnDemand is used and Image is off Stage, this will return 0.
Returns
the unique ID of the image data resource. This is actually also the same as Dali Texture id.

Definition at line 74 of file image-impl.cpp.

Referenced by Dali::Internal::Atlas::ClearBackground(), Dali::Internal::NativeImage::CreateGlTexture(), Dali::Internal::RenderTask::CreateSceneObject(), Dali::Internal::Atlas::RecoverFromContextLoss(), Dali::Internal::RenderTask::SetTargetFrameBuffer(), and Dali::Internal::Atlas::Upload().

Here is the caller graph for this function:

unsigned int Dali::Internal::Image::GetWidth ( ) const
virtual

Get the width of the image.

Only to be used after the image has finished loading. (Ticket's LoadingSucceeded callback was called) The returned value will reflect the true image dimensions once the asynchronous loading has finished.

Precondition
image should be loaded

Reimplemented in Dali::Internal::ResourceImage.

Definition at line 96 of file image-impl.cpp.

Referenced by Dali::Internal::Atlas::Upload().

Here is the caller graph for this function:

void Dali::Internal::Image::Initialize ( void  )
protected

Second stage initialization.

Definition at line 133 of file image-impl.cpp.

References Dali::BaseObject::RegisterObject().

Here is the call graph for this function:

void Dali::Internal::Image::ResourceLoadingFailed ( const ResourceTicket ticket)
virtual

Called when a resource fails to load.

Parameters
[in]ticketThe ticket for this resource.

Implements Dali::Internal::ResourceTicketObserver.

Reimplemented in Dali::Internal::ResourceImage.

Definition at line 81 of file image-impl.cpp.

void Dali::Internal::Image::ResourceLoadingSucceeded ( const ResourceTicket ticket)
virtual

Called when a resource loads successfully.

Parameters
[in]ticketThe ticket for this resource.

Implements Dali::Internal::ResourceTicketObserver.

Reimplemented in Dali::Internal::ResourceImage.

Definition at line 86 of file image-impl.cpp.

void Dali::Internal::Image::ResourceUploaded ( const ResourceTicket ticket)
virtual

Called when a resource is uploaded to graphics memory.

Parameters
[in]ticketThe ticket for this resource.

Implements Dali::Internal::ResourceTicketObserver.

Definition at line 91 of file image-impl.cpp.

Dali::Image::ImageSignalType& Dali::Internal::Image::UploadedSignal ( )
inline

This signal is emitted when the image data gets uploaded to GL.

It Will be sent after an actor using the image is added to the stage, when such a staged image is reloaded, or when a staged BufferImage calls Update(). .0

Returns
A signal object to Connect() with.

Definition at line 61 of file image-impl.h.

References mUploaded.

Referenced by DoConnectSignal().

Here is the caller graph for this function:

Member Data Documentation

unsigned int Dali::Internal::Image::mConnectionCount
protected
unsigned int Dali::Internal::Image::mHeight
mutableprotected
ReleasePolicy Dali::Internal::Image::mReleasePolicy
protected
ResourceTicketPtr Dali::Internal::Image::mTicket
protected
Dali::Image::ImageSignalType Dali::Internal::Image::mUploaded
private

Definition at line 164 of file image-impl.h.

Referenced by UploadedSignal().

unsigned int Dali::Internal::Image::mWidth
mutableprotected

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