#define DALI_TOOLKIT_DEVEL_API_VISUALS_VISUAL_PROPERTIES_DEVEL_H
/*
- * Copyright (c) 2017 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
{
-
namespace DevelVisual
{
-
/**
* @brief All the visual types.
*/
MESH = Dali::Toolkit::Visual::MESH,
PRIMITIVE = Dali::Toolkit::Visual::PRIMITIVE,
WIREFRAME = Dali::Toolkit::Visual::WIREFRAME,
-
- TEXT = WIREFRAME + 1, ///< Renders text.
- N_PATCH = WIREFRAME + 2, ///< Renders an n-patch image.
- SVG = WIREFRAME + 3, ///< Renders an SVG image.
- ANIMATED_IMAGE = WIREFRAME + 4 ///< Renders a animated image.
+ TEXT = Dali::Toolkit::Visual::TEXT,
+ N_PATCH = Dali::Toolkit::Visual::N_PATCH,
+ SVG = Dali::Toolkit::Visual::SVG,
+ ANIMATED_IMAGE = Dali::Toolkit::Visual::ANIMATED_IMAGE,
+
+ ANIMATED_GRADIENT = ANIMATED_IMAGE + 1, ///< Renders an animated gradient.
+ ANIMATED_VECTOR_IMAGE = ANIMATED_IMAGE + 2, ///< Renders an animated vector image.
+ ARC = ANIMATED_IMAGE + 3, ///< Renders an arc.
};
+/**
+ * @brief Visual Properties
+ */
namespace Property
{
-
enum Type
{
- TYPE = Dali::Toolkit::Visual::Property::TYPE,
- SHADER = Dali::Toolkit::Visual::Property::SHADER,
+ TYPE = Dali::Toolkit::Visual::Property::TYPE,
+ SHADER = Dali::Toolkit::Visual::Property::SHADER,
+ TRANSFORM = Dali::Toolkit::Visual::Property::TRANSFORM,
+ PREMULTIPLIED_ALPHA = Dali::Toolkit::Visual::Property::PREMULTIPLIED_ALPHA,
+ MIX_COLOR = Dali::Toolkit::Visual::Property::MIX_COLOR,
+ OPACITY = Dali::Toolkit::Visual::Property::OPACITY,
/**
- * @brief The transform used by the visual.
- * @details Name "transform", type Property::Map.
- *
- * @note Optional.
- * @see DevelVisual::Transform::Property
+ * @brief The fitting mode of the visual
+ * @details Name "fittingMode", type FittingMode (Property::INTEGER) or Property::STRING.
+ * @see DevelVisual::FittingMode
+ * @note The default is defined by the type of visual (if it's suitable to be stretched or not).
*/
- TRANSFORM = SHADER + 1,
+ VISUAL_FITTING_MODE = OPACITY + 1,
/**
- * @brief Enables/disables premultiplied alpha.
- * The premultiplied alpha is false by default unless this behaviour is modified
- * by the derived Visual type.
- *
- * @details Name "premultipliedAlpha", type Property::Boolean.
- *
+ * @brief The radius for the rounded corners of the visual
+ * @details Name "cornerRadius", type Property::FLOAT, animatable
* @note Optional.
*/
- PREMULTIPLIED_ALPHA = SHADER + 2,
-
- /**
- * @brief Mix color is a blend color for any visual.
- * @details Name "mixColor", type Property::VECTOR3 or Property::VECTOR4
- *
- * @note Optional
- */
- MIX_COLOR = SHADER + 3,
+ CORNER_RADIUS = OPACITY + 2,
/**
- * @brief Opacity is the alpha component of the mixColor, above.
- * @details Name "opacity", type Property::FLOAT
- *
- * @note Optional
+ * @brief Whether the corner radius value is relative (percentage [0.0f to 1.0f] of the visual size) or absolute (in world units).
+ * @details Name "cornerRadiusPolicy", type Property::INTEGER.
+ * @see Policy::Type
+ * @note By default, it is ABSOLUTE to the visual's size.
+ * If it it RELATIVE, the corner radius value is relative to the smaller of the visual width and visual height.
*/
- OPACITY = SHADER + 4
+ CORNER_RADIUS_POLICY = OPACITY + 3,
};
} // namespace Property
-namespace Transform
-{
-
/**
- * @brief Policies used by the transform for the offset or size.
+ * @brief The values of this enum determine how the visual should be fit to the view
*/
-namespace Policy
+enum FittingMode
{
-
-enum Type
-{
- RELATIVE = 0, ///< Relative to the control (percentage [0.0f to 1.0f] of the control).
- ABSOLUTE = 1 ///< Absolute value in world units.
+ FIT_KEEP_ASPECT_RATIO, ///< The visual should be scaled to fit, preserving aspect ratio
+ FILL, ///< The visual should be stretched to fill, not preserving aspect ratio
+ OVER_FIT_KEEP_ASPECT_RATIO, ///< The visual should be scaled to fit, preserving aspect ratio. The visual will be filled without empty area, and outside is cropped away.
+ CENTER, ///< The visual should keep original size of image. It is not scaled and not strecthed.
+ FIT_HEIGHT, ///< The visual should be scaled to fit, preserving aspect ratio. Height is scaled proportionately to maintain aspect ratio. It will be deprecated.
+ FIT_WIDTH ///< The visual should be scaled to fit, preserving aspect ratio. Width is scaled proportionately to maintain aspect ratio. It will be deprecated.
};
-} // namespace Policy
-
+/**
+ * @brief Devel Visual Transform for the offset or size.
+ */
+namespace Transform
+{
+/**
+ * @brief Visual Transform Property.
+ */
namespace Property
{
-
+/**
+ * @brief Enumeration for the type of Transform 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
- * @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
- * @note The default is Align::TOP_BEGIN.
- */
- ORIGIN,
+ SIZE_POLICY = Dali::Toolkit::Visual::Transform::Property::SIZE_POLICY,
/**
- * @brief The anchor-point of the visual
- * @details Name "anchorPoint", type Align::Type (Property::INTEGER) or Property::STRING.
- * @see Toolkit::Align
- * @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( DevelVisual::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 ]
- * }
- * ...
- * }
+ * @brief Extra size value that will be added to the computed visual size.
+ * @details Name "extraSize", type Vector2.
*
- * @endcode
- * @see Policy::Type
- * @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
- * @note By default, both the width and the height is RELATIVE to the control's size.
+ * @note It is an absolute value.
+ * The property can be used when a user want to set a visual size as a combined value of `relative` and `absolute`.
+ * For example, when a user want to set a visual size to (ControlSize * 2 + 10),
+ * The transform map will be,
+ * transformMap.Add( Transform::Property::SIZE, Vector2( 2.0f, 2.0f ) )
+ * .Add( Transform::Property::SIZE_POLICY, Vector2( Transform::Policy::Relative, Transform::Policy::Relative ) )
+ * .Add( Transform::Property::EXTRA_SIZE, Vector2( 10.0f, 10.0f ) );
*/
- SIZE_POLICY,
+ EXTRA_SIZE = SIZE_POLICY + 1,
};
} // namespace Property