CanvasRenderer: Add Drawable::SetClipPath() Api
[platform/core/uifw/dali-adaptor.git] / dali / internal / canvas-renderer / common / drawable-impl.h
index b6f404b..d9fd55e 100644 (file)
@@ -19,9 +19,6 @@
  */
 
 // EXTERNAL INCLUDES
-#ifdef THORVG_SUPPORT
-#include <thorvg.h>
-#endif
 #include <dali/public-api/object/base-object.h>
 
 // INTERNAL INCLUDES
@@ -41,6 +38,28 @@ class Drawable : public Dali::BaseObject
 {
 public:
   /**
+   * @brief Enumeration for type of drawable.
+   */
+  enum class Types
+  {
+    NONE = 0,      ///< Means that type is not defined.
+    SHAPE,         ///< Meaning of Shape class that inherits Drawable.
+    DRAWABLE_GROUP ///< Meaning of DrawableGorup class that inherits Drawable.
+  };
+
+  /**
+   * @brief Enumeration indicating type used in the composition of two objects - the target and the source.
+   */
+  enum class CompositionType
+  {
+    NONE = 0,          ///< Means that type is not defined.
+    CLIP_PATH,         ///< The intersection of the source and the target is determined and only the resulting pixels from the source are rendered.
+    ALPHA_MASK,        ///< The pixels of the source and the target are alpha blended. As a result, only the part of the source, which intersects with the target is visible.
+    ALPHA_MASK_INVERSE ///< The pixels of the source and the complement to the target's pixels are alpha blended. As a result, only the part of the source which is not covered by the target is visible.
+  };
+
+public:
+  /**
    * @brief Constructor
    */
   Drawable();
@@ -56,32 +75,32 @@ public:
   void Create();
 
   /**
-   * @copydoc Dali::CanvasRenderer::Drawable::SetOpacity
+   * @copydoc Dali::CanvasRenderer::Drawable::SetOpacity()
    */
   virtual bool SetOpacity(float opacity);
 
   /**
-   * @copydoc Dali::CanvasRenderer::Drawable::GetOpacity
+   * @copydoc Dali::CanvasRenderer::Drawable::GetOpacity()
    */
   virtual float GetOpacity() const;
 
   /**
-   * @copydoc Dali::CanvasRenderer::Drawable::Rotate
+   * @copydoc Dali::CanvasRenderer::Drawable::Rotate()
    */
   virtual bool Rotate(Degree degree);
 
   /**
-   * @copydoc Dali::CanvasRenderer::Drawable::Scale
+   * @copydoc Dali::CanvasRenderer::Drawable::Scale()
    */
   virtual bool Scale(float factor);
 
   /**
-   * @copydoc Dali::CanvasRenderer::Drawable::Translate
+   * @copydoc Dali::CanvasRenderer::Drawable::Translate()
    */
   virtual bool Translate(Vector2 translate);
 
   /**
-   * @copydoc Dali::CanvasRenderer::Drawable::Transform
+   * @copydoc Dali::CanvasRenderer::Drawable::Transform()
    */
   virtual bool Transform(const Dali::Matrix3& matrix);
 
@@ -91,10 +110,33 @@ public:
   virtual Rect<float> GetBoundingBox() const;
 
   /**
-   * @brief Set whether drawable added to the other object(canvas or drawable) or not.
+   * @copydoc Dali::CanvasRenderer::Drawable::SetClipPath()
+   */
+  virtual bool SetClipPath(Dali::CanvasRenderer::Drawable& clip);
+
+  /**
+   * @brief Returns a composition drawble object.
+   * @return Returns a composition drawble object.
+   */
+  virtual Dali::CanvasRenderer::Drawable GetCompositionDrawable() const;
+
+  /**
+   * @brief Returns a composition type
+   * @return Returns a composition type
+   */
+  virtual CompositionType GetCompositionType() const;
+
+  /**
+   * @brief Set whether this drawable object was added to other object(CanvasRenderer or DrawableGroup) or not.
    * @param[in] added Ture if added, false otherwise.
    */
-  virtual void SetDrawableAdded(bool added);
+  virtual void SetAdded(bool added);
+
+  /**
+   * @brief Returns whether this drawable object was added to another object(CanvasRenderer or DrawableGroup).
+   * @return Returns Ture if added, false otherwise.
+   */
+  virtual bool IsAdded() const;
 
   /**
    * @brief Returns a drawable object pointer.
@@ -121,6 +163,18 @@ public:
   virtual bool GetChanged() const;
 
   /**
+   * @brief Set drawable's type.
+   * @param[in] type Type of drawable.
+   */
+  virtual void SetType(Types type);
+
+  /**
+   * @brief Get drawable's type.
+   * @return Returns type of drawable.
+   */
+  virtual Types GetType() const;
+
+  /**
    * @brief Returns a drawable's implements object pointer.
    * @return Returns a drawable's implements object pointer.
    */
@@ -132,7 +186,7 @@ public:
   Drawable& operator=(Drawable&&) = delete;
 
 private:
-  Dali::Internal::Adaptor::Drawable* pImpl = nullptr;
+  Dali::Internal::Adaptor::Drawable* mImpl = nullptr;
 };
 
 } // namespace Adaptor