a7174d5d2a379d81fba4710a474538b0d81757c6
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / image-loader / image-atlas.cpp
1  /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include "image-atlas.h"
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/internal/image-loader/image-atlas-impl.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 ImageAtlas::ImageAtlas()
31 {
32 }
33
34 ImageAtlas::~ImageAtlas()
35 {
36 }
37
38 ImageAtlas::ImageAtlas(Internal::ImageAtlas* internal)
39 : BaseHandle( internal )
40 {
41 }
42
43 ImageAtlas::ImageAtlas( const ImageAtlas& handle )
44 : BaseHandle( handle )
45 {
46 }
47
48 ImageAtlas& ImageAtlas::operator=( const ImageAtlas& handle )
49 {
50   BaseHandle::operator=(handle);
51   return *this;
52 }
53
54 ImageAtlas ImageAtlas::New(SizeType width, SizeType height,
55                            Pixel::Format pixelFormat)
56 {
57   IntrusivePtr<Internal::ImageAtlas> internal = Internal::ImageAtlas::New( width, height, pixelFormat);
58   return ImageAtlas( internal.Get() );
59 }
60
61 Texture ImageAtlas::GetAtlas()
62 {
63   return GetImplementation( *this ).GetAtlas();
64 }
65
66 float ImageAtlas::GetOccupancyRate() const
67 {
68   return GetImplementation( *this ).GetOccupancyRate();
69 }
70
71
72 void ImageAtlas::SetBrokenImage( const std::string& brokenImageUrl )
73 {
74   GetImplementation( *this ).SetBrokenImage( brokenImageUrl );
75 }
76
77 bool ImageAtlas::Upload( Vector4& textureRect,
78                          const std::string& url,
79                          ImageDimensions size,
80                          FittingMode::Type fittingMode,
81                          bool orientationCorrection )
82 {
83   return GetImplementation(*this).Upload( textureRect, url, size, fittingMode, orientationCorrection );
84 }
85
86 bool ImageAtlas::Upload( Vector4& textureRect, PixelData pixelData )
87 {
88   return GetImplementation(*this).Upload( textureRect, pixelData );
89 }
90
91 void ImageAtlas::Remove(const Vector4& textureRect)
92 {
93   GetImplementation(*this).Remove( textureRect );
94 }
95
96 } // namespace Toolkit
97
98 } // namespace Dali