[Tizen] Make possible to capture on the old driver devices.
[platform/core/uifw/dali-adaptor.git] / dali / public-api / capture / capture.h
old mode 100755 (executable)
new mode 100644 (file)
index 5596994..7bd6f93
@@ -2,7 +2,7 @@
 #define DALI_CAPTURE_H
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 // EXTERNAL HEADERS
 #include <dali/public-api/actors/actor.h>
-#include <dali/public-api/signals/dali-signal.h>
 #include <dali/public-api/actors/camera-actor.h>
+#include <dali/public-api/rendering/texture.h>
+#include <dali/public-api/signals/dali-signal.h>
 
-// INTERNAL HEADERS
+// INTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/native-image-source.h>
+#include <dali/public-api/dali-adaptor-common.h>
 
 namespace Dali
 {
-
 /**
  * @addtogroup dali_adaptor_framework
  * @{
@@ -39,12 +41,12 @@ namespace Adaptor
 {
 class Capture;
 }
-}
+} // namespace DALI_INTERNAL
 
 /**
  * @brief Capture snapshots the current scene and save as a file.
  *
- * @SINCE_1_3_4
+ * @SINCE_1_3.4
  *
  * Applications should follow the example below to create capture :
  *
@@ -74,11 +76,9 @@ class Capture;
  * }
  * @endcode
  */
-class DALI_IMPORT_API Capture : public BaseHandle
+class DALI_ADAPTOR_API Capture : public BaseHandle
 {
-
 public:
-
   /**
    * @brief The enumerations used for checking capture success
    * @SINCE_1_3_4
@@ -94,7 +94,7 @@ public:
    *
    * @SINCE_1_3_4
    */
-  typedef Signal< void ( Capture, Capture::FinishState ) > CaptureFinishedSignalType;
+  typedef Signal<void(Capture, Capture::FinishState)> CaptureFinishedSignalType;
 
   /**
    * @brief Create an uninitialized Capture; this can be initialized with Actor::New().
@@ -123,7 +123,7 @@ public:
    * @param[in] cameraActor An initialized CameraActor.
    * @return A handle to a newly allocated Dali resource.
    */
-  static Capture New( Dali::CameraActor cameraActor );
+  static Capture New(Dali::CameraActor cameraActor);
 
   /**
    * @brief Downcast an Object handle to Capture handle.
@@ -136,7 +136,7 @@ public:
    * @param[in] handle to An object.
    * @return handle to a Capture object or an uninitialized handle.
    */
-  static Capture DownCast( BaseHandle handle );
+  static Capture DownCast(BaseHandle handle);
 
   /**
    * @brief Dali::Actor is intended as a base class.
@@ -154,7 +154,7 @@ public:
    *
    * @param[in] copy A reference to the copied handle.
    */
-  Capture( const Capture& copy );
+  Capture(const Capture& copy);
 
   /**
    * @brief This assignment operator is required for (smart) pointer semantics.
@@ -164,7 +164,57 @@ public:
    * @param[in] rhs  A reference to the copied handle.
    * @return A reference to this.
    */
-  Capture& operator=( const Capture& rhs );
+  Capture& operator=(const Capture& rhs);
+
+  /**
+   * @brief Move constructor.
+   *
+   * @SINCE_1_9.24
+   * @param[in] rhs A reference to the moved handle
+   */
+  Capture(Capture&& rhs);
+
+  /**
+   * @brief Move assignment operator.
+   *
+   * @SINCE_1_9.24
+   * @param[in] rhs A reference to the moved handle
+   * @return A reference to this handle
+   */
+  Capture& operator=(Capture&& rhs);
+
+  /**
+   * @brief Start capture and save the image as a file.
+   *
+   * @SINCE_1_9.27
+   * @param[in] source source actor to be used for capture.
+   *            This source must be added on the window in advance.
+   * @param[in] position top-left position of area to be captured
+   *            this position is defined in the window.
+   * @param[in] size captured size.
+   * @param[in] path image file path to be saved as a file.
+   *            If path is empty string, the captured result is not be saved as a file.
+   * @param[in] clearColor background color of captured scene
+   * @note suppose that we want to capture actor 'A'. And, the actor 'A' is overlapped by another actor 'B' that is not a child of 'A'.
+   *       in this case, if source is root of scene, the captured image includes a part of actor 'B' on the 'A'.
+   *       however, if source is just actor 'A', the result includes only 'A'.
+   */
+  void Start(Actor source, const Vector2& position, const Vector2& size, const std::string& path, const Vector4& clearColor);
+
+  /**
+   * @brief Start capture and save the image as a file.
+   *
+   * @SINCE_1_9.12
+   *
+   * @param[in] source source actor to be used for capture.
+   *            This source must be added on the window in advance.
+   * @param[in] size captured size.
+   * @param[in] path image file path to be saved as a file.
+   *            If path is empty string, the captured result is not be saved as a file.
+   * @param[in] clearColor background color of captured scene
+   * @param[in] quality The value to control image quality for jpeg file format in the range [1, 100]
+   */
+  void Start(Actor source, const Vector2& size, const std::string& path, const Vector4& clearColor, const uint32_t quality);
 
   /**
    * @brief Start capture and save the image as a file.
@@ -172,11 +222,13 @@ public:
    * @SINCE_1_3_4
    *
    * @param[in] source source actor to be used for capture.
+   *            This source must be added on the window in advance.
    * @param[in] size captured size.
    * @param[in] path image file path to be saved as a file.
+   *            If path is empty string, the captured result is not be saved as a file.
    * @param[in] clearColor background color of captured scene
    */
-  void Start( Actor source, const Vector2& size, const std::string &path, const Vector4& clearColor );
+  void Start(Actor source, const Vector2& size, const std::string& path, const Vector4& clearColor);
 
   /**
    * @brief Start capture and save the image as a file.
@@ -184,11 +236,36 @@ public:
    * @SINCE_1_3_4
    *
    * @param[in] source source actor to be used for capture.
+   *            This source must be added on the window in advance.
    * @param[in] size captured size.
    * @param[in] path image file path to be saved as a file.
+   *            If path is empty string, the captured result is not be saved as a file.
    * @note Clear color is transparent.
    */
-  void Start( Actor source, const Vector2& size, const std::string &path );
+  void Start(Actor source, const Vector2& size, const std::string& path);
+
+  /**
+   * @brief Set result image quality in case of jpeg
+   *
+   * @param[in] quality The value to control image quality for jpeg file format in the range [1, 100]
+   */
+  void SetImageQuality(uint32_t quality);
+
+  /**
+   * @brief Get NativeImageSourcePtr that is saved captured image.
+   *
+   * @SINCE_1_9.10
+   *
+   * @return NativeImageSourcePtr Captured result that can be rendered with DALi
+   */
+  Dali::NativeImageSourcePtr GetNativeImageSource() const;
+
+  /**
+   * @brief Get Texture of captured image.
+   *
+   * @return Texture Captured result
+   */
+  Dali::Texture GetTexture();
 
   /**
    * @brief Get finished signal.
@@ -208,7 +285,7 @@ public: // Not intended for application developers
    *
    * @param[in] internal A pointer to a newly allocated Dali resource.
    */
-  explicit DALI_INTERNAL Capture( Internal::Adaptor::Capture* internal );
+  explicit DALI_INTERNAL Capture(Internal::Adaptor::Capture* internal);
   /// @endcond
 };