[dali_2.3.28] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / controls / scene-view / scene-view.h
index 1f4ec52..79e9751 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_SCENE3D_SCENE_VIEW_H
 
 /*
 #define DALI_SCENE3D_SCENE_VIEW_H
 
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control.h>
 
 // EXTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/image-loader/image-url.h>
 #include <dali/public-api/actors/camera-actor.h>
 #include <dali/public-api/common/dali-common.h>
 
 #include <dali/public-api/actors/camera-actor.h>
 #include <dali/public-api/common/dali-common.h>
 
@@ -86,6 +87,8 @@ class SceneView;
  *
  * And since SceneView is a Control, it can be placed together with other 2D UI components in the DALi window.
  *
  *
  * And since SceneView is a Control, it can be placed together with other 2D UI components in the DALi window.
  *
+ * @note We support to render model well only if glsl version is higher than 300.
+ *
  * @SINCE_2_1.38
  * @code
  *
  * @SINCE_2_1.38
  * @code
  *
@@ -105,6 +108,74 @@ class DALI_SCENE3D_API SceneView : public Dali::Toolkit::Control
 {
 public:
   /**
 {
 public:
   /**
+   * @brief The start and end property ranges for this control.
+   * @SINCE_2_3.1
+   */
+  enum PropertyRange
+  {
+    PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
+    PROPERTY_END_INDEX   = PROPERTY_START_INDEX + 1000
+  };
+
+  struct Property
+  {
+    enum
+    {
+      /**
+       * @brief URL of a masking image
+       * @details Name "alphaMaskUrl", type Property::STRING, URL of image to apply as
+       * a mask after SceneView is drawn.
+       * @note Alpha masking is only available when framebuffer is used.
+       * @note Optional.
+       */
+      ALPHA_MASK_URL = PROPERTY_START_INDEX,
+
+      /**
+       * @brief The scale factor to apply to the content image before masking
+       * @details Name "maskContentScale", type Property::FLOAT, The scale factor
+       * to apply to the content before masking. Note, scaled result is cropped to
+       * the same size as the alpha mask.
+       * @note Optional.
+       */
+      MASK_CONTENT_SCALE,
+
+      /**
+       * @brief Whether to crop rendered result to mask or scale mask to fit result
+       * @details Name "cropToMask", type Property::BOOLEAN, True if the rendered result should
+       * be cropped to match the mask size, or false if the result should remain the same size.
+       * @note Optional, Default true
+       * @note If this is false, then the mask is scaled to fit the rendered result before being applied.
+       */
+      CROP_TO_MASK,
+    };
+  };
+
+  /**
+   * @brief The enumerations used for checking capture success
+   * @SINCE_2_3.25
+   */
+  enum class CaptureFinishState
+  {
+    SUCCEEDED, ///< Succeeded to capture
+    FAILED     ///< Failed to capture by time out
+  };
+
+public:
+  struct CaptureResult
+  {
+    int32_t                 captureId;
+    Dali::Toolkit::ImageUrl imageUrl;
+    CaptureFinishState      state;
+  };
+
+  /**
+   * @brief Typedef for capture finished signals sent by this class.
+   *
+   * @SINCE_2_3.25
+   */
+  typedef Signal<void(SceneView, CaptureResult&)> CaptureFinishedSignalType;
+
+  /**
    * @brief Create an initialized SceneView.
    *
    * @SINCE_2_1.38
    * @brief Create an initialized SceneView.
    *
    * @SINCE_2_1.38
@@ -325,6 +396,42 @@ public:
   bool IsUsingFramebuffer() const;
 
   /**
   bool IsUsingFramebuffer() const;
 
   /**
+   * @brief Sets SceneView's resolution manually.
+   * @note This manual resolution is only available when the SceneView uses FBO for rendering by using UseFrameBuffer(true).
+   * @note If the aspect ratio of input width/height is different with SceneView's aspect ratio, the rendered result is stretched to fill SceneView's area.
+   *
+   * @SINCE_2_3.2
+   * @param[in] width The input width.
+   * @param[in] height The input height.
+   */
+  void SetResolution(uint32_t width, uint32_t height);
+
+  /**
+   * @brief Retrieves width of resolution of the SceneView.
+   * @note If the SceneView not uses FBO, this method returns SceneView's width.
+   *
+   * @SINCE_2_3.2
+   * @return Width value of resolution of the SceneView.
+   */
+  uint32_t GetResolutionWidth();
+
+  /**
+   * @brief Retrieves height of resolution of the SceneView.
+   * @note If the SceneView not uses FBO, this method returns SceneView's height.
+   *
+   * @SINCE_2_3.2
+   * @return Height value of resolution of the SceneView.
+   */
+  uint32_t GetResolutionHeight();
+
+  /**
+   * @brief Resets SceneView's resolution to the current size of SceneView.
+   *
+   * @SINCE_2_3.2
+   */
+  void ResetResolution();
+
+  /**
    * @brief Sets Multisampling level when we use Framebuffer.
    * Default is 0.
    *
    * @brief Sets Multisampling level when we use Framebuffer.
    * Default is 0.
    *
@@ -402,6 +509,26 @@ public:
    */
   Quaternion GetSkyboxOrientation() const;
 
    */
   Quaternion GetSkyboxOrientation() const;
 
+  /**
+   * @brief Requests to capture this SceneView with the Camera.
+   *
+   * @SINCE_2_3.25
+   * @param[in] camera CameraActor to be used for capture.
+   * @param[in] size captured size.
+   * @note The camera is required to be added in this SceneView. (Not need to be a selected camera)
+   * @note If the SceneView is disconnected from Scene, the left capture requests are canceled.
+   * @return capture id that id unique value to distinguish each requiest.
+   */
+  int32_t Capture(Dali::CameraActor camera, const Vector2& size);
+
+  /**
+   * @brief Get capture finished signal.
+   *
+   * @SINCE_2_3.25
+   * @return finished signal instance.
+   */
+  CaptureFinishedSignalType& CaptureFinishedSignal();
+
 public: // Not intended for application developers
   /// @cond internal
   /**
 public: // Not intended for application developers
   /// @cond internal
   /**