static void clutter_behaviour_path_alpha_notify (ClutterBehaviour *behave, gdouble alpha_value) { ClutterBehaviourPath *pathb = CLUTTER_BEHAVIOUR_PATH (behave); ClutterBehaviourPathPrivate *priv = pathb->priv; ClutterKnot position; guint knot_num; if (priv->path) knot_num = clutter_path_get_position (priv->path, alpha_value, &position); else { memset (&position, 0, sizeof (position)); knot_num = 0; } clutter_behaviour_actors_foreach (behave, actor_apply_knot_foreach, &position); if (knot_num != priv->last_knot_passed) { g_signal_emit (behave, path_signals[KNOT_REACHED], 0, knot_num); priv->last_knot_passed = knot_num; } }
static void clutter_path_constraint_update_allocation (ClutterConstraint *constraint, ClutterActor *actor, ClutterActorBox *allocation) { ClutterPathConstraint *self = CLUTTER_PATH_CONSTRAINT (constraint); gfloat width, height; ClutterKnot position; guint knot_id; if (self->path == NULL) return; knot_id = clutter_path_get_position (self->path, self->offset, &position); clutter_actor_box_get_size (allocation, &width, &height); allocation->x1 = position.x; allocation->y1 = position.y; allocation->x2 = allocation->x1 + width; allocation->y2 = allocation->y1 + height; if (knot_id != self->current_node) { self->current_node = knot_id; g_signal_emit (self, path_signals[NODE_REACHED], 0, self->actor, self->current_node); } }
static gboolean path_test_get_position (CallbackData *data) { static const float values[] = { 0.125f, 16.0f, 16.0f, 0.375f, 48.0f, 48.0f, 0.625f, 80.0f, 48.0f, 0.875f, 112.0f, 16.0f }; gint i; set_triangle_path (data); for (i = 0; i < G_N_ELEMENTS (values); i += 3) { ClutterKnot pos; clutter_path_get_position (data->path, values[i], &pos); if (!float_fuzzy_equals (values[i + 1], pos.x) || !float_fuzzy_equals (values[i + 2], pos.y)) return FALSE; } return TRUE; }