Tizen Native API
Dali::LinearConstrainer Class Reference

LinearConstrainer applies constraints to objects given a linear map. More...

Inheritance diagram for Dali::LinearConstrainer:
Dali::Handle Dali::BaseHandle

Classes

struct  Property
 An enumeration of properties belonging to the LinearConstrainer class. More...

Public Member Functions

 LinearConstrainer ()
 Create an uninitialized LinearConstrainer handle.
 ~LinearConstrainer ()
 Destructor.
 LinearConstrainer (const LinearConstrainer &handle)
 This copy constructor is required for (smart) pointer semantics.
LinearConstraineroperator= (const LinearConstrainer &rhs)
 This assignment operator is required for (smart) pointer semantics.
void Apply (Dali::Property target, Dali::Property source, const Vector2 &range, const Vector2 &wrap=Vector2(-FLT_MAX, FLT_MAX))
 Applies the linear constraint to the target property.
void Remove (Dali::Handle &target)
 Removes the linear constraint in the target object.

Static Public Member Functions

static LinearConstrainer New ()
 Create an initialized LinearConstrainer handle.
static LinearConstrainer DownCast (BaseHandle handle)
 Downcast a handle to LinearConstrainer handle.

Detailed Description

LinearConstrainer applies constraints to objects given a linear map.

A linear map is defined by a set of value-progress pairs. Progress must be normalized between [0,1]. If no progress is defined, the values are considered to be equally spaced along the x axis.

Basically, a linear constrainer allows constraining a property to another property with the changes mapped over a certain range. For example, if you want to change the opacity of an actor depending on its position along the X-axis, so that it’s fully transparent on the edges and fully opaque in the center. To do this, an array with values, 0.0f, 1.0f, 0.0f, is created, which means that there are 3 control points. You can add as many control points as you want, but they will be linearly spaced. Then you can apply the linear constrainer by using the alpha of the actor as the target and the source as the actor’s position.

Since :
2.4

Constructor & Destructor Documentation

Create an uninitialized LinearConstrainer handle.

This can be initialized with LinearConstrainer::New Calling member functions with an uninitialized LinearConstrainer handle is not allowed.

Since :
2.4

Destructor.

This is non-virtual since derived Handle types must not contain data or virtual methods.

Since :
2.4

This copy constructor is required for (smart) pointer semantics.

Since :
2.4
Parameters:
[in]handleA reference to the copied handle

Member Function Documentation

void Dali::LinearConstrainer::Apply ( Dali::Property  target,
Dali::Property  source,
const Vector2 range,
const Vector2 wrap = Vector2(-FLT_MAX, FLT_MAX) 
)

Applies the linear constraint to the target property.

Since :
2.4
Parameters:
[in]targetProperty to be constrained
[in]sourceProperty used as parameter for the linear map
[in]rangeThe range of values in the source property which will be mapped to [0,1]
[in]wrapWrapping domain. Source property will be wrapped in the domain [wrap.x,wrap.y] before mapping to [0,1]. See cfloat.h for FLT_MAX

Downcast a handle to LinearConstrainer handle.

If handle points to a LinearConstrainer object the downcast produces valid handle. If not the returned handle is left uninitialized.

Since :
2.4
Parameters:
[in]handleHandle to an object
Returns:
Handle to a LinearConstrainer object or an uninitialized handle

Reimplemented from Dali::Handle.

Create an initialized LinearConstrainer handle.

Since :
2.4
Returns:
A handle to a newly allocated Dali resource.

Reimplemented from Dali::Handle.

LinearConstrainer& Dali::LinearConstrainer::operator= ( const LinearConstrainer rhs)

This assignment operator is required for (smart) pointer semantics.

Since :
2.4
Parameters:
[in]rhsA reference to the copied handle
Returns:
A reference to this

Removes the linear constraint in the target object.

Since :
2.4
Parameters:
[in]targetA handle to an object constrained by the LinearConstrainer