1 #ifndef DALI_TOOLKIT_INTERNAL_CAMERA_VIEW_H
2 #define DALI_TOOLKIT_INTERNAL_CAMERA_VIEW_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/devel-api/adaptor-framework/camera-player.h>
23 #include <dali/public-api/object/property-notification.h>
24 #include <dali/public-api/rendering/renderer.h>
25 #include <dali/public-api/rendering/texture.h>
28 #include <dali-toolkit/public-api/controls/camera-view/camera-view.h>
29 #include <dali-toolkit/public-api/controls/control-impl.h>
39 class CameraView : public Control
44 * @param[in] type Where it is an overlay type or a native image type
46 CameraView(Dali::Toolkit::CameraView::DisplayType type);
51 virtual ~CameraView();
55 * @brief Creates an initialized CameraView.
56 * @param[in] handle Multimedia camera player handle
57 * @param[in] type Where it is an overlay type or a native image type
59 static Toolkit::CameraView New(Any handle, Dali::Toolkit::CameraView::DisplayType type);
62 * @brief Update camera player.
66 private: // From Control
68 * @copydoc Toolkit::Control::OnSceneConnection()
70 void OnSceneConnection(int depth) override;
73 * @copydoc Toolkit::Control::OnSceneDisconnection()
75 void OnSceneDisconnection() override;
79 * @brief Construct a new CameraView.
81 CameraView(const CameraView& cameraView);
83 // Undefined assignment operator.
84 CameraView& operator=(const CameraView& cameraView);
87 * @brief Updates camera display area for window rendering target
88 * @param[in] source PropertyNotification
90 void UpdateDisplayArea(Dali::PropertyNotification& source);
93 * @brief SetWindowSurfaceTarget for underlay camera preview.
95 void SetWindowSurfaceTarget();
98 * @brief SetNativeImageTarget for native image camera preview.
100 void SetNativeImageTarget();
103 * @brief CreateShader for native image target
104 * @param[in] nativeImageSourcePtr to apply custom fragment prefix
105 * @return Returns the shader for NativeImage.
107 Dali::Shader CreateShader(Dali::NativeImageSourcePtr nativeImageSourcePtr);
110 Dali::CameraPlayer mCameraPlayer;
111 Dali::Texture mNativeTexture;
113 Dali::DisplayArea mDisplayArea;
114 Dali::Renderer mOverlayRenderer;
115 Dali::Renderer mTextureRenderer;
117 Dali::PropertyNotification mPositionUpdateNotification;
118 Dali::PropertyNotification mSizeUpdateNotification;
119 Dali::PropertyNotification mScaleUpdateNotification;
121 Dali::Toolkit::CameraView::DisplayType mDisplayType;
124 } // namespace Internal
126 inline Toolkit::Internal::CameraView& GetImpl(Toolkit::CameraView& handle)
128 DALI_ASSERT_ALWAYS(handle);
129 Dali::RefObject& impl = handle.GetImplementation();
130 return static_cast<Toolkit::Internal::CameraView&>(impl);
133 inline const Toolkit::Internal::CameraView& GetImpl(const Toolkit::CameraView& handle)
135 DALI_ASSERT_ALWAYS(handle);
136 const Dali::RefObject& impl = handle.GetImplementation();
137 return static_cast<const Toolkit::Internal::CameraView&>(impl);
140 } // namespace Toolkit
144 #endif // DALI_TOOLKIT_INTERNAL_CAMERA_VIEW_H