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.
19 #include "image-atlas.h"
22 #include <dali-toolkit/internal/image-loader/image-atlas-impl.h>
28 ImageAtlas::ImageAtlas()
32 ImageAtlas::~ImageAtlas()
36 Texture ImageAtlas::PackToAtlas(const std::vector<PixelData>& pixelData, Dali::Vector<Vector4>& textureRects)
38 return Internal::ImageAtlas::PackToAtlas(pixelData, textureRects);
41 ImageAtlas::ImageAtlas(Internal::ImageAtlas* internal)
42 : BaseHandle(internal)
46 ImageAtlas::ImageAtlas(const ImageAtlas& handle)
51 ImageAtlas& ImageAtlas::operator=(const ImageAtlas& handle)
53 BaseHandle::operator=(handle);
57 ImageAtlas ImageAtlas::New(SizeType width, SizeType height, Pixel::Format pixelFormat)
59 IntrusivePtr<Internal::ImageAtlas> internal = Internal::ImageAtlas::New(width, height, pixelFormat);
60 return ImageAtlas(internal.Get());
63 Texture ImageAtlas::GetAtlas()
65 return GetImplementation(*this).GetAtlas();
68 float ImageAtlas::GetOccupancyRate() const
70 return GetImplementation(*this).GetOccupancyRate();
73 void ImageAtlas::SetBrokenImage(const std::string& brokenImageUrl)
75 GetImplementation(*this).SetBrokenImage(brokenImageUrl);
78 bool ImageAtlas::Upload(Vector4& textureRect,
79 const std::string& url,
81 FittingMode::Type fittingMode,
82 bool orientationCorrection)
84 return Upload(textureRect, url, size, fittingMode, orientationCorrection, NULL);
87 bool ImageAtlas::Upload(Vector4& textureRect,
88 const std::string& url,
90 FittingMode::Type fittingMode,
91 bool orientationCorrection,
92 AtlasUploadObserver* atlasUploadObserver)
94 return GetImplementation(*this).Upload(textureRect, url, size, fittingMode, orientationCorrection, atlasUploadObserver);
97 bool ImageAtlas::Upload(Vector4& textureRect, PixelData pixelData)
99 return GetImplementation(*this).Upload(textureRect, pixelData);
102 void ImageAtlas::Remove(const Vector4& textureRect)
104 GetImplementation(*this).Remove(textureRect);
107 } // namespace Toolkit