05fe7e8fc916c34146efbc74fbb8ef967800715a
[platform/core/uifw/dali-adaptor.git] / adaptors / devel-api / adaptor-framework / pixmap-image.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 <pixmap-image.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/any.h>
23
24 // INTERNAL INCLUDES
25 #include <pixmap-image-impl.h>
26
27 namespace Dali
28 {
29
30 PixmapImagePtr PixmapImage::New( unsigned int width, unsigned int height, ColorDepth depth )
31 {
32   Any empty;
33   PixmapImagePtr image = new PixmapImage( width, height, depth, empty );
34   return image;
35 }
36
37 Any PixmapImage::GetPixmap()
38 {
39   return mImpl->GetPixmap();
40 }
41
42 PixmapImagePtr PixmapImage::New( Any pixmap )
43 {
44   PixmapImagePtr image = new PixmapImage(0, 0, COLOR_DEPTH_DEFAULT, pixmap);
45   return image;
46 }
47
48 bool PixmapImage::GetPixels( std::vector<unsigned char> &pixbuf, unsigned int &width, unsigned int &height, Pixel::Format& pixelFormat ) const
49 {
50   return mImpl->GetPixels( pixbuf, width, height, pixelFormat );
51 }
52
53 bool PixmapImage::EncodeToFile(const std::string& filename) const
54 {
55   return mImpl->EncodeToFile(filename);
56 }
57
58 bool PixmapImage::GlExtensionCreate()
59 {
60   return mImpl->GlExtensionCreate();
61 }
62
63 void PixmapImage::GlExtensionDestroy()
64 {
65   mImpl->GlExtensionDestroy();
66 }
67
68 unsigned int PixmapImage::TargetTexture()
69 {
70   return mImpl->TargetTexture();
71 }
72
73 void PixmapImage::PrepareTexture()
74 {
75
76 }
77
78 unsigned int PixmapImage::GetWidth() const
79 {
80   return mImpl->GetWidth();
81 }
82
83 unsigned int PixmapImage::GetHeight() const
84 {
85   return mImpl->GetHeight();
86 }
87
88 bool PixmapImage::RequiresBlending() const
89 {
90   return mImpl->RequiresBlending();
91 }
92
93 PixmapImage::PixmapImage( unsigned int width, unsigned int height, ColorDepth depth, Any pixmap )
94 {
95    mImpl = Internal::Adaptor::PixmapImage::New( width, height, depth, pixmap );
96 }
97
98 PixmapImage::~PixmapImage()
99 {
100   delete mImpl;
101 }
102
103 } // namespace Dali