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

ResourceImage is an image loaded using a URL, it is an image resource that can be added to actors etc. More...

#include <resource-image-impl.h>

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

Public Member Functions

Dali::LoadingState GetLoadingState () const
 Query whether the image data has loaded. More...
 
LoadPolicy GetLoadPolicy () const
 .3 More...
 
Dali::ResourceImage::ResourceImageSignalLoadingFinishedSignal ()
 Emitted when the image data loads successfully, or when the loading fails. More...
 
const ImageAttributesGetAttributes () const
 Get the attributes of the image. More...
 
const std::string & GetUrl () const
 Returns the URL of the image. More...
 
void Reload ()
 Reload image from filesystem. More...
 
virtual unsigned int GetWidth () const
 Returns the width of the image. More...
 
virtual unsigned int GetHeight () const
 Returns the width of the image. More...
 
virtual Vector2 GetNaturalSize () const
 Return the natural size of the image. More...
 
virtual void Connect ()
 Indicates that the image is used. More...
 
virtual void Disconnect ()
 Indicates that the image is not used anymore. 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...
 
- Public Member Functions inherited from Dali::Internal::Image
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 void ResourceUploaded (const ResourceTicket &ticket)
 Called when a resource is uploaded to graphics memory. 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 ResourceImagePtr New ()
 Creates a pointer to an uninitialized Image object. More...
 
static ResourceImagePtr New (const std::string &url, const ImageAttributes &attributes, LoadPolicy loadPol=IMAGE_LOAD_POLICY_DEFAULT, ReleasePolicy releasePol=IMAGE_RELEASE_POLICY_DEFAULT)
 Creates object and loads image from filesystem the maximum size of the image is limited by GL_MAX_TEXTURE_SIZE. More...
 
static bool DoConnectSignal (BaseObject *object, ConnectionTrackerInterface *tracker, const std::string &signalName, FunctorDelegate *functor)
 Connects a callback function with the object's signals. More...
 
- Static Public Member Functions inherited from Dali::Internal::Image
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 ~ResourceImage ()
 A reference counted object may only be deleted by calling Unreference() More...
 
 ResourceImage (LoadPolicy loadPol=IMAGE_LOAD_POLICY_DEFAULT, ReleasePolicy releasePol=IMAGE_RELEASE_POLICY_DEFAULT)
 Constructor, with default parameters. More...
 
- Protected Member Functions inherited from Dali::Internal::Image
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...
 

Private Member Functions

void SetTicket (ResourceTicket *ticket)
 Helper method to set new resource ticket. More...
 

Private Attributes

ImageFactorymImageFactory
 
ImageFactoryCache::RequestPtr mRequest
 contains the initially requested attributes for image. Request is reissued when memory was released. More...
 
Dali::ResourceImage::ResourceImageSignal mLoadingFinished
 
LoadPolicy mLoadPolicy: 2
 2 bits is enough space More...
 
 DALI_LOG_OBJECT_STRING_DECLARATION
 

Additional Inherited Members

- Protected Attributes inherited from Dali::Internal::Image
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...
 

Detailed Description

ResourceImage is an image loaded using a URL, it is an image resource that can be added to actors etc.

Definition at line 46 of file resource-image-impl.h.

Constructor & Destructor Documentation

Dali::Internal::ResourceImage::~ResourceImage ( )
protectedvirtual

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

Definition at line 103 of file resource-image-impl.cpp.

References Dali::IntrusivePtr< T >::Get(), Dali::Internal::Stage::IsInstalled(), mImageFactory, Dali::Internal::Image::mTicket, Dali::Internal::ImageFactory::ReleaseTicket(), and Dali::IntrusivePtr< T >::Reset().

Here is the call graph for this function:

Dali::Internal::ResourceImage::ResourceImage ( LoadPolicy  loadPol = IMAGE_LOAD_POLICY_DEFAULT,
ReleasePolicy  releasePol = IMAGE_RELEASE_POLICY_DEFAULT 
)
protected

Constructor, with default parameters.

Definition at line 60 of file resource-image-impl.cpp.

Referenced by New().

Here is the caller graph for this function:

Member Function Documentation

void Dali::Internal::ResourceImage::Connect ( )
virtual

Indicates that the image is used.

Reimplemented from Dali::Internal::Image.

Reimplemented in Dali::Internal::NinePatchImage.

Definition at line 214 of file resource-image-impl.cpp.

References DALI_ASSERT_DEBUG, Dali::IntrusivePtr< T >::Get(), Dali::Internal::ImageFactory::Load(), Dali::Internal::Image::mConnectionCount, mImageFactory, mRequest, Dali::Internal::Image::mTicket, and SetTicket().

Here is the call graph for this function:

void Dali::Internal::ResourceImage::Disconnect ( )
virtual

Indicates that the image is not used anymore.

Reimplemented from Dali::Internal::Image.

Reimplemented in Dali::Internal::NinePatchImage.

Definition at line 230 of file resource-image-impl.cpp.

References DALI_ASSERT_DEBUG, Dali::Internal::Image::mConnectionCount, Dali::Internal::Image::mReleasePolicy, Dali::Internal::Image::mTicket, SetTicket(), and Dali::Image::UNUSED.

Here is the call graph for this function:

bool Dali::Internal::ResourceImage::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 116 of file resource-image-impl.cpp.

References DALI_ASSERT_DEBUG, LoadingFinishedSignal(), and Dali::Internal::anonymous_namespace{resource-image-impl.cpp}::SIGNAL_IMAGE_LOADING_FINISHED.

Here is the call graph for this function:

const ImageAttributes & Dali::Internal::ResourceImage::GetAttributes ( ) const

Get the attributes of the image.

Only to be used after the image has finished loading. (Ticket's LoadingSucceeded callback was called) Reflects the last cached values after a LoadComplete. If requested width or height was 0, they are replaced by concrete dimensions.

Returns
a copy of the attributes

Definition at line 135 of file resource-image-impl.cpp.

References Dali::Internal::ImageFactory::GetActualAttributes(), Dali::Internal::ImageFactory::GetRequestAttributes(), mImageFactory, mRequest, and Dali::Internal::Image::mTicket.

Here is the call graph for this function:

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

Returns the width of the image.

Returns either the requested width or the actual loaded width if no specific size was requested.

.0

Returns
width of the image in pixels.

Reimplemented from Dali::Internal::Image.

Definition at line 177 of file resource-image-impl.cpp.

References Dali::Internal::ImageFactory::GetImageSize(), Dali::Vector2::height, Dali::Internal::Image::mHeight, mImageFactory, mRequest, Dali::Internal::Image::mTicket, Dali::Internal::Image::mWidth, and Dali::Vector2::width.

Here is the call graph for this function:

Dali::LoadingState Dali::Internal::ResourceImage::GetLoadingState ( ) const
inline

Query whether the image data has loaded.

The asynchronous loading begins when the Image object is created. After the Image object is discarded, the image data will be released from memory. .0

Returns
The loading state, either Loading, Success or Failed.

Definition at line 74 of file resource-image-impl.h.

References Dali::Internal::Image::mTicket, and Dali::ResourceLoading.

LoadPolicy Dali::Internal::ResourceImage::GetLoadPolicy ( ) const
inline

.3

Return load policy.

.0

Returns
resource load policy

Definition at line 79 of file resource-image-impl.h.

References mLoadPolicy.

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

Return the natural size of the image.

This is the size that the loaded image will take

Reimplemented from Dali::Internal::Image.

Definition at line 192 of file resource-image-impl.cpp.

References Dali::Internal::ImageFactory::GetImageSize(), Dali::Vector2::height, Dali::Internal::Image::mHeight, mImageFactory, mRequest, Dali::Internal::Image::mTicket, Dali::Internal::Image::mWidth, and Dali::Vector2::width.

Here is the call graph for this function:

const std::string & Dali::Internal::ResourceImage::GetUrl ( ) const

Returns the URL of the image.

.0

Returns
The URL of the image file.

Definition at line 147 of file resource-image-impl.cpp.

References Dali::Internal::ImageFactory::GetRequestPath(), mImageFactory, and mRequest.

Here is the call graph for this function:

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

Returns the width of the image.

Returns either the requested width or the actual loaded width if no specific size was requested.

.0

Returns
width of the image in pixels.

Reimplemented from Dali::Internal::Image.

Definition at line 161 of file resource-image-impl.cpp.

References Dali::Internal::ImageFactory::GetImageSize(), Dali::Vector2::height, Dali::Internal::Image::mHeight, mImageFactory, mRequest, Dali::Internal::Image::mTicket, Dali::Internal::Image::mWidth, and Dali::Vector2::width.

Here is the call graph for this function:

Dali::ResourceImage::ResourceImageSignal& Dali::Internal::ResourceImage::LoadingFinishedSignal ( )
inline

Emitted when the image data loads successfully, or when the loading fails.

.0

Returns
A signal object to Connect() with.

Definition at line 84 of file resource-image-impl.h.

References mLoadingFinished.

Referenced by DoConnectSignal().

Here is the caller graph for this function:

ResourceImagePtr Dali::Internal::ResourceImage::New ( )
static

Creates a pointer to an uninitialized Image object.

Returns
a pointer to a newly created object.

Definition at line 67 of file resource-image-impl.cpp.

References ResourceImage().

Referenced by anonymous_namespace{utc-Dali-Internal-ResourceClient.cpp}::LoadImage(), New(), Dali::NinePatchImage::New(), and Dali::ResourceImage::New().

Here is the call graph for this function:

Here is the caller graph for this function:

ResourceImagePtr Dali::Internal::ResourceImage::New ( const std::string &  url,
const ImageAttributes attributes,
LoadPolicy  loadPol = IMAGE_LOAD_POLICY_DEFAULT,
ReleasePolicy  releasePol = IMAGE_RELEASE_POLICY_DEFAULT 
)
static

Creates object and loads image from filesystem the maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.

Parameters
[in]urlThe URL of the image file.
[in]attributesrequested parameters for loading (size, scaling etc.) if width or height is specified as 0, the natural size will be used.
[in]loadPolcontrols time of loading a resource from the filesystem (default: load when Image is created).
[in]releasePoloptionally relase memory when image is not visible on screen (default: keep image data until Image object is alive).
Returns
a pointer to a newly created object.

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

References DALI_LOG_SET_OBJECT_STRING, Dali::IntrusivePtr< T >::Get(), Dali::Internal::ImageAttributes::GetHeight(), Dali::Internal::ImageAttributes::GetWidth(), Dali::ResourceImage::IMMEDIATE, Dali::Internal::NinePatchImage::IsNinePatchUrl(), New(), and ResourceImage().

Here is the call graph for this function:

void Dali::Internal::ResourceImage::Reload ( )

Reload image from filesystem.

The original set of image loading attributes (requested dimensions, scaling mode and filter mode) are used when requesting the image again. .0

Note
If image is offstage and OnDemand policy is set, the reload request is ignored.

Definition at line 152 of file resource-image-impl.cpp.

References Dali::IntrusivePtr< T >::Get(), mImageFactory, mRequest, Dali::Internal::ImageFactory::Reload(), and SetTicket().

Here is the call graph for this function:

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

Called when a resource fails to load.

Parameters
[in]ticketThe ticket for this resource.

Reimplemented from Dali::Internal::Image.

Definition at line 204 of file resource-image-impl.cpp.

References mLoadingFinished.

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

Called when a resource loads successfully.

Parameters
[in]ticketThe ticket for this resource.

Reimplemented from Dali::Internal::Image.

Definition at line 209 of file resource-image-impl.cpp.

References mLoadingFinished.

void Dali::Internal::ResourceImage::SetTicket ( ResourceTicket ticket)
private

Helper method to set new resource ticket.

Stops observing current ticket if any, and starts observing the new one or just resets the intrusive pointer.

Parameters
[in]ticketpointer to new resource Ticket or NULL.

Definition at line 246 of file resource-image-impl.cpp.

References Dali::IntrusivePtr< T >::Get(), mImageFactory, Dali::Internal::Image::mTicket, Dali::Internal::ImageFactory::ReleaseTicket(), and Dali::IntrusivePtr< T >::Reset().

Referenced by Connect(), Disconnect(), and Reload().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Dali::Internal::ResourceImage::DALI_LOG_OBJECT_STRING_DECLARATION
private

Definition at line 186 of file resource-image-impl.h.

ImageFactory& Dali::Internal::ResourceImage::mImageFactory
private
Dali::ResourceImage::ResourceImageSignal Dali::Internal::ResourceImage::mLoadingFinished
private
LoadPolicy Dali::Internal::ResourceImage::mLoadPolicy
private

2 bits is enough space

Definition at line 183 of file resource-image-impl.h.

Referenced by GetLoadPolicy().

ImageFactoryCache::RequestPtr Dali::Internal::ResourceImage::mRequest
private

contains the initially requested attributes for image. Request is reissued when memory was released.

Definition at line 179 of file resource-image-impl.h.

Referenced by Connect(), GetAttributes(), GetHeight(), GetNaturalSize(), GetUrl(), GetWidth(), and Reload().


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