Distinguish NativeImage from Image & Clean PixelFormat from ImageAttribute and Texture
[platform/core/uifw/dali-core.git] / dali / internal / render / gl-resources / texture-factory.h
1 #ifndef __DALI_INTERNAL_TEXTURE_FACTORY_H__
2 #define __DALI_INTERNAL_TEXTURE_FACTORY_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/public-api/object/ref-object.h>
23 #include <dali/public-api/images/native-image-interface.h>
24 #include <dali/internal/render/gl-resources/texture-cache.h>
25
26 namespace Dali
27 {
28 class NativeImageInterface;
29
30 namespace Integration
31 {
32 class Bitmap;
33 }
34
35 namespace Internal
36 {
37 class Context;
38 class Texture;
39
40 namespace TextureFactory
41 {
42 /**
43  * Creates a new texture object from a Bitmap
44  * @param[in] bitmap The Bitmap
45  * @param[in] context The GL context
46  * @return A newly allocated texture
47  */
48 Internal::Texture* NewBitmapTexture( Integration::Bitmap* const bitmap,
49                                      Context& context,
50                                      ResourcePolicy::Discardable discardPolicy );
51
52 /**
53  * Creates a new bitmap texture object of the given dimensions.
54  * @param[in] width       The width (pixels)
55  * @param[in] height      The height (pixels)
56  * @param[in] pixelFormat The pixel format
57  * @param[in] clearPixels True if the pixel data should be cleared first
58  * @param[in] context The GL context
59  */
60 Internal::Texture* NewBitmapTexture( unsigned int      width,
61                                      unsigned int      height,
62                                      Pixel::Format     pixelFormat,
63                                      bool              clearPixels,
64                                      Context&          context,
65                                      ResourcePolicy::Discardable discardPolicy );
66
67 /**
68  * Creates a texture object from a native image (eg.: EGLImage).
69  * @param[in] nativeImage The native image to load
70  * @param[in] context The GL context
71  * @return A newly allocated texture
72  */
73 Internal::Texture* NewNativeImageTexture( NativeImageInterface& nativeImage, Context& context );
74
75 /**
76  * @copydoc FrameBufferTexture::FrameBufferTexture
77  * @return A newly allocated texture
78  */
79 Internal::Texture* NewFrameBufferTexture( unsigned int width,
80                                           unsigned int height,
81                                           Pixel::Format pixelFormat,
82                                           Context& context );
83
84 /**
85  * @copydoc FrameBufferTexture::FrameBufferTexture
86  * @return A newly allocated texture
87  */
88 Internal::Texture* NewFrameBufferTexture( NativeImageInterfacePtr nativeImage, Context& context );
89
90 };
91
92 } // namespace Internal
93
94 } // namespace Dali
95
96 #endif // __DALI_INTERNAL_TEXTURE_FACTORY_H__