+ //Create texture
+ Pixel::Format format = bitmap->GetPixelFormat();
+ image->mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, format, width, height );
+
+ //Upload data to the texture
+ uint32_t bufferSize = bitmap->GetBufferSize();
+ PixelDataPtr pixelData = PixelData::New( bitmap->GetBufferOwnership(), bufferSize, width, height, format,
+ static_cast< Dali::PixelData::ReleaseFunction >( bitmap->GetReleaseFunction() ) );
+ image->mTexture->Upload( pixelData );
+
+ image->mWidth = size.GetWidth();
+ if( image->mWidth == 0 )
+ {
+ image->mWidth = width;
+ }
+
+ image->mHeight = size.GetHeight();
+ if( image->mHeight == 0 )
+ {
+ image->mHeight = height;
+ }
+ }
+ else
+ {
+ image->mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGBA8888, 0u, 0u );
+ image->mWidth = image->mHeight = 0u;