diff --git a/ChangeLog b/ChangeLog index 042a2ba22..96d13bad1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-04-23 Emmanuele Bassi + + * clutter/clutter-actor.[ch]: Add units based variant of the + rotation accessors. + 2008-04-23 Emmanuele Bassi Bug 892 - Incorrect results using rotation-[center|angle] properties diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index b26a85c74..9c35e2313 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -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 #ClutterUnits + * @y: Y coordinate of the rotation center, in #ClutterUnits + * @z: Z coordinate of the rotation center, in #ClutterUnits + * + * 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 #ClutterUnits + * @y: return value for the Y coordinate of the center of rotation, + * in #ClutterUnits + * @z: return value for the Z coordinate of the center of rotation, + * in #ClutterUnits + * + * 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 diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h index 4377daced..b9b6d30e0 100644 --- a/clutter/clutter-actor.h +++ b/clutter/clutter-actor.h @@ -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);