[clutter/wip/master-next: 9/23] actor: Add accessors for rotation angles
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/master-next: 9/23] actor: Add accessors for rotation angles
- Date: Tue, 10 Jul 2012 07:29:22 +0000 (UTC)
commit ed48dd177198cd2ad1dbb8318740bc0ff6d2ab3e
Author: Emmanuele Bassi <ebassi gnome org>
Date: Fri Jul 6 11:23:50 2012 +0100
actor: Add accessors for rotation angles
Given that the rotation transformations are now affected by the pivot
point, the Actor class should provide an accessors pair only for the
angle of rotation on a given axis.
https://bugzilla.gnome.org/show_bug.cgi?id=677853
clutter/clutter-actor.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++-
clutter/clutter-actor.h | 7 +++++
clutter/clutter.symbols | 2 +
3 files changed, 74 insertions(+), 1 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index a1c4c6e..e3e5e09 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -4229,7 +4229,24 @@ clutter_actor_set_rotation_angle_internal (ClutterActor *self,
clutter_actor_queue_redraw (self);
}
-static inline void
+/**
+ * clutter_actor_set_rotation_angle:
+ * @self: a #ClutterActor
+ * @axis: the axis to set the angle one
+ * @angle: the angle of rotation, in degrees
+ *
+ * Sets the @angle of rotation of a #ClutterActor on the given @axis.
+ *
+ * This function is a convenience for setting the rotation properties
+ * #ClutterActor:rotation-angle-x, #ClutterActor:rotation-angle-y,
+ * and #ClutterActor:rotation-angle-z.
+ *
+ * The center of rotation is established by the #ClutterActor:pivot-point
+ * property.
+ *
+ * Since: 1.12
+ */
+void
clutter_actor_set_rotation_angle (ClutterActor *self,
ClutterRotateAxis axis,
gdouble angle)
@@ -4238,6 +4255,8 @@ clutter_actor_set_rotation_angle (ClutterActor *self,
const double *cur_angle_p = NULL;
GParamSpec *pspec = NULL;
+ g_return_if_fail (CLUTTER_IS_ACTOR (self));
+
info = _clutter_actor_get_transform_info_or_defaults (self);
switch (axis)
@@ -4269,6 +4288,51 @@ clutter_actor_set_rotation_angle (ClutterActor *self,
clutter_actor_queue_redraw (self);
}
+/**
+ * clutter_actor_get_rotation_angle:
+ * @self: a #ClutterActor
+ * @axis: the axis of the rotation
+ *
+ * Retrieves the angle of rotation set by clutter_actor_set_rotation_angle().
+ *
+ * Return value: the angle of rotation, in degrees
+ *
+ * Since: 1.12
+ */
+gdouble
+clutter_actor_get_rotation_angle (ClutterActor *self,
+ ClutterRotateAxis axis)
+{
+ const ClutterTransformInfo *info;
+ gdouble retval;
+
+ g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0.0);
+
+ info = _clutter_actor_get_transform_info_or_defaults (self);
+
+ switch (axis)
+ {
+ case CLUTTER_X_AXIS:
+ retval = info->rx_angle;
+ break;
+
+ case CLUTTER_Y_AXIS:
+ retval = info->ry_angle;
+ break;
+
+ case CLUTTER_Z_AXIS:
+ retval = info->rz_angle;
+ break;
+
+ default:
+ g_warn_if_reached ();
+ retval = 0.0;
+ break;
+ }
+
+ return retval;
+}
+
/*< private >
* clutter_actor_set_rotation_center_internal:
* @self: a #ClutterActor
diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h
index 200ea9b..b91875f 100644
--- a/clutter/clutter-actor.h
+++ b/clutter/clutter-actor.h
@@ -633,6 +633,13 @@ CLUTTER_AVAILABLE_IN_1_12
void clutter_actor_get_pivot_point (ClutterActor *self,
gfloat *pivot_x,
gfloat *pivot_y);
+CLUTTER_AVAILABLE_IN_1_12
+void clutter_actor_set_rotation_angle (ClutterActor *self,
+ ClutterRotateAxis axis,
+ gdouble angle);
+CLUTTER_AVAILABLE_IN_1_12
+gdouble clutter_actor_get_rotation_angle (ClutterActor *self,
+ ClutterRotateAxis axis);
void clutter_actor_set_rotation (ClutterActor *self,
ClutterRotateAxis axis,
gdouble angle,
diff --git a/clutter/clutter.symbols b/clutter/clutter.symbols
index ec2bf5a..a32a219 100644
--- a/clutter/clutter.symbols
+++ b/clutter/clutter.symbols
@@ -138,6 +138,7 @@ clutter_actor_get_preferred_width
clutter_actor_get_previous_sibling
clutter_actor_get_reactive
clutter_actor_get_request_mode
+clutter_actor_get_rotation_angle
clutter_actor_get_rotation
clutter_actor_get_scale
clutter_actor_get_scale_center
@@ -257,6 +258,7 @@ clutter_actor_set_pivot_point
clutter_actor_set_position
clutter_actor_set_reactive
clutter_actor_set_request_mode
+clutter_actor_set_rotation_angle
clutter_actor_set_rotation
clutter_actor_set_scale
clutter_actor_set_scale_full
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]