Remove RenderableActor
[platform/core/uifw/dali-core.git] / dali / public-api / actors / image-actor.h
index 764fe3e..136cb8a 100644 (file)
 #include <string>
 
 // INTERNAL INCLUDES
-#include <dali/public-api/actors/renderable-actor.h>
+#include <dali/public-api/actors/actor.h>
 #include <dali/public-api/math/rect.h>
 #include <dali/public-api/images/image.h>
+#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/public-api/actors/blending.h>
+#include <dali/public-api/actors/sampling.h>
 
 namespace Dali
 {
@@ -39,7 +42,7 @@ class ImageActor;
  *
  * Allows the developer to add an actor to stage which displays the content of an Image object.
  *
- * By default CullFaceMode is set to CullNone to enable the ImageActor to be viewed from all angles.
+ * By default ImageActor can be viewed from all angles.
  *
  * If an ImageActor is created without setting size, then the actor takes the size of the image -
  * this is the natural size.
@@ -56,7 +59,7 @@ class ImageActor;
  * Clearing the pixel area on an Image actor with a set size will cause the actor to show the
  * whole image again, but will not change the image size.
  */
-class DALI_IMPORT_API ImageActor : public RenderableActor
+class DALI_IMPORT_API ImageActor : public Actor
 {
 public:
 
@@ -150,6 +153,8 @@ public:
    */
   typedef Rect<int> PixelArea;
 
+  static const BlendingMode::Type DEFAULT_BLENDING_MODE; ///< default value is BlendingMode::AUTO
+
   /**
    * @brief Create an uninitialized ImageActor handle.
    *
@@ -267,23 +272,6 @@ public:
   PixelArea GetPixelArea() const;
 
   /**
-   * @brief Query whether a pixel area has been set.
-   *
-   * @pre image must be initialized.
-   * @return True if a pixel area has been set.
-   */
-  bool IsPixelAreaSet() const;
-
-  /**
-   * @brief Remove any pixel areas specified with SetPixelArea; the entire image will be displayed.
-   *
-   * The actor size will change to that of the Image unless a custom size was set, e.g. via
-   * Actor::SetSize().
-   * @pre image must be initialized.
-   */
-  void ClearPixelArea();
-
-  /**
    * @brief Set how the image is rendered; the default is STYLE_QUAD.
    *
    * @pre image must be initialized.
@@ -315,11 +303,212 @@ public:
    */
   Vector4 GetNinePatchBorder() const;
 
+
+  /**
+   * @brief Allows modification of an actors position in the depth sort algorithm.
+   *
+   * The offset can be altered for each coplanar actor hence allowing an order of painting.
+   * @pre The Actor has been initialized.
+   * @param [in] depthOffset the offset to be given to the actor. Positive values pushing it further back.
+   */
+  void SetSortModifier(float depthOffset);
+
+  /**
+   * @brief Retrieves the offset used to modify an actors position in the depth sort algorithm.
+   *
+   * The offset can be altered for each coplanar actor hence allowing an order of painting.
+   * @pre The Actor has been initialized.
+   * @return  the offset that has been given to the actor. Positive values pushing it further back.
+   */
+  float GetSortModifier() const;
+
+  /**
+   * @brief Sets the blending mode.
+   *
+   * Possible values are: BlendingMode::OFF, BlendingMode::AUTO and BlendingMode::ON. Default is BlendingMode::AUTO.
+   *
+   * If blending is disabled (BlendingMode::OFF) fade in and fade out animations do not work.
+   *
+   * <ul>
+   *   <li> \e OFF Blending is disabled.
+   *   <li> \e AUTO Blending is enabled only if the renderable actor has alpha channel.
+   *   <li> \e ON Blending is enabled.
+   * </ul>
+   *
+   * @param[in] mode The blending mode.
+   */
+  void SetBlendMode( BlendingMode::Type mode );
+
+  /**
+   * @brief Retrieves the blending mode.
+   *
+   * @return The blending mode, one of BlendingMode::OFF, BlendingMode::AUTO or BlendingMode::ON.
+   */
+  BlendingMode::Type GetBlendMode() const;
+
+  /**
+   * @brief Specify the pixel arithmetic used when the actor is blended.
+   *
+   * @param[in] srcFactorRgba Specifies how the red, green, blue, and alpha source blending factors are computed.
+   * The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR,
+   * SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR,
+   * GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, and GL_SRC_ALPHA_SATURATE.
+   *
+   * @param[in] destFactorRgba Specifies how the red, green, blue, and alpha destination blending factors are computed.
+   * The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR,
+   * SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR,
+   * GL_CONSTANT_ALPHA, and GL_ONE_MINUS_CONSTANT_ALPHA.
+   */
+  void SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba );
+
+  /**
+   * @brief Specify the pixel arithmetic used when the actor is blended.
+   *
+   * @param[in] srcFactorRgb Specifies how the red, green, and blue source blending factors are computed.
+   * The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR,
+   * SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR,
+   * GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, and GL_SRC_ALPHA_SATURATE.
+   *
+   * @param[in] destFactorRgb Specifies how the red, green, blue, and alpha destination blending factors are computed.
+   * The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR,
+   * SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR,
+   * GL_CONSTANT_ALPHA, and GL_ONE_MINUS_CONSTANT_ALPHA.
+   *
+   * @param[in] srcFactorAlpha Specifies how the alpha source blending factor is computed.
+   * The options are the same as for srcFactorRgb.
+   *
+   * @param[in] destFactorAlpha Specifies how the alpha source blending factor is computed.
+   * The options are the same as for destFactorRgb.
+   */
+  void SetBlendFunc( BlendingFactor::Type srcFactorRgb,   BlendingFactor::Type destFactorRgb,
+                     BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha );
+
+  /**
+   * @brief Query the pixel arithmetic used when the actor is blended.
+   *
+   * @param[out] srcFactorRgb Specifies how the red, green, blue, and alpha source blending factors are computed.
+   * @param[out] destFactorRgb Specifies how the red, green, blue, and alpha destination blending factors are computed.
+   * @param[out] srcFactorAlpha Specifies how the red, green, blue, and alpha source blending factors are computed.
+   * @param[out] destFactorAlpha Specifies how the red, green, blue, and alpha destination blending factors are computed.
+   */
+  void GetBlendFunc( BlendingFactor::Type& srcFactorRgb,   BlendingFactor::Type& destFactorRgb,
+                     BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const;
+
+  /**
+   * @brief Specify the equation used when the actor is blended.
+   *
+   * The options are BlendingEquation::ADD, SUBTRACT, or REVERSE_SUBTRACT.
+   * @param[in] equationRgba The equation used for combining red, green, blue, and alpha components.
+   */
+  void SetBlendEquation( BlendingEquation::Type equationRgba );
+
+  /**
+   * @brief Specify the equation used when the actor is blended.
+   *
+   * @param[in] equationRgb The equation used for combining red, green, and blue components.
+   * @param[in] equationAlpha The equation used for combining the alpha component.
+   * The options are BlendingEquation::ADD, SUBTRACT, or REVERSE_SUBTRACT.
+   */
+  void SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha );
+
+  /**
+   * @brief Query the equation used when the actor is blended.
+   *
+   * @param[out] equationRgb The equation used for combining red, green, and blue components.
+   * @param[out] equationAlpha The equation used for combining the alpha component.
+   */
+  void GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const;
+
+  /**
+   * @brief Specify the color used when the actor is blended; the default is Vector4::ZERO.
+   *
+   * @param[in] color The blend color.
+   */
+  void SetBlendColor( const Vector4& color );
+
+  /**
+   * @brief Query the color used when the actor is blended.
+   *
+   * @return The blend color.
+   */
+  const Vector4& GetBlendColor() const;
+
+  /**
+   * @brief Sets the filtering mode.
+   *
+   * Possible values are: FilterMode::NEAREST and FilterMode::LINEAR. Default is FilterMode::LINEAR.
+   *
+   * <ul>
+   *   <li> \e NEAREST Use nearest filtering
+   *   <li> \e LINEAR Use linear filtering
+   * </ul>
+   *
+   * @param[in] minFilter The minification filtering mode.
+   * @param[in] magFilter The magnification filtering mode.
+   */
+  void SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter );
+
+  /**
+   * @brief Retrieves the filtering mode.
+   *
+   * @param[out] minFilter The return minification value
+   * @param[out] magFilter The return magnification value
+   */
+  void GetFilterMode( FilterMode::Type& minFilter, FilterMode::Type& magFilter) const;
+
+  /**
+   * @brief Sets the shader effect for the RenderableActor.
+   *
+   * Shader effects provide special effects like ripple and bend.
+   * Setting a shader effect removes any shader effect previously set by SetShaderEffect.
+   * @pre The actor has been initialized.
+   * @pre effect has been initialized.
+   * @param [in] effect The shader effect.
+   */
+  void SetShaderEffect( ShaderEffect effect );
+
+  /**
+   * @brief Retrieve the custom shader effect for the RenderableActor.
+   * If default shader is used an empty handle is returned.
+   *
+   * @pre The Actor has been initialized.
+   * @return The shader effect
+   */
+  ShaderEffect GetShaderEffect() const;
+
+  /**
+   * @brief Removes the current shader effect.
+   *
+   * @pre The Actor has been initialized.
+   */
+  void RemoveShaderEffect();
+
+
 public: // Not intended for application developers
 
   explicit DALI_INTERNAL ImageActor(Internal::ImageActor*);
 };
 
+
+/**
+ * @brief Sets the shader effect for all ImageActors in a tree of Actors.
+ *
+ * @see ImageActor::SetShaderEffect
+ *
+ * @param [in] actor root of a tree of actors.
+ * @param [in] effect The shader effect.
+ */
+DALI_IMPORT_API void SetShaderEffectRecursively( Actor actor, ShaderEffect effect );
+
+/**
+ * @brief Removes the shader effect from all ImageActors in a tree of Actors.
+ *
+ * @see ImageActor::RemoveShaderEffect
+ *
+ * @param [in] actor root of a tree of actors.
+ */
+DALI_IMPORT_API void RemoveShaderEffectRecursively( Actor actor );
+
 } // namespace Dali
 
 #endif // __DALI_IMAGE_ACTOR_H__