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) 2019 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.
20 #include <dali/public-api/signals/dali-signal.h>
21 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
22 #include <dali-toolkit/public-api/image-loader/async-image-loader.h>
28 namespace DevelAsyncImageLoader
31 typedef Signal< void ( uint32_t, Devel::PixelBuffer, bool ) > PixelBufferLoadedSignalType;
34 * @brief Whether to multiply alpha into color channels on load
36 enum class PreMultiplyOnLoad
38 OFF = 0, ///< Don't modify the image
39 ON ///< Multiply alpha into color channels on load
43 * @brief Starts an image loading task.
46 * @param[in] asyncImageLoader The ayncImageLoader
47 * @param[in] url The URL of the image file to load
48 * @param[in] dimensions The width and height to fit the loaded image to
49 * @param[in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter
50 * @param[in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size
51 * @param[in] orientationCorrection Reorient the image to respect any orientation metadata in its header
52 * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha
53 * @return The loading task id
55 DALI_TOOLKIT_API uint32_t Load( AsyncImageLoader asyncImageLoader,
56 const std::string& url,
57 ImageDimensions dimensions,
58 FittingMode::Type fittingMode,
59 SamplingMode::Type samplingMode,
60 bool orientationCorrection,
61 DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad );
64 * @brief Starts an mask applying task.
67 * @param[in] asyncImageLoader The ayncImageLoader
68 * @param[in] pixelBuffer Pointer to raw pixel data to be masked
69 * @param[in] maskPixelBuffer Pointer to raw masking data
70 * @param[in] contentScale The factor to scale the content
71 * @param[in] cropToMask Whether to crop the content to the mask size
72 * @return The masking task id
74 DALI_TOOLKIT_API uint32_t ApplyMask( AsyncImageLoader asyncImageLoader,
75 Devel::PixelBuffer pixelBuffer,
76 Devel::PixelBuffer maskPixelBuffer,
81 * Connect to this signal if you want to load a PixelBuffer instead of a PixelData.
82 * @note Connecting to this signal prevents the emission of the ImageLoadedSignal.
84 DALI_TOOLKIT_API PixelBufferLoadedSignalType& PixelBufferLoadedSignal( AsyncImageLoader asyncImageLoader );