// INTERNAL INCLUDES
#include <dali/public-api/images/image.h>
#include <dali/public-api/object/base-object.h>
-#include <dali/internal/event/resources/resource-client.h>
-#include <dali/internal/event/resources/resource-ticket-observer.h>
+#include <dali/internal/event/rendering/texture-impl.h>
namespace Dali
{
namespace Internal
{
-typedef Dali::Image::ReleasePolicy ReleasePolicy;
-
class Image;
class ImageFactory;
typedef IntrusivePtr<Image> ImagePtr;
-const ReleasePolicy IMAGE_RELEASE_POLICY_DEFAULT = Dali::Image::NEVER;
-
/**
* 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.
*/
-class Image : public BaseObject, public ResourceTicketObserver
+class Image : public BaseObject
{
public:
/**
- * @copydoc Dali::Image::GetReleasePolicy()
- */
- ReleasePolicy GetReleasePolicy () const { return mReleasePolicy; }
-
- /**
* @copydoc Dali::Image::UploadedSignal()
*/
Dali::Image::ImageSignalType& UploadedSignal() { return mUploaded; }
/**
- * Connects a callback function with the object's signals.
- * @param[in] object The object providing the signal.
- * @param[in] tracker Used to disconnect the signal.
- * @param[in] signalName The signal to connect to.
- * @param[in] functor A newly allocated FunctorDelegate.
- * @return True if the signal was connected.
- * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
- */
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
-
- /**
- * returns the Id used for lookups
- * @note if LoadPolicy::OnDemand is used and Image is off Stage, this will return 0.
- * @return the unique ID of the image data resource. This is actually also the same as Dali Texture id.
- */
- ResourceId GetResourceId() const;
-
- /**
* 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.
- * Connect to SignalLoadingFinished or use GetLoadingState to make sure this value is actual.
* @pre image should be loaded
*/
virtual unsigned int GetWidth() const;
* 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.
- * Connect to SignalLoadingFinished or use GetLoadingState to make sure this value is actual.
* @pre image should be loaded
*/
virtual unsigned int GetHeight() const;
*/
virtual Vector2 GetNaturalSize() const;
-public: // From ResourceTicketObserver
-
/**
- * @copydoc Dali::Internal::ResourceTicketObserver::ResourceLoadingFailed()
+ * Returns a pointer to the internal texture used by the image
*/
- virtual void ResourceLoadingFailed(const ResourceTicket& ticket);
-
- /**
- * @copydoc Dali::Internal::ResourceTicketObserver::ResourceLoadingSucceeded()
- */
- virtual void ResourceLoadingSucceeded(const ResourceTicket& ticket);
-
- /**
- * @copydoc Dali::Internal::ResourceTicketObserver::ResourceUploaded()
- */
- virtual void ResourceUploaded(const ResourceTicket& ticket);
-
- /**
- * @copydoc Dali::Internal::ResourceTicketObserver::ResourceSavingSucceeded()
- */
- virtual void ResourceSavingSucceeded( const ResourceTicket& ticket );
-
- /**
- * @copydoc Dali::Internal::ResourceTicketObserver::ResourceSavingFailed()
- */
- virtual void ResourceSavingFailed( const ResourceTicket& ticket );
+ Texture* GetTexture() const
+ {
+ return mTexture.Get();
+ }
public:
/**
* Constructor, with default parameters
*/
- Image( ReleasePolicy releasePol = IMAGE_RELEASE_POLICY_DEFAULT );
+ Image();
/**
* Second stage initialization
protected:
- ResourceTicketPtr mTicket; ///< smart pointer to the ticket object that gets completed when load finishes
+ TexturePtr mTexture; ///< smart pointer to the texture used by the image
- mutable unsigned int mWidth; ///< natural width of the image, needs to be mutable for lazy resolving and as the API for GetWidth is const
- mutable unsigned int mHeight; ///< natural height of the image, needs to be mutable for lazy resolving and as the API for GetHeight is const
+ unsigned int mWidth; ///< natural width of the image
+ unsigned int mHeight; ///< natural height of the image
unsigned int mConnectionCount; ///< number of on-stage objects using this image
- ReleasePolicy mReleasePolicy : 2; ///< 2 bits is enough space
-
private:
Dali::Image::ImageSignalType mUploaded;