Merge "New DepthTestMode API in Renderer" into devel/master
[platform/core/uifw/dali-core.git] / dali / devel-api / images / 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 <dali/devel-api/images/atlas.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/images/atlas-impl.h>
23 #include <dali/internal/event/images/buffer-image-impl.h>
24
25 namespace Dali
26 {
27
28 Atlas Atlas::New( SizeType width,
29                   SizeType height,
30                   Pixel::Format pixelFormat,
31                   bool recoverContext )
32 {
33   DALI_ASSERT_ALWAYS( 0u != width  && "Invalid Atlas width requested" );
34   DALI_ASSERT_ALWAYS( 0u != height && "Invalid Atlas height requested" );
35
36   return Atlas( Internal::Atlas::New( width, height, pixelFormat, recoverContext ) );
37 }
38
39 Atlas::Atlas()
40 {
41 }
42
43 void Atlas::Clear( const Vector4& color  )
44 {
45   GetImplementation( *this ).Clear( color );
46 }
47
48 bool Atlas::Upload( BufferImage bufferImage,
49                     SizeType xOffset,
50                     SizeType yOffset )
51 {
52   return GetImplementation(*this).Upload( GetImplementation(bufferImage), xOffset, yOffset );
53 }
54
55 bool Atlas::Upload( const std::string& url,
56                     SizeType xOffset,
57                     SizeType yOffset )
58 {
59   return GetImplementation(*this).Upload( url, xOffset, yOffset );
60 }
61
62 bool Atlas::Upload( PixelDataPtr pixelData,
63                     SizeType xOffset,
64                     SizeType yOffset )
65 {
66   return GetImplementation(*this).Upload( pixelData, xOffset, yOffset );
67 }
68
69 Atlas Atlas::DownCast( BaseHandle handle )
70 {
71   return Atlas( dynamic_cast<Dali::Internal::Atlas*>(handle.GetObjectPtr()) );
72 }
73
74 Atlas::~Atlas()
75 {
76 }
77
78 Atlas::Atlas( const Atlas& handle )
79 : Image( handle )
80 {
81 }
82
83 Atlas& Atlas::operator=( const Atlas& rhs )
84 {
85   BaseHandle::operator=(rhs);
86   return *this;
87 }
88
89 Atlas::Atlas( Internal::Atlas* internal )
90 : Image( internal )
91 {
92 }
93
94 } // namespace Dali