Merge "Support animation of Visual transform properties" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / visuals / visual-properties.h
index cab8986..6f19efc 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_VISUAL_PROPERTIES_H
 
 /*
- * Copyright (c) 2016 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.
 
 namespace Dali
 {
-
 namespace Toolkit
 {
+/**
+ * @addtogroup dali_toolkit_visuals
+ * @{
+ */
 
+/**
+ * @brief All the visual types.
+ * @SINCE_1_1.45
+ */
 namespace Visual
 {
-
 /**
  * @brief All the visual types.
  * @SINCE_1_1.45
  */
 enum Type
 {
-  BORDER, ///< Renders a solid color as an internal border to the control's quad. @SINCE_1_1.45
-  COLOR, ///< Renders a solid color to the control's quad. @SINCE_1_1.45
-  GRADIENT, ///< Renders a smooth transition of colors to the control's quad. @SINCE_1_1.45
-  IMAGE, ///< Renders an image into the control's quad. @SINCE_1_1.45
-  MESH, ///< Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file. @SINCE_1_1.45
-  PRIMITIVE, ///< Renders a simple 3D shape, such as a cube or sphere. @SINCE_1_1.45
-  WIREFRAME, ///< Renders a simple wire-frame outlining a quad. @SINCE_1_2.2
+  BORDER,         ///< Renders a solid color as an internal border to the control's quad. @SINCE_1_1.45
+  COLOR,          ///< Renders a solid color to the control's quad. @SINCE_1_1.45
+  GRADIENT,       ///< Renders a smooth transition of colors to the control's quad. @SINCE_1_1.45
+  IMAGE,          ///< Renders an image into the control's quad. @SINCE_1_1.45
+  MESH,           ///< Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file. @SINCE_1_1.45
+  PRIMITIVE,      ///< Renders a simple 3D shape, such as a cube or sphere. @SINCE_1_1.45
+  WIREFRAME,      ///< Renders a simple wire-frame outlining a quad. @SINCE_1_2_2
+  TEXT,           ///< Renders text @SINCE_1_2.60
+  N_PATCH,        ///< Renders an n-patch image. @SINCE_1_2.60
+  SVG,            ///< Renders an SVG image. @SINCE_1_2.60
+  ANIMATED_IMAGE, ///< Renders a animated image. @SINCE_1_2.60
 };
 
+/**
+ * @brief Visual Property.
+ * @SINCE_1_1.45
+ */
 namespace Property
 {
-
+/**
+ * @brief Enumeration for the instance of properties belonging to the Visual Property.
+ * @SINCE_1_1.45
+ */
 enum
 {
   /**
    * @brief The index for the visual type.
-   * @details Name "visualType", type [Type](@ref Dali::Toolkit::Visual::Type) (Property::INTEGER) or Property::STRING.
+   * @details Name "visualType", type [Type](Dali::Toolkit::Visual::Type) (Property::INTEGER) or Property::STRING.
    * @SINCE_1_1.45
    * @note Mandatory.
    * @see Type
@@ -61,28 +78,195 @@ enum
 
   /**
    * @brief The shader to use in the visual.
-   * @details Name "shader", type Property::Map.
+   * @details Name "shader", type Property::MAP.
    * @SINCE_1_1.45
    * @note Optional.
    * @note Will override the existing shaders.
    * @see Shader::Property
    */
   SHADER,
+
+  /**
+   * @brief The transform used by the visual.
+   * @details Name "transform", type Property::MAP.
+   * @SINCE_1_2.60
+   * @note Optional.
+   * @see Toolkit::Visual::Transform::Property
+   */
+  TRANSFORM,
+
+  /**
+   * @brief Enables/disables premultiplied alpha.
+   * @details Name "premultipliedAlpha", type Property::BOOLEAN.
+   * @SINCE_1_2.60
+   * @note Optional.
+   * @note The premultiplied alpha is false by default unless this behaviour is modified
+   * by the derived Visual type.
+   */
+  PREMULTIPLIED_ALPHA,
+
+  /**
+   * @brief Mix color is a blend color for any visual.
+   * @details Name "mixColor", type Property::VECTOR3 or Property::VECTOR4, animatable
+   * @SINCE_1_2.60
+   * @note Optional
+   * @note To animate an opacity, OPACITY property should be used.
+   */
+  MIX_COLOR,
+
+  /**
+   * @brief Opacity is the alpha component of the mixColor, above.
+   * @details Name "opacity", type Property::FLOAT, animatable
+   * @SINCE_1_2.60
+   * @note Optional
+   */
+  OPACITY,
 };
 
 } // namespace Property
 
-namespace Shader
+/**
+ * @brief Visual Transform for the offset or size.
+ * @SINCE_1_2.60
+ */
+namespace Transform
 {
+/**
+ * @brief Policies used by the transform for the offset or size.
+ * @SINCE_1_2.60
+ */
+namespace Policy
+{
+/**
+ * @brief Enumeration for the type of Transform Policy.
+ * @SINCE_1_2.60
+ */
+enum Type
+{
+  RELATIVE = 0, ///< Relative to the control (percentage [0.0f to 1.0f] of the control). @SINCE_1_2.60
+  ABSOLUTE = 1  ///< Absolute value in world units. @SINCE_1_2.60
+};
+
+} // namespace Policy
 
+/**
+ * @brief Visual Transform Property.
+ * @SINCE_1_2.60
+ */
 namespace Property
 {
+/**
+ * @brief Enumeration for the type of Transform Property.
+ * @SINCE_1_2.60
+ */
+enum Type
+{
+  /**
+   * @brief Offset of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
+   * @details Name "offset", type Property::VECTOR2, animatable.
+   * @SINCE_1_2.60
+   *
+   * @see OFFSET_POLICY
+   */
+  OFFSET,
+
+  /**
+   * @brief Size of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units).
+   * @details Name "size", type Property::VECTOR2, animatable.
+   * @see SIZE_POLICY
+   */
+  SIZE,
+
+  /**
+   * @brief The origin of the visual within its control area.
+   * @details Name "origin", type Align::Type (Property::INTEGER) or Property::STRING.
+   * @see Toolkit::Align
+   * @SINCE_1_2.60
+   * @note The default is Align::TOP_BEGIN.
+   */
+  ORIGIN,
+
+  /**
+   * @brief The anchor-point of the visual
+   * @details Name "anchorPoint", type Align::Type (Property::INTEGER) or Property::STRING.
+   * @see Toolkit::Align
+   * @SINCE_1_2.60
+   * @note The default is Align::TOP_BEGIN.
+   */
+  ANCHOR_POINT,
+
+  /**
+   * @brief Whether the x or y OFFSET values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
+   * @details Name "offsetPolicy", type Vector2 or Property::ARRAY of Property::STRING.
+   *          If Property::ARRAY then 2 strings expected for the x and y.
+   *
+   * C++:
+   * @code
+   * control.SetProperty( ..., // Some visual based property
+   *                      Property::Map().Add( ... ) // Properties to set up visual
+   *                                     .Add( Visual::Property::TRANSFORM,
+   *                                           Property::Array().Add( Toolkit::Visual::Transform::Property::OFFSET_POLICY, Vector2( Policy::ABSOLUTE, Policy::RELATIVE ) ) )
+   *                                                            .Add( Toolkit::Visual::Transform::Property::OFFSET, Vector2( 10, 1.0f ) ) );
+   * @endcode
+   *
+   * JSON:
+   * @code
+   * {
+   *   ...
+   *   "transition":
+   *   {
+   *     "offsetPolicy" : [ "ABSOLUTE", "RELATIVE" ],
+   *     "offset" : [ 10, 1.0 ]
+   *   }
+   *   ...
+   * }
+   *
+   * @endcode
+   * @see Policy::Type
+   * @SINCE_1_2.60
+   * @note By default, both the x and the y offset is RELATIVE.
+   */
+  OFFSET_POLICY,
+
+  /**
+   * @brief Whether the width or height SIZE values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
+   * @details Name "sizePolicy", type Vector2 or Property::ARRAY of Property::STRING.
+   *          If Property::ARRAY then 2 strings expected for the width and height.
+   *
+   * @see Policy::Type
+   * @see OFFSET_POLICY for example
+   * @SINCE_1_2.60
+   * @note By default, both the width and the height is RELATIVE to the control's size.
+   */
+  SIZE_POLICY,
+};
+
+} // namespace Property
 
+} // namespace Transform
+
+/**
+ * @brief Shader for Visuals.
+ * @SINCE_1_1.45
+ */
+namespace Shader
+{
+/**
+ * @brief Shader Property.
+ * @SINCE_1_1.45
+ */
+namespace Property
+{
+/**
+ * @brief The type of Shader.
+ * @SINCE_1_1.45
+ */
 enum
 {
   /**
    * @brief The vertex shader.
-   * @details Name "vertexShader", type Property::STRING.
+   * @details Name "vertexShader", type Property::STRING or Property::ARRAY of Property::STRING.
+   *          A Property::ARRAY of Property::STRING values can be used to split the shader string over multiple lines.
    * @SINCE_1_1.45
    * @note Optional
    * @note If not supplied, the visual's already set vertex shader is used.
@@ -91,7 +275,8 @@ enum
 
   /**
    * @brief The fragment shader.
-   * @details Name "fragmentShader", type Property::STRING.
+   * @details Name "fragmentShader", type Property::STRING or Property::ARRAY of Property::STRING.
+   *          A Property::ARRAY of Property::STRING values can be used to split the shader string over multiple lines.
    * @SINCE_1_1.45
    * @note Optional
    * @note If not supplied, the visual's already set fragment shader is used.
@@ -132,8 +317,23 @@ enum
 
 } // namespace Shader
 
+/**
+ * @brief Status of resource which is used for visual.
+ * @SINCE_1_3_5
+ */
+enum class ResourceStatus
+{
+  PREPARING, /// Resource is prepared.    @SINCE_1_3_5
+  READY,     /// Resource is ready.       @SINCE_1_3_5
+  FAILED     /// Resource is fail to load @SINCE_1_3_5
+};
+
 } // namespace Visual
 
+/**
+ * @}
+ */
+
 } // namespace Toolkit
 
 } // namespace Dali