Merge "Implement CameraView." into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / camera-view / camera-view.h
1 #ifndef DALI_TOOLKIT_CAMERA_VIEW_H
2 #define DALI_TOOLKIT_CAMERA_VIEW_H
3
4 /*
5  * Copyright (c) 2021 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-toolkit/public-api/controls/control.h>
23
24 namespace Dali
25 {
26 class Any;
27
28 namespace Toolkit
29 {
30 namespace Internal DALI_INTERNAL
31 {
32 class CameraView;
33 } // namespace DALI_INTERNAL
34
35 /**
36  * @addtogroup dali_toolkit_controls_camera_view
37  * @{
38  */
39
40 /**
41  * @brief CameraView is a control for camera display.
42  *
43  * For working CameraView, a camera plugin for a platform should be provided.
44  */
45 class DALI_TOOLKIT_API CameraView : public Control
46 {
47 public:
48   /**
49    * @brief Camera display type
50    */
51   enum class DisplayType
52   {
53     WINDOW = 0, // Overlay type
54     IMAGE       // Native Image type
55   };
56
57   /**
58    * @brief Creates an initialized CameraView.
59    * @param[in] handle Multimedia camera player handle
60    * @param[in] type Where it is an overlay type or a native image type
61    * @return A handle to a newly allocated Dali ImageView
62    */
63   static CameraView New(Any handle, DisplayType type = DisplayType::WINDOW);
64
65   /**
66    * @brief Creates an uninitialized CameraView.
67    */
68   CameraView();
69
70   /**
71    * @brief Destructor.
72    *
73    * This is non-virtual since derived Handel types must not contain data or virtual methods.
74    */
75   ~CameraView();
76
77   /**
78    * @brief Copy constructor.
79    *
80    * @param[in] CameraView CameraView to copy. The copied CameraView will point at the same implementation
81    */
82   CameraView(const CameraView& CameraView);
83
84   /**
85    * @brief Move constructor
86    *
87    * @param[in] rhs A reference to the moved handle
88    */
89   CameraView(CameraView&& rhs);
90
91   /**
92    * @brief Update camera view
93    *
94    * Multimedia camera operation is work outside the view.
95    * So, This must be called when the view needs to be updated after camera operation.
96    */
97   void Update();
98
99   /**
100    * @brief Assignment operator.
101    *
102    * @param[in] CameraView The CameraView to assign from
103    * @return The updated CameraView
104    */
105   CameraView& operator=(const CameraView& CameraView);
106
107   /**
108    * @brief Move assignment
109    *
110    * @param[in] rhs A reference to the moved handle
111    * @return A reference to this
112    */
113   CameraView& operator=(CameraView&& rhs);
114
115   /**
116    * @brief Downcasts a handle to CameraView handle.
117    *
118    * If handle points to a CameraView, the downcast produces valid handle.
119    * If not, the returned handle is left uninitialized.
120    *
121    * @param[in] handle Handle to an object
122    * @return Handle to a CameraView or an uninitialized handle
123    */
124   static CameraView DownCast(BaseHandle handle);
125
126 public: // Not intended for application developers
127   /// @cond internal
128   /**
129    * @brief Creates a handle using the Toolkit::Internal implementation.
130    *
131    * @param[in] implementation The CameraView implementation
132    */
133   DALI_INTERNAL CameraView(Internal::CameraView& implementation);
134
135   /**
136    * @brief Allows the creation of this CameraView from an Internal::CustomActor pointer.
137    *
138    * @param[in] internal A pointer to the internal CustomActor
139    */
140   DALI_INTERNAL CameraView(Dali::Internal::CustomActor* internal);
141   /// @endcond
142 };
143
144 /**
145  * @}
146  */
147
148 } // namespace Toolkit
149
150 } // namespace Dali
151
152 #endif // DALI_TOOLKIT_CAMERA_VIEW_H