2008-04-23 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-actor.[ch]: Add units based variant of the
	rotation accessors.
This commit is contained in:
Emmanuele Bassi 2008-04-23 12:53:25 +00:00
parent e1dfbec336
commit b450363370
3 changed files with 111 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2008-04-23 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.[ch]: Add units based variant of the
rotation accessors.
2008-04-23 Emmanuele Bassi <ebassi@openedhand.com>
Bug 892 - Incorrect results using rotation-[center|angle] properties

View File

@ -3712,6 +3712,37 @@ clutter_actor_get_depthu (ClutterActor *self)
return self->priv->z;
}
/**
* clutter_actor_set_rotationu:
* @self: a #ClutterActor
* @axis: the axis of rotation
* @angle: the angle of rotation
* @x: X coordinate of the rotation center, in #ClutterUnit<!-- -->s
* @y: Y coordinate of the rotation center, in #ClutterUnit<!-- -->s
* @z: Z coordinate of the rotation center, in #ClutterUnit<!-- -->s
*
* Sets the rotation angle of @self around the given axis.
*
* This function is the units based variant of clutter_actor_set_rotation().
*
* Since: 0.8
*/
void
clutter_actor_set_rotationu (ClutterActor *self,
ClutterRotateAxis axis,
gdouble angle,
ClutterUnit x,
ClutterUnit y,
ClutterUnit z)
{
g_return_if_fail (CLUTTER_IS_ACTOR (self));
clutter_actor_set_rotation_internal (self, axis,
CLUTTER_FLOAT_TO_FIXED (angle),
x, y, z);
}
/**
* clutter_actor_set_rotationx:
* @self: a #ClutterActor
@ -3782,6 +3813,70 @@ clutter_actor_set_rotation (ClutterActor *self,
x, y, z);
}
/**
* clutter_actor_get_rotationu:
* @self: a #ClutterActor
* @axis: the axis of rotation
* @x: return value for the X coordinate of the center of rotation,
* in #ClutterUnit<!-- -->s
* @y: return value for the Y coordinate of the center of rotation,
* in #ClutterUnit<!-- -->s
* @z: return value for the Z coordinate of the center of rotation,
* in #ClutterUnit<!-- -->s
*
* Retrieves the angle and center of rotation on the given axis,
* set using clutter_actor_set_rotation().
*
* This function is the units based variant of clutter_actor_get_rotation().
*
* Return value: the angle of rotation
*
* Since: 0.8
*/
gdouble
clutter_actor_get_rotationu (ClutterActor *self,
ClutterRotateAxis axis,
ClutterUnit *x,
ClutterUnit *y,
ClutterUnit *z)
{
ClutterActorPrivate *priv;
gdouble retval = 0;
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
priv = self->priv;
switch (axis)
{
case CLUTTER_X_AXIS:
retval = CLUTTER_FIXED_TO_DOUBLE (priv->rxang);
if (y)
*y = priv->rxy;
if (z)
*z = priv->rxz;
break;
case CLUTTER_Y_AXIS:
retval = CLUTTER_FIXED_TO_DOUBLE (priv->ryang);
if (x)
*x = priv->ryx;
if (z)
*z = priv->ryz;
break;
case CLUTTER_Z_AXIS:
retval = CLUTTER_FIXED_TO_DOUBLE (priv->rzang);
if (x)
*x = priv->rzx;
if (y)
*y = priv->rzy;
break;
}
return retval;
}
/**
* clutter_actor_get_rotationx:
* @self: a #ClutterActor

View File

@ -346,6 +346,12 @@ void clutter_actor_set_rotationx (ClutterActor
gint x,
gint y,
gint z);
void clutter_actor_set_rotationu (ClutterActor *self,
ClutterRotateAxis axis,
gdouble angle,
ClutterUnit x,
ClutterUnit y,
ClutterUnit z);
gdouble clutter_actor_get_rotation (ClutterActor *self,
ClutterRotateAxis axis,
gint *x,
@ -356,6 +362,11 @@ ClutterFixed clutter_actor_get_rotationx (ClutterActor
gint *x,
gint *y,
gint *z);
gdouble clutter_actor_get_rotationu (ClutterActor *self,
ClutterRotateAxis axis,
ClutterUnit *x,
ClutterUnit *y,
ClutterUnit *z);
void clutter_actor_set_opacity (ClutterActor *self,
guint8 opacity);