2 * Copyright (c) 2015 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.
19 #include <dali/public-api/images/resource-image.h>
22 #include <dali/public-api/images/image-attributes.h>
23 #include <dali/public-api/math/vector2.h>
24 #include <dali/internal/event/images/resource-image-impl.h>
25 #include <dali/internal/event/common/thread-local-storage.h>
26 #include <dali/integration-api/platform-abstraction.h>
31 Vector2 ResourceImage::GetImageSize( const std::string& url )
34 Internal::ThreadLocalStorage::Get().GetPlatformAbstraction().GetClosestImageSize( url, ImageAttributes::DEFAULT_ATTRIBUTES, size );
38 ResourceImage::ResourceImage()
42 ResourceImage::ResourceImage(Internal::ResourceImage* internal) : Image(internal)
46 ResourceImage::~ResourceImage()
50 ResourceImage::ResourceImage( const ResourceImage& handle )
55 ResourceImage& ResourceImage::operator=( const ResourceImage& rhs )
57 BaseHandle::operator=(rhs);
61 ResourceImage ResourceImage::New( const std::string& url )
63 Internal::ResourceImagePtr internal = Internal::ResourceImage::New( url,
64 Dali::ImageAttributes::DEFAULT_ATTRIBUTES );
65 return ResourceImage(internal.Get());
68 ResourceImage ResourceImage::New( const std::string& url, LoadPolicy loadPol, ReleasePolicy releasePol )
70 Internal::ResourceImagePtr internal = Internal::ResourceImage::New( url,
71 Dali::ImageAttributes::DEFAULT_ATTRIBUTES,
72 loadPol, releasePol );
73 return ResourceImage(internal.Get());
76 ResourceImage ResourceImage::New( const std::string& url, const ImageAttributes& attributes )
78 Internal::ResourceImagePtr internal = Internal::ResourceImage::New( url, attributes );
79 return ResourceImage(internal.Get());
82 ResourceImage ResourceImage::New( const std::string& url, const ImageAttributes& attributes, LoadPolicy loadPol, ReleasePolicy releasePol )
84 Internal::ResourceImagePtr internal = Internal::ResourceImage::New( url, attributes, loadPol, releasePol );
85 return ResourceImage(internal.Get());
88 ResourceImage ResourceImage::DownCast( BaseHandle handle )
90 return ResourceImage( dynamic_cast<Dali::Internal::ResourceImage*>(handle.GetObjectPtr()) );
93 ResourceImage::LoadPolicy ResourceImage::GetLoadPolicy() const
95 return GetImplementation(*this).GetLoadPolicy();
98 LoadingState ResourceImage::GetLoadingState() const
100 return GetImplementation(*this).GetLoadingState();
103 std::string ResourceImage::GetUrl() const
105 return GetImplementation(*this).GetUrl();
108 void ResourceImage::Reload()
110 GetImplementation(*this).Reload();
113 ImageAttributes ResourceImage::GetAttributes() const
115 return GetImplementation(*this).GetAttributes();
118 ResourceImage::ResourceImageSignal& ResourceImage::LoadingFinishedSignal()
120 return GetImplementation(*this).LoadingFinishedSignal();