namespace Internal
{
+namespace
+{
+TypeRegistration mType( typeid( Dali::BufferImage ), typeid( Dali::Image ), NULL );
+} // unnamed namespace
+
BufferImagePtr BufferImage::New( unsigned int width,
unsigned int height,
Pixel::Format pixelformat )
namespace
{
+TypeRegistration mType( typeid( Dali::EncodedBufferImage ), typeid( Dali::Image ), NULL );
+
/** Raw bytes of a resource laid out exactly as it would be in a file, but in memory. */
typedef Dali::RefCountedVector<uint8_t> RequestBuffer;
/** Counting smart pointer for managing a buffer of raw bytes. */
namespace
{
+TypeRegistration mType( typeid( Dali::FrameBufferImage ), typeid( Dali::Image ), NULL );
+
const int RenderBufferFormatToFrameBufferAttachments[] = { Dali::FrameBuffer::Attachment::NONE,
Dali::FrameBuffer::Attachment::DEPTH,
Dali::FrameBuffer::Attachment::STENCIL,
namespace Internal
{
+namespace
+{
+
+// Signals
+
+const char* const SIGNAL_IMAGE_UPLOADED = "uploaded";
+
+TypeRegistration mType( typeid( Dali::Image ), typeid( Dali::BaseHandle ), NULL );
+
+Dali::SignalConnectorType signalConnector1( mType, SIGNAL_IMAGE_UPLOADED, &Image::DoConnectSignal );
+
+}
+
+bool Image::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+ bool connected( true );
+ DALI_ASSERT_DEBUG( dynamic_cast<Image*>( object ) && "Failed to downcast from BaseObject to Image.\n" );
+ Image* image = static_cast<Image*>(object);
+
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_IMAGE_UPLOADED ) )
+ {
+ image->UploadedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
unsigned int Image::GetWidth() const
{
return mWidth;
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 );
+
+ /**
* Get the width of the image.
* Only to be used after the image has finished loading.
* (Ticket's LoadingSucceeded callback was called)
namespace Internal
{
+namespace
+{
+TypeRegistration mType( typeid(Dali::NativeImage), typeid(Dali::Image), NULL );
+}
+
NativeImage::NativeImage( NativeImageInterface& resourceData )
: Image()
{
namespace Internal
{
+namespace
+{
+TypeRegistration mType( typeid( Dali::NinePatchImage ), typeid( Dali::Image ), NULL );
+} // unnamed namespace
+
NinePatchImagePtr NinePatchImage::New( const std::string& filename )
{
Internal::NinePatchImagePtr internal( new NinePatchImage( filename ) );
namespace Internal
{
+namespace
+{
+
+// Signals
+
+const char* const SIGNAL_IMAGE_LOADING_FINISHED = "imageLoadingFinished";
+
+
+BaseHandle CreateImage()
+{
+ ImagePtr image = ResourceImage::New();
+ return Dali::Image(image.Get());
+}
+
+TypeRegistration mType( typeid( Dali::ResourceImage ), typeid( Dali::Image ), CreateImage );
+
+Dali::SignalConnectorType signalConnector1( mType, SIGNAL_IMAGE_LOADING_FINISHED, &ResourceImage::DoConnectSignal );
+
+}
+
ResourceImage::ResourceImage()
: Image(),
mLoadingFinished(),
{
}
+bool ResourceImage::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+ bool connected( true );
+ DALI_ASSERT_DEBUG( dynamic_cast<ResourceImage*>( object ) && "Failed to downcast from BaseObject to ResourceImage.\n" );
+ ResourceImage* image = static_cast<ResourceImage*>(object);
+
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_IMAGE_LOADING_FINISHED ) )
+ {
+ image->LoadingFinishedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
+
const ImageAttributes& ResourceImage::GetAttributes() const
{
return mAttributes;
Dali::ResourceImage::ResourceImageSignal& LoadingFinishedSignal() { return mLoadingFinished; }
/**
+ * 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 );
+
+ /**
* Get the attributes of the image.
* Only to be used after the image has finished loading.
* (Ticket's LoadingSucceeded callback was called)