Distinguish NativeImage from Image & Clean PixelFormat from ImageAttribute and Texture
[platform/core/uifw/dali-core.git] / dali / internal / render / gl-resources / frame-buffer-texture.h
1 #ifndef __DALI_INTERNAL_FRAME_BUFFER_TEXTURE_H__
2 #define __DALI_INTERNAL_FRAME_BUFFER_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 // EXTERNAL INCLUDES
22 #include <string>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/render/gl-resources/texture.h>
26 #include <dali/integration-api/bitmap.h>
27 #include <dali/integration-api/debug.h>
28
29 namespace Dali
30 {
31
32 namespace Internal
33 {
34
35 /**
36  * Texture class.
37  * Used as a frame buffer for RenderTask
38  */
39 class FrameBufferTexture : public Texture
40 {
41 public:
42
43   /**
44    * Creates a new texture object
45    * @param[in] width       The width (pixels)
46    * @param[in] height      The height (pixels)
47    * @param     context The GL context
48    */
49   FrameBufferTexture(unsigned int width, unsigned int height, Context& context);
50
51   /**
52    * Creates a new texture object
53    * @param[in] width       The width (pixels)
54    * @param[in] height      The height (pixels)
55    * @param[in] pixelFormat The pixel format
56    * @param     context The GL context
57    */
58   FrameBufferTexture(unsigned int width, unsigned int height, Pixel::Format pixelFormat, Context& context);
59
60   /**
61    * Destructor.
62    */
63   virtual ~FrameBufferTexture();
64
65   /**
66    * @copydoc Texture::IsFullyOpaque
67    */
68   virtual bool IsFullyOpaque() const;
69
70   /**
71    * @copydoc Texture::HasAlphaChannel
72    */
73   virtual bool HasAlphaChannel() const;
74
75   /**
76    * @copydoc Texture::Init
77    */
78   virtual bool Init();
79
80   /**
81    * Prepare FBO for rendering.
82    * @return true if the FBO is prepared and its status is GL_FRAMEBUFFER_COMPLETE, otherwise false.
83    */
84   virtual bool Prepare();
85
86 protected:
87   unsigned int mFrameBufferName;
88   unsigned int mRenderBufferName;
89   Pixel::Format mPixelFormat;
90
91   /**
92    * @copydoc Texture::CreateGlTexture
93    */
94   virtual bool CreateGlTexture();
95
96   /**
97    * @copydoc Texture::GlCleanup
98    */
99   virtual void GlCleanup();
100
101 }; // class FrameBufferTexture
102
103 }  //namespace Internal
104
105 } //namespace Dali
106 #endif //__DALI_INTERNAL_FRAME_BUFFER_TEXTURE_H__
107