+LoadingTask::LoadingTask(uint32_t id, Dali::AnimatedImageLoading animatedImageLoading, uint32_t frameIndex)
+: pixelBuffer(),
+ url(),
+ encodedImageBuffer(),
+ id(id),
+ dimensions(),
+ fittingMode(),
+ samplingMode(),
+ orientationCorrection(),
+ preMultiplyOnLoad(DevelAsyncImageLoader::PreMultiplyOnLoad::OFF),
+ isMaskTask(false),
+ maskPixelBuffer(),
+ contentScale(1.0f),
+ cropToMask(false),
+ animatedImageLoading(animatedImageLoading),
+ frameIndex(frameIndex)
+{
+}
+
+LoadingTask::LoadingTask(uint32_t id, const VisualUrl& url, ImageDimensions dimensions, FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection, DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad)
+: pixelBuffer(),
+ url(url),
+ encodedImageBuffer(),
+ id(id),
+ dimensions(dimensions),
+ fittingMode(fittingMode),
+ samplingMode(samplingMode),
+ orientationCorrection(orientationCorrection),
+ preMultiplyOnLoad(preMultiplyOnLoad),
+ isMaskTask(false),
+ maskPixelBuffer(),
+ contentScale(1.0f),
+ cropToMask(false),
+ animatedImageLoading(),
+ frameIndex(0u)
+{
+}
+
+LoadingTask::LoadingTask(uint32_t id, const EncodedImageBuffer& encodedImageBuffer, ImageDimensions dimensions, FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection, DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad)
+: pixelBuffer(),
+ url(),
+ encodedImageBuffer(encodedImageBuffer),
+ id(id),
+ dimensions(dimensions),
+ fittingMode(fittingMode),
+ samplingMode(samplingMode),
+ orientationCorrection(orientationCorrection),
+ preMultiplyOnLoad(preMultiplyOnLoad),
+ isMaskTask(false),
+ maskPixelBuffer(),
+ contentScale(1.0f),
+ cropToMask(false),
+ animatedImageLoading(),
+ frameIndex(0u)
+{
+}
+
+LoadingTask::LoadingTask(uint32_t id, Devel::PixelBuffer pixelBuffer, Devel::PixelBuffer maskPixelBuffer, float contentScale, bool cropToMask, DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad)
+: pixelBuffer(pixelBuffer),
+ url(""),
+ encodedImageBuffer(),
+ id(id),
+ dimensions(),
+ fittingMode(),
+ samplingMode(),
+ orientationCorrection(),
+ preMultiplyOnLoad(preMultiplyOnLoad),
+ isMaskTask(true),
+ maskPixelBuffer(maskPixelBuffer),
+ contentScale(contentScale),
+ cropToMask(cropToMask),
+ animatedImageLoading(),
+ frameIndex(0u)
+{
+}
+
+void LoadingTask::Load()
+{
+ if(animatedImageLoading)
+ {
+ pixelBuffer = animatedImageLoading.LoadFrame(frameIndex);
+ }
+ else if(encodedImageBuffer)
+ {
+ pixelBuffer = Dali::LoadImageFromBuffer(encodedImageBuffer.GetRawBuffer(), dimensions, fittingMode, samplingMode, orientationCorrection);
+ }
+ else if(url.IsValid() && url.IsLocalResource())
+ {
+ pixelBuffer = Dali::LoadImageFromFile(url.GetUrl(), dimensions, fittingMode, samplingMode, orientationCorrection);
+ }
+ else if(url.IsValid())
+ {
+ pixelBuffer = Dali::DownloadImageSynchronously(url.GetUrl(), dimensions, fittingMode, samplingMode, orientationCorrection);
+ }
+
+ if(!pixelBuffer)
+ {
+ DALI_LOG_ERROR("LoadingTask::Load: Loading is failed: %s\n", url.GetUrl().c_str());
+ }
+}
+
+void LoadingTask::ApplyMask()
+{
+ pixelBuffer.ApplyMask(maskPixelBuffer, contentScale, cropToMask);
+}