DALi Version 1.2.61
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / visuals / visual-properties.h
index c64a73c..5617198 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_VISUAL_PROPERTIES_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -27,6 +27,15 @@ namespace Dali
 namespace Toolkit
 {
 
+/**
+ * @addtogroup dali_toolkit_visuals
+ * @{
+ */
+
+/**
+ * @brief All the visual types
+ * @SINCE_1_1.45
+ */
 namespace Visual
 {
 
@@ -36,19 +45,30 @@ namespace Visual
  */
 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
-  TEXT, ///< Renders text. @SINCE_1_2.11
+  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 Visual Property
+ * @SINCE_1_1.45
+ */
 enum
 {
   /**
@@ -62,28 +82,184 @@ 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 DevelVisual::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.
+   * @SINCE_1_2.60
+   * @note Optional
+   */
+  MIX_COLOR,
+
+  /**
+   * @brief Opacity is the alpha component of the mixColor, above.
+   * @details Name "opacity", type Property::FLOAT.
+   * @SINCE_1_2.60
+   * @note Optional
+   */
+  OPACITY,
 };
 
 } // namespace Property
 
+namespace Transform
+{
+
+/**
+ * @brief Policies used by the transform for the offset or size.
+ * @SINCE_1_2.60
+ *
+ */
+namespace Policy
+{
+
+enum Type
+{
+  RELATIVE = 0,   ///< Relative to the control (percentage [0.0f to 1.0f] of the control).
+  ABSOLUTE = 1    ///< Absolute value in world units.
+};
+
+} // namespace Policy
+
+namespace Property
+{
+
+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.
+   * @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.
+   * @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( DevelVisual::Transform::Property::OFFSET_POLICY, Vector2( Policy::ABSOLUTE, Policy::RELATIVE ) ) )
+   *                                                            .Add( DevelVisual::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.
@@ -92,7 +268,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.
@@ -135,6 +312,10 @@ enum
 
 } // namespace Visual
 
+/**
+ * @}
+ */
+
 } // namespace Toolkit
 
 } // namespace Dali