1 #ifndef DALI_NATIVE_IMAGE_SURFACE_H
2 #define DALI_NATIVE_IMAGE_SURFACE_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/any.h>
25 #include <dali/devel-api/adaptor-framework/native-image-source-queue.h>
26 #include <dali/public-api/dali-adaptor-common.h>
34 class NativeImageSurface;
36 } // namespace Internal
38 class NativeImageSurface;
41 * @brief Pointer to Dali::NativeImageSurface.
43 typedef Dali::IntrusivePtr<Dali::NativeImageSurface> NativeImageSurfacePtr;
46 * Native image surface is a surface that GL can render.
47 * The surface is not a window, it's like a pixmap.
49 class DALI_ADAPTOR_API NativeImageSurface : public RefObject
53 * Creates a NativeImageSurface
55 * @param [in] queue the native image source queue handle
56 * @return A smart-pointer to a newly allocated native image surface
58 static NativeImageSurfacePtr New(Dali::NativeImageSourceQueuePtr queue);
61 * @brief Gets the native renderable handle
62 * @return The native renderable handle
64 Any GetNativeRenderable();
67 * @brief Initializes the graphics resources
69 void InitializeGraphics();
72 * @brief Terminate the graphics resources
74 void TerminateGraphics();
77 * @brief Invoked by render thread before rendering
82 * @brief Invoked by render thread after rendering
87 * @brief Checks to render
92 * @brief Sets Graphics configuration to the surface
94 * @param[in] depth the flag of depth buffer. If true is set, 24bit depth buffer is enabled.
95 * @param[in] stencil the flag of stencil. it true is set, 8bit stencil buffer is enabled.
96 * @param[in] msaa the bit of msaa.
97 * @param[in] version the GLES version.
98 * @return True if the config exists, false otherwise.
100 bool SetGraphicsConfig(bool depth, bool stencil, int msaa, int version);
105 * @brief Private constructor.
106 * @param[in] queue the native image source queue handle
108 DALI_INTERNAL NativeImageSurface(Dali::NativeImageSourceQueuePtr queue);
111 * @brief A reference counted object may only be deleted by calling Unreference().
113 DALI_INTERNAL ~NativeImageSurface() override;
116 * @brief Undefined copy constructor.
118 * This avoids accidental calls to a default copy constructor.
119 * @param[in] nativeImageSurface A reference to the object to copy
121 DALI_INTERNAL NativeImageSurface(const NativeImageSurface& nativeImageSurface);
124 * @brief Undefined assignment operator.
126 * This avoids accidental calls to a default assignment operator.
127 * @param[in] rhs A reference to the object to copy
129 DALI_INTERNAL NativeImageSurface& operator=(const NativeImageSurface& rhs);
133 std::unique_ptr<Internal::Adaptor::NativeImageSurface> mImpl; ///< Implementation pointer
138 #endif // DALI_NATIVE_IMAGE_SURFACE_H