X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fimage-loader%2Fasync-image-loader-impl.h;h=39e46905ac795c596e67d7d9ad5c4f94ac9652e3;hb=refs%2Fchanges%2F49%2F262049%2F2;hp=cb0311c7e8b3b5eb80641de9c9117ee7e61d300a;hpb=41307f75478fd6c6fb5f9ae7e7de5036647f39b3;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/image-loader/async-image-loader-impl.h b/dali-toolkit/internal/image-loader/async-image-loader-impl.h index cb0311c..39e4690 100644 --- a/dali-toolkit/internal/image-loader/async-image-loader-impl.h +++ b/dali-toolkit/internal/image-loader/async-image-loader-impl.h @@ -1,8 +1,8 @@ -#ifndef DALI_TOOLKIT_ASYNC_IMAGE_LOADER_IMPL_H__ -#define DALI_TOOLKIT_ASYNC_IMAGE_LOADER_IMPL_H__ +#ifndef DALI_TOOLKIT_ASYNC_IMAGE_LOADER_IMPL_H +#define DALI_TOOLKIT_ASYNC_IMAGE_LOADER_IMPL_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -22,22 +22,19 @@ #include // INTERNAL INCLUDES -#include +#include #include +#include namespace Dali { - namespace Toolkit { - namespace Internal { - class AsyncImageLoader : public BaseObject { public: - /** * Constructor */ @@ -49,13 +46,52 @@ public: static IntrusivePtr New(); /** - * @copydoc Toolkit::AsyncImageLoader::Load( const std::string&, ImageDimensions,FittingMode::Type, SamplingMode::Type, bool ) + * @copydoc Toolkit::AsyncImageLoader::LoadAnimatedImage( Dali::AnimatedImageLoading animatedImageLoading, uint32_t frameIndex ) + */ + uint32_t LoadAnimatedImage(Dali::AnimatedImageLoading animatedImageLoading, + uint32_t frameIndex); + + /** + * @copydoc Toolkit::AsyncImageLoader::Load( const std::string&, ImageDimensions, FittingMode::Type, SamplingMode::Type, bool , DevelAsyncImageLoader::PreMultiplyOnLoad ) + */ + uint32_t Load(const VisualUrl& url, + ImageDimensions dimensions, + FittingMode::Type fittingMode, + SamplingMode::Type samplingMode, + bool orientationCorrection, + DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad); + + /** + * @brief Starts an image loading task by encoded image buffer. + * @param[in] encodedImageBuffer The encoded buffer of the image to load + * @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] orientationCorrection Reorient the image to respect any orientation metadata in its header + * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha. + * @return The loading task id */ - uint32_t Load( const std::string& url, - ImageDimensions size, - FittingMode::Type fittingMode, - SamplingMode::Type samplingMode, - bool orientationCorrection ); + uint32_t LoadEncodedImageBuffer(const EncodedImageBuffer& encodedImageBuffer, + ImageDimensions dimensions, + FittingMode::Type fittingMode, + SamplingMode::Type samplingMode, + bool orientationCorrection, + DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad); + + /** + * @brief Starts an mask applying task. + * @param[in] pixelBuffer of the to be masked image + * @param[in] maskPixelBuffer of the mask image + * @param[in] contentScale The factor to scale the content + * @param[in] cropToMask Whether to crop the content to the mask size + * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha. + * @return The loading task id + */ + uint32_t ApplyMask(Devel::PixelBuffer pixelBuffer, + Devel::PixelBuffer maskPixelBuffer, + float contentScale, + bool cropToMask, + DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad); /** * @copydoc Toolkit::AsyncImageLoader::ImageLoadedSignal @@ -63,9 +99,14 @@ public: Toolkit::AsyncImageLoader::ImageLoadedSignalType& ImageLoadedSignal(); /** + * @copydoc Toolkit::AsyncImageLoader::PixelBufferLoadedSignal + */ + Toolkit::DevelAsyncImageLoader::PixelBufferLoadedSignalType& PixelBufferLoadedSignal(); + + /** * @copydoc Toolkit::AsyncImageLoader::Cancel */ - bool Cancel( uint32_t loadingTaskId ); + bool Cancel(uint32_t loadingTaskId); /** * @copydoc Toolkit::AsyncImageLoader::CancelAll @@ -78,45 +119,42 @@ public: void ProcessLoadedImage(); protected: - /** * Destructor */ - ~AsyncImageLoader(); + ~AsyncImageLoader() override; private: - - Toolkit::AsyncImageLoader::ImageLoadedSignalType mLoadedSignal; + Toolkit::AsyncImageLoader::ImageLoadedSignalType mLoadedSignal; + Toolkit::DevelAsyncImageLoader::PixelBufferLoadedSignalType mPixelBufferLoadedSignal; ImageLoadThread mLoadThread; uint32_t mLoadTaskId; bool mIsLoadThreadStarted; - - }; } // namespace Internal -inline const Internal::AsyncImageLoader& GetImplementation( const Toolkit::AsyncImageLoader& loader ) +inline const Internal::AsyncImageLoader& GetImplementation(const Toolkit::AsyncImageLoader& handle) { - DALI_ASSERT_ALWAYS( loader && "AsyncImageLoader handle is empty" ); + DALI_ASSERT_ALWAYS(handle && "AsyncImageLoader handle is empty"); - const BaseObject& object = loader.GetBaseObject(); + const BaseObject& object = handle.GetBaseObject(); - return static_cast( object ); + return static_cast(object); } -inline Internal::AsyncImageLoader& GetImplementation( Toolkit::AsyncImageLoader& loader ) +inline Internal::AsyncImageLoader& GetImplementation(Toolkit::AsyncImageLoader& handle) { - DALI_ASSERT_ALWAYS( loader && "AsyncImageLoader handle is empty" ); + DALI_ASSERT_ALWAYS(handle && "AsyncImageLoader handle is empty"); - BaseObject& object = loader.GetBaseObject(); + BaseObject& object = handle.GetBaseObject(); - return static_cast( object ); + return static_cast(object); } } // namespace Toolkit } // namespace Dali -#endif /* DALI_TOOLKIT_ASYNC_IMAGE_LOADER_IMPL_H__ */ +#endif // DALI_TOOLKIT_ASYNC_IMAGE_LOADER_IMPL_H