Making DALi public API typesafe using guaranteed types; uint8_t, uint32_t
[platform/core/uifw/dali-core.git] / dali / public-api / images / frame-buffer-image.h
1 #ifndef __DALI_FRAME_BUFFER_IMAGE_H__
2 #define __DALI_FRAME_BUFFER_IMAGE_H__
3
4 /*
5  * Copyright (c) 2018 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/image.h>
23 #include <dali/public-api/images/native-image-interface.h>
24 #include <dali/public-api/images/pixel.h>
25
26 namespace Dali
27 {
28 /**
29  * @addtogroup dali_core_images
30  * @{
31  */
32
33 namespace Internal DALI_INTERNAL
34 {
35 class FrameBufferImage;
36 }
37
38 namespace RenderBuffer
39 {
40 /**
41  * @brief Enumeration for rendering buffer formats.
42  *
43  * The default format for framebuffer creation is COLOR, so If a depth buffer for 3D rendering is required use
44  * COLOR_DEPTH instead.
45  * @SINCE_1_0.0
46  */
47 enum Format ///< Framebuffer format, default color depth is RGBA 32 bit with alpha @SINCE_1_0.0
48 {
49   COLOR,                ///< Framebuffer will be created with color buffer. @SINCE_1_0.0
50   COLOR_DEPTH,          ///< Framebuffer will be created with color and depth buffer @SINCE_1_0.0
51   COLOR_STENCIL,        ///< Framebuffer will be created with color and stencil buffer @SINCE_1_0.0
52   COLOR_DEPTH_STENCIL   ///< Framebuffer will be created with color, depth and stencil buffer. @note May be not supported in all devices @SINCE_1_0.0
53 };
54 }
55
56 /**
57  * @DEPRECATED_1_2.41
58  *
59  * @brief FrameBufferImage represents an Open GL ES Frame Buffer Object and contains the result
60  * of an 'off screen' render pass of a RenderTask.
61  *
62  * The FrameBufferImage can then be used for rendering to the screen.
63  * @SINCE_1_0.0
64  */
65 class DALI_CORE_API FrameBufferImage : public Image
66 {
67 public:
68
69   /**
70    * @DEPRECATED_1_2.41
71    *
72    * @brief Constructor which creates an uninitialized FrameBufferImage object.
73    *
74    * Use @ref FrameBufferImage::New to create an initialized object.
75    * @SINCE_1_0.0
76    */
77   FrameBufferImage() DALI_DEPRECATED_API;
78
79   /**
80    * @DEPRECATED_1_2.41
81    *
82    * @brief Creates a new FrameBufferImage.
83    *
84    * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
85    *
86    * @SINCE_1_0.0
87    * @param[in] width The width in pixels. Setting to zero will use the width of the stage
88    * @param[in] height The height in pixels. Setting to zero will use the height of the stage
89    * @param[in] pixelFormat The pixel format (rgba 32 bit by default)
90    * @param[in] bufferFormat The format of the buffers that are going to be created for the FBO, (COLOR and DEPTH buffer as default)
91    * @return A handle to a new instance of a FrameBufferImage
92    * @post When the FrameBufferImage is first used as a render target, an exception may be thrown if pixelFormat is not supported on the hardware platform.
93    */
94   static FrameBufferImage New(uint32_t width = 0, uint32_t height = 0, Pixel::Format pixelFormat = Pixel::RGBA8888,
95                               RenderBuffer::Format bufferFormat = RenderBuffer::COLOR) DALI_DEPRECATED_API;
96
97   /**
98    * @DEPRECATED_1_2.41
99    *
100    * @brief Creates a new FrameBufferImage.
101    *
102    * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
103    * @SINCE_1_0.0
104    * @param[in] image The native image
105    *
106    * @return A handle to a new instance of a FrameBufferImage
107    * @post When the FrameBufferImage is first used as a render target, an exception may be thrown if the NativeImage cannot be mapped to a texture.
108    */
109   static FrameBufferImage New(NativeImageInterface& image) DALI_DEPRECATED_API;
110
111   /**
112    * @DEPRECATED_1_2.41
113    *
114    * @brief Downcasts a handle to FrameBufferImage handle.
115    *
116    * If handle points to a FrameBufferImage object, the
117    * downcast produces valid handle. If not, the returned handle is left uninitialized.
118    * @SINCE_1_0.0
119    * @param[in] handle Handle to an object
120    * @return Handle to a FrameBufferImage object or an uninitialized handle
121    */
122   static FrameBufferImage DownCast( BaseHandle handle ) DALI_DEPRECATED_API;
123
124   /**
125    * @DEPRECATED_1_2.41
126    *
127    * @brief Destructor.
128    *
129    * This is non-virtual since derived Handle types must not contain data or virtual methods.
130    * @SINCE_1_0.0
131    */
132   ~FrameBufferImage() DALI_DEPRECATED_API;
133
134   /**
135    * @DEPRECATED_1_2.41
136    *
137    * @brief This copy constructor is required for (smart) pointer semantics.
138    *
139    * @SINCE_1_0.0
140    * @param[in] handle A reference to the copied handle
141    */
142   FrameBufferImage(const FrameBufferImage& handle) DALI_DEPRECATED_API;
143
144   /**
145    * @DEPRECATED_1_2.41
146    *
147    * @brief This assignment operator is required for (smart) pointer semantics.
148    *
149    * @SINCE_1_0.0
150    * @param[in] rhs A reference to the copied handle
151    * @return A reference to this
152    */
153   FrameBufferImage& operator=(const FrameBufferImage& rhs) DALI_DEPRECATED_API;
154
155 public: // Not intended for application developers
156
157   explicit DALI_INTERNAL FrameBufferImage(Internal::FrameBufferImage*);
158 }; //class FrameBufferImage
159
160 /**
161  * @}
162  */
163 } // namespace Dali
164
165 #endif // __DALI_FRAME_BUFFER_IMAGE_H__