Dali 3D User Interface Engine
native-image-source.h
Go to the documentation of this file.
1 #ifndef __DALI_NATIVE_IMAGE_SOURCE_H__
2 #define __DALI_NATIVE_IMAGE_SOURCE_H__
3 
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 // EXTERNAL INCLUDES
22 #include <string>
23 
28 
29 namespace Dali
30 {
36 namespace Internal DALI_INTERNAL
37 {
38 namespace Adaptor
39 {
40 class NativeImageSource;
41 }
42 }
43 
50 
60 {
61 public:
62 
68  {
73  COLOR_DEPTH_32
74  };
75 
86  static NativeImageSourcePtr New( unsigned int width, unsigned int height, ColorDepth depth );
87 
95  static NativeImageSourcePtr New( Any nativeImageSource );
96 
103  Any GetNativeImageSource();
104 
117  bool GetPixels( std::vector<unsigned char>& pixbuf, unsigned int& width, unsigned int& height, Pixel::Format& pixelFormat ) const;
118 
129  bool EncodeToFile(const std::string& filename) const;
130 
137  void SetNativeImageSource( Any source );
138 
139 private: // native image
140 
144  virtual bool GlExtensionCreate();
145 
149  virtual void GlExtensionDestroy();
150 
154  virtual unsigned int TargetTexture();
155 
159  virtual void PrepareTexture();
160 
164  virtual unsigned int GetWidth() const;
165 
169  virtual unsigned int GetHeight() const;
170 
174  virtual bool RequiresBlending() const;
175 
179  NativeImageInterface::Extension* GetExtension();
180 
181 private:
182 
191  DALI_INTERNAL NativeImageSource( unsigned int width, unsigned int height, ColorDepth depth, Any nativeImageSource );
192 
199  DALI_INTERNAL virtual ~NativeImageSource();
200 
208  DALI_INTERNAL NativeImageSource( const NativeImageSource& nativeImageSource );
209 
217  DALI_INTERNAL NativeImageSource& operator=(const NativeImageSource& rhs);
218 
219 private:
220 
221  Internal::Adaptor::NativeImageSource* mImpl;
222 };
223 
227 } // namespace Dali
228 
229 #endif // __DALI_NATIVE_IMAGE_SOURCE_H__
Dali Docs Home
Read more about Dali