71b67ea05dc0691f6b262aefb3d8f166f71e5f56
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / image-atlas / 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-atlas/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 Image ImageAtlas::GetAtlas()
62 {
63   return GetImplementation( *this ).GetAtlas();
64 }
65
66 void ImageAtlas::SetBrokenImage( const std::string& brokenImageUrl )
67 {
68   GetImplementation( *this ).SetBrokenImage( brokenImageUrl );
69 }
70
71 bool ImageAtlas::Upload( Vector4& textureRect,
72                          const std::string& url,
73                          ImageDimensions size,
74                          FittingMode::Type fittingMode,
75                          bool orientationCorrection )
76 {
77   return GetImplementation(*this).Upload( textureRect, url, size, fittingMode, orientationCorrection );
78 }
79
80 bool ImageAtlas::Upload( Vector4& textureRect, PixelDataPtr pixelData )
81 {
82   return GetImplementation(*this).Upload( textureRect, pixelData );
83 }
84
85 void ImageAtlas::Remove(const Vector4& textureRect)
86 {
87   GetImplementation(*this).Remove( textureRect );
88 }
89
90 } // namespace Toolkit
91
92 } // namespace Dali