2 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "async-image-loader.h"
21 #include <dali-toolkit/internal/image-loader/async-image-loader-impl.h>
22 #include <dali-toolkit/internal/visuals/visual-url.h>
30 AsyncImageLoader::AsyncImageLoader()
34 AsyncImageLoader::~AsyncImageLoader()
38 AsyncImageLoader::AsyncImageLoader( Internal::AsyncImageLoader* impl )
43 AsyncImageLoader::AsyncImageLoader( const AsyncImageLoader& handle ) = default;
45 AsyncImageLoader::AsyncImageLoader( AsyncImageLoader&& rhs ) = default;
47 AsyncImageLoader& AsyncImageLoader::operator=( const AsyncImageLoader& handle ) = default;
49 AsyncImageLoader& AsyncImageLoader::operator=( AsyncImageLoader&& rhs ) = default;
51 AsyncImageLoader AsyncImageLoader::DownCast( BaseHandle handle )
53 return AsyncImageLoader( dynamic_cast<Dali::Toolkit::Internal::AsyncImageLoader*>( handle.GetObjectPtr() ) );
56 AsyncImageLoader AsyncImageLoader::New()
58 IntrusivePtr<Internal::AsyncImageLoader> internal = Internal::AsyncImageLoader::New();
59 return AsyncImageLoader( internal.Get() );
62 uint32_t AsyncImageLoader::Load( const std::string& url )
64 return GetImplementation( *this ).Load( Toolkit::Internal::VisualUrl(url), ImageDimensions(), FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true, DevelAsyncImageLoader::PreMultiplyOnLoad::OFF );
67 uint32_t AsyncImageLoader::Load( const std::string& url, ImageDimensions dimensions )
69 return GetImplementation( *this ).Load( Toolkit::Internal::VisualUrl(url), dimensions, FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, true , DevelAsyncImageLoader::PreMultiplyOnLoad::OFF );
72 uint32_t AsyncImageLoader::Load( const std::string& url,
73 ImageDimensions dimensions,
74 FittingMode::Type fittingMode,
75 SamplingMode::Type samplingMode,
76 bool orientationCorrection )
78 return GetImplementation(*this).Load( Toolkit::Internal::VisualUrl(url), dimensions, fittingMode, samplingMode, orientationCorrection, DevelAsyncImageLoader::PreMultiplyOnLoad::OFF );
81 bool AsyncImageLoader::Cancel( uint32_t loadingTaskId )
83 return GetImplementation(*this).Cancel( loadingTaskId );
86 void AsyncImageLoader::CancelAll()
88 GetImplementation( *this ).CancelAll();
91 AsyncImageLoader::ImageLoadedSignalType& AsyncImageLoader::ImageLoadedSignal()
93 return GetImplementation( *this ).ImageLoadedSignal();
95 } // namespace Toolkit