#define DALI_TOOLKIT_IMAGE_LOADING_TASK_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali-toolkit/devel-api/image-loader/async-image-loader-devel.h>
+#include <dali-toolkit/internal/texture-manager/texture-manager-type.h>
#include <dali-toolkit/internal/visuals/visual-url.h>
-#include <dali/public-api/adaptor-framework/async-task-manager.h>
#include <dali/devel-api/adaptor-framework/event-thread-callback.h>
#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
#include <dali/devel-api/threading/conditional-wait.h>
#include <dali/devel-api/threading/mutex.h>
#include <dali/devel-api/threading/thread.h>
#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <dali/public-api/adaptor-framework/async-task-manager.h>
#include <dali/public-api/adaptor-framework/encoded-image-buffer.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/object/ref-object.h>
-#include <dali-toolkit/internal/texture-manager/texture-manager-type.h>
namespace Dali
{
{
namespace Internal
{
-
class LoadingTask;
using LoadingTaskPtr = IntrusivePtr<LoadingTask>;
/**
* Constructor.
* @param [in] id of the task
+ * @param [in] animatedImageLoading The AnimatedImageLoading to load animated image
+ * @param [in] frameIndex The frame index of a frame to be loaded frame
+ * @param [in] dimensions The width and height to fit the loaded image to
+ * @param [in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter
+ * @param [in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size
+ * @param [in] preMultiplyOnLoad ON if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha or if the image need to be applied alpha mask.
+ * @param [in] callback The callback that is called when the operation is completed.
+ */
+ LoadingTask(uint32_t id,
+ Dali::AnimatedImageLoading animatedImageLoading,
+ uint32_t frameIndex,
+ Dali::ImageDimensions dimensions,
+ Dali::FittingMode::Type fittingMode,
+ Dali::SamplingMode::Type samplingMode,
+ DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad,
+ CallbackBase* callback);
+
+ /**
+ * Constructor.
+ * @param [in] id of the task
* @param [in] url The URL of the image file to load.
* @param [in] size The width and height to fit the loaded image to, 0.0 means whole image
* @param [in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter.
~LoadingTask() override;
/**
- * Process the task accodring to the type
+ * @brief Set the Texture Id
+ */
+ void SetTextureId(TextureManagerType::TextureId id);
+
+public: // Implementation of AsyncTask
+ /**
+ * @copydoc Dali::AsyncTask::Process()
*/
void Process() override;
/**
- * Whether the task is ready to process.
- * @return True if the task is ready to process.
+ * @copydoc Dali::AsyncTask::IsReady()
*/
bool IsReady() override;
/**
- * @brief Set the Texture Id
- *
+ * @copydoc Dali::AsyncTask::GetTaskName()
*/
- void SetTextureId(TextureManagerType::TextureId id);
+ std::string_view GetTaskName() const override
+ {
+ return "LoadingTask";
+ }
private:
// Undefined
bool isMaskTask : 1; ///< whether this task is for mask or not
bool cropToMask : 1; ///< Whether to crop the content to the mask size
bool loadPlanes : 1; ///< Whether to load image planes
- bool isReady : 1; ///< Whether this task ready to run
+ bool isReady : 1; ///< Whether this task ready to run
};
} // namespace Internal