License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-core.git] / dali / internal / render / gl-resources / native-texture.h
1 #ifndef __DALI_INTERNAL_NATIVE_TEXTURE_H__
2 #define __DALI_INTERNAL_NATIVE_TEXTURE_H__
3
4 /*
5  * Copyright (c) 2014 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 // INTERNAL INCLUDES
22 #include <dali/public-api/images/native-image.h>
23 #include <dali/internal/render/gl-resources/texture.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 class Texture;
32
33 /**
34  *
35  * Native texture class.
36  * Used for handing already loaded image data to Dali.
37  *
38  */
39 class NativeTexture : public Texture
40 {
41 public:
42   /**
43    * Constructor.
44    * @pre nativeImg has to be initialized. (GLTexture is already created)
45    * @param nativeImg         the NativeImage to be used
46    * @param context           the GL context
47    */
48   NativeTexture(NativeImage* nativeImg, Context& context);
49
50   /**
51    * Destructor.
52    */
53   virtual ~NativeTexture();
54
55   /**
56    * @copydoc Texture::Bind
57    */
58   virtual bool Bind(GLenum target, GLenum textureunit = GL_TEXTURE0);
59
60   /**
61    * @copydoc Texture::IsFullyOpaque
62    */
63   virtual bool IsFullyOpaque() const;
64
65   /**
66    * @copydoc Texture::HasAlphaChannel
67    */
68   virtual bool HasAlphaChannel() const;
69
70
71   /**
72    * @copydoc Texture::GetPixelFormat
73    */
74   virtual Pixel::Format GetPixelFormat() const;
75
76   /**
77    * @copydoc Texture::Init
78    */
79   virtual bool Init();
80
81 protected:
82   /**
83    * @copydoc Texture::CreateGlTexture
84    */
85   virtual bool CreateGlTexture();
86
87   /**
88    * @copydoc Texture::GlCleanup
89    */
90   virtual void GlCleanup();
91
92
93 private:
94
95   NativeImagePtr mNativeImage; ///< reference to NativeImage the Texture was created from
96 };
97
98 }  //namespace Internal
99
100 }  //namespace Dali
101
102 #endif //__DALI_INTERNAL_NATIVE_TEXTURE_H__