Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / effects / inc / FUiEffects_RendererMemoryTexture2DProperty.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  * @file        FUiEffects_RendererMemoryTexture2DProperty.h
19  * @brief               This is the header file for the MemoryTexture2DProperty class
20  */
21
22 #ifndef _FUI_EFFECTS_INTERNAL_RENDERER_MEMORYTEXTURE2DPROPERTY_H_
23 #define _FUI_EFFECTS_INTERNAL_RENDERER_MEMORYTEXTURE2DPROPERTY_H_
24
25 #include <renderer/system/FUiEffects_RendererSystemSmartPtr.h>
26 #include <renderer/engine-model/FUiEffects_RendererEngineModelTexture2DProperty.h>
27 #include <renderer/system/FUiEffects_RendererSystemData.h>
28
29 namespace Tizen { namespace Ui { namespace Effects { namespace _Renderer
30 {
31
32 /**
33  * @class       MemoryTexture2DProperty
34  * @brief       This class for texture material property, constructed from bitmap located in memory. Only BGRA pixel format.
35  *
36  */
37 class MemoryTexture2DProperty
38         : public EngineModel::Texture2dProperty
39 {
40 public:
41
42         /**
43          * Constructor
44          */
45         MemoryTexture2DProperty(void);
46
47
48         /**
49          * Destructor
50          */
51         ~MemoryTexture2DProperty(void);
52
53         EngineModel::TextureProperty::InternalFormat::Value GetInternalFormat(void) const
54         {
55                 return EngineModel::TextureProperty::InternalFormat::RGBA;
56         }
57
58         EngineModel::TextureProperty::DataFormat::Value GetDataFormat(void) const
59         {
60                 return EngineModel::TextureProperty::DataFormat::RGBA;
61         }
62
63         EngineModel::TextureProperty::DataType::Value GetDataType(void) const
64         {
65                 return EngineModel::TextureProperty::DataType::UNSIGNED_BYTE;
66         }
67
68         EngineModel::TextureProperty::FilterType::Value GetMinFilter(void) const
69         {
70                 return EngineModel::TextureProperty::FilterType::LINEAR;
71         }
72
73         EngineModel::TextureProperty::FilterType::Value GetMagFilter(void) const
74         {
75                 return EngineModel::TextureProperty::FilterType::LINEAR;
76         }
77
78         EngineModel::TextureProperty::WrapType::Value GetWrapS(void) const
79         {
80                 return EngineModel::TextureProperty::WrapType::CLAMP_TO_EDGE;
81         }
82
83         EngineModel::TextureProperty::WrapType::Value GetWrapT(void) const
84         {
85                 return EngineModel::TextureProperty::WrapType::CLAMP_TO_EDGE;
86         }
87
88         EngineModel::TextureProperty::WrapType::Value GetWrapR(void) const
89         {
90                 return EngineModel::TextureProperty::WrapType::CLAMP_TO_EDGE;
91         }
92
93         size_t GetNumMipmaps(void) const
94         {
95                 return 1;
96         }
97
98         void* GetData(size_t aMipNumber)
99         {
100                 return &__data[0];
101         }
102
103         size_t GetWidth(size_t aMipNumber) const
104         {
105                 return __width;
106         }
107
108         size_t GetHeight(size_t aMipNumber) const
109         {
110                 return __height;
111         }
112
113         bool GenerateMipmaps(void) const
114         {
115                 return false;
116         }
117
118
119         /**
120          * Copies bitmap data from specified location
121          *
122          * @param [in]  ptr         Pointer to data location. BGRA format.
123          * @param [in]  width           Width in pixels
124          * @param [in]  height          Height in pixels
125          *
126          * @return              void
127          */
128         void SetData(const void* ptr, size_t width, size_t height);
129
130 private:
131
132         /**
133          * Hidden copy constructor
134          */
135         MemoryTexture2DProperty(const MemoryTexture2DProperty &rhs);
136
137
138         /**
139          * Hidden assignment operator
140          */
141         MemoryTexture2DProperty& operator =(const MemoryTexture2DProperty &rhs);
142
143
144         /**
145          * Gets count of bytes per pixel for current format
146          *
147          * @return              int             Count of bytes per pixel
148          */
149         int GetFormatSize(void);
150
151 private:
152         System::Data<System::uint8> __data;
153         size_t __width;
154         size_t __height;
155 };
156
157 typedef System::SmartPtr<MemoryTexture2DProperty> MemoryTexture2DPropertyPtr;
158
159 } } } } // Tizen::Ui::Effects::_EffectRenderer
160
161 #endif //_FUI_EFFECTS_INTERNAL_RENDERER_MEMORYTEXTURE2DPROPERTY_H_