Tizen 2.1 base
[framework/osp/uifw.git] / inc / FGrpCanvasTexture.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FGrpCanvasTexture.h
20  * @brief       This is the header file for the %CanvasTexture class.
21  *
22  * This header file contains the declarations of the %CanvasTexture class.
23  *
24  */
25
26 #ifndef _FGRP_CANVAS_TEXTURE_H_
27 #define _FGRP_CANVAS_TEXTURE_H_
28
29 #include <FBaseObject.h>
30
31 namespace Tizen { namespace Graphics {
32 class Canvas;
33 }}
34
35 namespace Tizen { namespace Graphics { namespace Opengl
36 {
37
38 /**
39  * @class       CanvasTexture
40  * @brief       This class provides a method to bind 2D Canvas and OpenGL-ES Texture.
41  *              With this feature, you can easily draw 2D primitives on OpenGL-ES Textures with consistency.
42  *
43  * @since 2.0
44  *
45  * @final       This class is not intended for extension.
46  *
47  * The %CanvasTexture class provides a canvas by which you can draw 2D primitives on OpenGL-ES texture.
48  *
49  */
50 class _OSP_EXPORT_ CanvasTexture
51         : public Tizen::Base::Object
52 {
53 public:
54         /**
55          * The object is not fully constructed after this constructor is called. For full construction, the Construct() method be called right after calling this constructor.
56          *
57          * @since 2.0
58          *
59          */
60         CanvasTexture(void);
61
62         /**
63          * This destructor overrides Tizen::Base::Object::~Object().
64          *
65          * @since 2.0
66          */
67         virtual ~CanvasTexture(void);
68
69         /**
70          * Initializes this instance of %CanvasTexture with the specified parameters.
71          *
72          * @since 2.0
73          *
74          * @return              An error code
75          * @param[in]   textureId       Texture ID which points to the texture associated with the 2D canvas. The testure ID must be generated from glGenTextures().
76          * @param[in]   width   The width of the input texture. The width must be greater than @c 0, and smaller or equal than GL_MAX_TEXTURE_SIZE.
77          * @param[in]   height  The height of the input texture. The height must be greater than @c 0, and smaller or equal than GL_MAX_TEXTURE_SIZE
78          * @exception   E_SUCCESS       Construction is successfully done.
79          * @exception   E_INVALID_ARG   Input parameter is invalid.
80          * @exception   E_UNSUPPORTED_OPERATION The target device does not support full features for %CanvasTexture.
81          * @exception   E_INVALID_STATE Getting egl information failed. It is necessary to bind egl context by using eglMakeCurrent funtion.
82          * @remarks     There is a high probability for an occurrence of an out-of-memory exception. If possible, check whether the exception is E_OUT_OF_MEMORY or not. For more information on how to handle the out-of-memory exception, refer <a href="../org.tizen.native.appprogramming/html/basics_tizen_programming/exception_check.htm">here</a>.
83          */
84         result Construct(int textureId, int width, int height);
85
86         /**
87          * Returns a 2D Canvas which is associated with the Texture of %CanvasTexture.
88          *
89          * @since 2.0
90          *
91          * @return      The 2D canvas of the %CanvasTexture, @n
92          *              else @c null if an exception occurs.
93          * @exception   E_SUCCESS       The method is successful.
94          * @exception   E_OPERATION_FAILED      Fail to construct the canvas properly, due to some reason of system.
95          */
96         Tizen::Graphics::Canvas* GetCanvasN(void) const;
97
98 private:
99         //
100         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
101         //
102         // @param[in]   rhs     The source from which this instance is copied
103         //
104         CanvasTexture(const CanvasTexture& rhs);
105
106         //
107         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
108         //
109         // @param[in]   rhs     An instance of %CanvasTexture
110         //
111         CanvasTexture& operator =(const CanvasTexture& rhs);
112
113 private:
114         friend class _CanvasTextureImpl;
115
116         class _CanvasTextureImpl* __pImpl;
117 }; // CanvasTexture
118
119 }}} // Tizen::Graphics::Opengl
120
121 #endif //_FGRP_CANVAS_TEXTURE_H_