1 #ifndef __DALI_EXTENSION_CAPTURE_H__
2 #define __DALI_EXTENSION_CAPTURE_H__
5 * Copyright (c) 2019 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 * @addtogroup CAPI_DALI_EXTENSION_FRAMEWORK_MODULE
27 #include <dali/dali.h>
43 * @brief Capture snapshots the current scene and save as a file.
45 * Applications should follow the example below to create capture :
48 * Capture capture = Capture::New();
51 * If required, you can also connect class member function to a signal :
54 * capture.FinishedSignal().Connect(this, &CaptureSceneExample::OnCaptureFinished);
57 * At the connected class member function, you can know whether capture finish state.
60 * void CaptureSceneExample::OnCaptureFinished(Capture capture)
62 * if (capture.GetFinishState() == Capture::SUCCESSED)
73 class DALI_IMPORT_API Capture : public BaseHandle
83 * @brief Typedef for signals sent by this class.
85 typedef Signal< void (Capture) > CaptureSignalType;
88 * @brief Create an uninitialized Capture; this can be initialized with Actor::New().
90 * Calling member functions with an uninitialized Dali::Object is not allowed.
95 * @brief Create an initialized Capture.
97 * @return A handle to a newly allocated Dali resource.
102 * @brief Create an initialized Capture.
104 * @param[in] mode camera projection mode.
105 * @return A handle to a newly allocated Dali resource.
107 static Capture New(Dali::Camera::ProjectionMode mode);
110 * @brief Downcast an Object handle to Capture handle.
112 * If handle points to a Capture object the downcast produces valid
113 * handle. If not the returned handle is left uninitialized.
115 * @param[in] handle to An object.
116 * @return handle to a Capture object or an uninitialized handle.
118 static Capture DownCast( BaseHandle handle );
121 * @brief Dali::Actor is intended as a base class.
123 * This is non-virtual since derived Handle types must not contain data or virtual methods.
128 * @brief This copy constructor is required for (smart) pointer semantics.
130 * @param[in] copy A reference to the copied handle.
132 Capture(const Capture& copy);
135 * @brief This assignment operator is required for (smart) pointer semantics.
137 * @param[in] rhs A reference to the copied handle.
138 * @return A reference to this.
140 Capture& operator=(const Capture& rhs);
143 * @brief Start capture and save the image as a file.
145 * @param[in] source source actor to be used for capture.
146 * @param[in] size captured size.
147 * @param[in] path image file path to be saved as a file.
148 * @param[in] clearColor background color of captured scene
150 void Start(Actor source, const Vector2& size, const std::string &path, const Vector4& clearColor = Dali::Color::TRANSPARENT );
153 * @brief Retrieve the capture finish status.
155 * @return Whether success or not.
157 FinishState GetFinishState();
160 * @brief Get finished signal.
162 * @return finished signal instance.
164 CaptureSignalType& FinishedSignal();
166 public: // Not intended for application developers
168 * @brief This constructor is used by New() methods.
170 * @param[in] internal A pointer to a newly allocated Dali resource.
172 explicit DALI_INTERNAL Capture(Internal::Capture* internal);
175 } // namespace Extension
183 #endif // __DALI_EXTENSION_CAPTURE_H__