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