#define DALI_ANIMATED_IMAGE_LOADING_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/math/uint-16-pair.h>
#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/images/image-operations.h>
// INTERNAL INCLUDES
-#include <dali/public-api/dali-adaptor-common.h>
#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali/public-api/dali-adaptor-common.h>
namespace Dali
{
-
class PixelData;
typedef Dali::Uint16Pair ImageDimensions;
{
class AnimatedImageLoading;
}
-}
+} // namespace DALI_INTERNAL
/**
* Class to manage loading frames of an animated image in small chunks. Lazy initializes only when
class DALI_ADAPTOR_API AnimatedImageLoading : public BaseHandle
{
public:
-
/**
* Create a GifLoading with the given url and resourceType.
* @param[in] url The url of the animated image to load
* @param[in] isLocalResource The true or false whether this is a local resource.
* @return A newly created GifLoading.
*/
- static AnimatedImageLoading New( const std::string& url, bool isLocalResource );
+ static AnimatedImageLoading New(const std::string& url, bool isLocalResource);
/**
* @brief Constructor
* @param[in] handle to An object.
* @return handle to a Capture object or an uninitialized handle.
*/
- static AnimatedImageLoading DownCast( BaseHandle handle );
-
+ static AnimatedImageLoading DownCast(BaseHandle handle);
/**
* @brief Copy constructor.
AnimatedImageLoading& operator=(const AnimatedImageLoading& rhs) = default;
/**
- * @brief Destructor
+ * @brief Move constructor.
+ *
+ * @param[in] move The AnimatedImageLoading to move
*/
- ~AnimatedImageLoading();
+ AnimatedImageLoading(AnimatedImageLoading&& move) = default;
/**
- * @brief Load the next N Frames of the animated image.
+ * @brief Move assignment operator
*
- * @note This function will load the entire animated image into memory if not already loaded.
- * @param[in] frameStartIndex The frame counter to start from. Will usually be the next frame
- * after the previous invocation of this method, or 0 to start.
- * @param[in] count The number of frames to load
- * @param[out] pixelData The vector in which to return the frame data
- * @return True if the frame data was successfully loaded
+ * @param[in] rhs The AnimatedImageLoading to move
+ * @return A reference to this
*/
- bool LoadNextNFrames( uint32_t frameStartIndex, int count, std::vector<Dali::PixelData>& pixelData );
+ AnimatedImageLoading& operator=(AnimatedImageLoading&& rhs) = default;
- /**
+ /**
+ * @brief Destructor
+ */
+ ~AnimatedImageLoading();
+
+ /**
* @brief Load a frame of the animated image.
*
* @note This function will load the entire animated image into memory if not already loaded.
* @param[in] frameIndex The frame index to load.
+ * @param[in] size The width and height to fit the loaded image to.
+ * @param[in] fittingMode The FittingMode of the resource to load
+ * @param[in] samplingMode The SamplingMode of the resource to load
+ *
* @return Dali::Devel::PixelBuffer The loaded PixelBuffer. If loading is fail, return empty handle.
*/
-
- Dali::Devel::PixelBuffer LoadFrame( uint32_t frameIndex );
+ Dali::Devel::PixelBuffer LoadFrame(uint32_t frameIndex,
+ ImageDimensions size = ImageDimensions(),
+ Dali::FittingMode::Type fittingMode = Dali::FittingMode::SCALE_TO_FILL,
+ Dali::SamplingMode::Type samplingMode = Dali::SamplingMode::BOX_THEN_LINEAR);
/**
* @brief Get the size of a animated image.
*
* @return The time interval of the frame(microsecond).
*/
- uint32_t GetFrameInterval( uint32_t frameIndex ) const;
+ uint32_t GetFrameInterval(uint32_t frameIndex) const;
/**
* @brief Get the animated image file URL
*/
std::string GetUrl() const;
+ /**
+ * @brief Return whether the animated image loading is succeeded or not.
+ *
+ * @return True when the animated image loading is succeeded.
+ */
+ bool HasLoadingSucceeded() const;
+
public: // Not intended for application developers
/// @cond internal
/**
*
* @param[in] internal A pointer to a newly allocated Dali resource.
*/
- explicit DALI_INTERNAL AnimatedImageLoading( Internal::Adaptor::AnimatedImageLoading* internal );
+ explicit DALI_INTERNAL AnimatedImageLoading(Internal::Adaptor::AnimatedImageLoading* internal);
/// @endcond
};