1 #ifndef DALI_TOOLKIT_DEVEL_API_IMAGE_LOADER_ASYNC_IMAGE_LOADER_DEVEL_H
2 #define DALI_TOOLKIT_DEVEL_API_IMAGE_LOADER_ASYNC_IMAGE_LOADER_DEVEL_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 #include <dali/devel-api/adaptor-framework/animated-image-loading.h>
22 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
23 #include <dali/public-api/signals/dali-signal.h>
26 #include <dali-toolkit/public-api/image-loader/async-image-loader.h>
32 namespace DevelAsyncImageLoader
34 typedef Signal<void(uint32_t, Devel::PixelBuffer)> PixelBufferLoadedSignalType;
37 * @brief Whether to multiply alpha into color channels on load
39 enum class PreMultiplyOnLoad
41 OFF = 0, ///< Don't modify the image
42 ON ///< Multiply alpha into color channels on load
46 * @brief Starts an animated image loading task.
49 * @param[in] asyncImageLoader The ayncImageLoader
50 * @param[in] animatedImageLoading The AnimatedImageLoading to load animated image
51 * @param[in] frameIndex The frame index of a frame to be loaded frame
52 * @param[in] preMultiplyOnLoad ON if the image 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.
53 * @return The loading task id
55 DALI_TOOLKIT_API uint32_t LoadAnimatedImage(AsyncImageLoader asyncImageLoader,
56 Dali::AnimatedImageLoading animatedImageLoading,
58 DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
61 * @brief Starts an image loading task.
64 * @param[in] asyncImageLoader The ayncImageLoader
65 * @param[in] url The URL of the image file to load
66 * @param[in] dimensions The width and height to fit the loaded image to
67 * @param[in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter
68 * @param[in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size
69 * @param[in] orientationCorrection Reorient the image to respect any orientation metadata in its header
70 * @param[in] preMultiplyOnLoad ON if the image 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.
71 * @return The loading task id
73 DALI_TOOLKIT_API uint32_t Load(AsyncImageLoader asyncImageLoader,
74 const std::string& url,
75 ImageDimensions dimensions,
76 FittingMode::Type fittingMode,
77 SamplingMode::Type samplingMode,
78 bool orientationCorrection,
79 DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
82 * @brief Starts an mask applying task.
85 * @param[in] asyncImageLoader The ayncImageLoader
86 * @param[in] pixelBuffer Pointer to raw pixel data to be masked
87 * @param[in] maskPixelBuffer Pointer to raw masking data
88 * @param[in] contentScale The factor to scale the content
89 * @param[in] cropToMask Whether to crop the content to the mask size
90 * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha.
91 * @return The masking task id
93 DALI_TOOLKIT_API uint32_t ApplyMask(AsyncImageLoader asyncImageLoader,
94 Devel::PixelBuffer pixelBuffer,
95 Devel::PixelBuffer maskPixelBuffer,
98 DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
101 * Connect to this signal if you want to load a PixelBuffer instead of a PixelData.
102 * @note Connecting to this signal prevents the emission of the ImageLoadedSignal.
104 DALI_TOOLKIT_API PixelBufferLoadedSignalType& PixelBufferLoadedSignal(AsyncImageLoader asyncImageLoader);
106 } // namespace DevelAsyncImageLoader
107 } // namespace Toolkit