2b26e9ad856915c1a7f23340a919d4ff45ddde3c
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / common / native-image-source-impl.h
1 #ifndef DALI_INTERNAL_NATIVE_IMAGE_SOURCE_IMPL_H
2 #define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_IMPL_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/adaptor-framework/native-image-source.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 namespace Adaptor
31 {
32
33 /**
34  * Dali internal NativeImageSource.
35  */
36 class NativeImageSource
37 {
38 public:
39
40   /**
41    * Create a new NativeImageSource internally.
42    * Depending on hardware the width and height may have to be a power of two.
43    * @param[in] width The width of the image.
44    * @param[in] height The height of the image.
45    * @param[in] depth color depth of the image.
46    * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty
47    * @return A smart-pointer to a newly allocated image.
48    */
49   static NativeImageSource* New(uint32_t width,
50                                 uint32_t height,
51                                 Dali::NativeImageSource::ColorDepth depth,
52                                 Any nativeImageSource);
53   /**
54    * @copydoc Dali::NativeImageSource::GetNativeImageSource()
55    */
56   virtual Any GetNativeImageSource() const = 0;
57
58   /**
59    * @copydoc Dali::NativeImageSource::GetPixels()
60    */
61   virtual bool GetPixels(std::vector<unsigned char> &pixbuf, uint32_t &width, uint32_t &height, Pixel::Format& pixelFormat ) const = 0;
62
63   /**
64    * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& )
65    */
66   virtual bool EncodeToFile(const std::string& filename) const = 0;
67
68   /**
69    * @copydoc Dali::NativeImageSource::SetSource( Any source )
70    */
71   virtual void SetSource( Any source ) = 0;
72
73   /**
74    * @copydoc Dali::NativeImageSource::IsColorDepthSupported( ColorDepth colorDepth )
75    */
76   virtual bool IsColorDepthSupported( Dali::NativeImageSource::ColorDepth colorDepth ) = 0;
77
78   /**
79    * destructor
80    */
81   virtual ~NativeImageSource() = default;
82
83   /**
84    * @copydoc Dali::NativeImageSource::GlExtensionCreate()
85    */
86   virtual bool GlExtensionCreate() = 0;
87
88   /**
89    * @copydoc Dali::NativeImageSource::GlExtensionDestroy()
90    */
91   virtual void GlExtensionDestroy() = 0;
92
93   /**
94    * @copydoc Dali::NativeImageSource::TargetTexture()
95    */
96   virtual uint32_t TargetTexture() = 0;
97
98   /**
99    * @copydoc Dali::NativeImageSource::PrepareTexture()
100    */
101   virtual void PrepareTexture() = 0;
102
103   /**
104    * @copydoc Dali::NativeImageSource::GetWidth()
105    */
106   virtual uint32_t GetWidth() const = 0;
107
108   /**
109    * @copydoc Dali::NativeImageSource::GetHeight()
110    */
111   virtual uint32_t GetHeight() const = 0;
112
113   /**
114    * @copydoc Dali::NativeImageSource::RequiresBlending()
115    */
116   virtual bool RequiresBlending() const = 0;
117
118   /**
119    * @copydoc Dali::NativeImageInterface::GetExtension()
120    */
121   virtual NativeImageInterface::Extension* GetNativeImageInterfaceExtension() = 0;
122 };
123
124 } // namespace Adaptor
125
126 } // namespace Internal
127
128 } // namespace Dali
129
130 #endif // DALI_INTERNAL_NATIVE_IMAGE_SOURCE_IMPL_H