Beispiel #1
0
static gboolean
path_test_add_line_to (CallbackData *data)
{
  ClutterPathNode node = { 0, };

  node.type = CLUTTER_PATH_LINE_TO;
  node.points[0].x = 3;
  node.points[0].y = 4;

  clutter_path_add_line_to (data->path, node.points[0].x, node.points[0].y);

  data->nodes[data->n_nodes++] = node;

  return TRUE;
}
Beispiel #2
0
/**
 * clutter_behaviour_path_new_with_knots:
 * @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
 * @knots: an array of #ClutterKnot<!-- -->s
 * @n_knots: number of entries in @knots
 *
 * Creates a new path behaviour that will make the actors visit all of
 * the given knots in order with straight lines in between.
 *
 * A path will be created where the first knot is used in a
 * %CLUTTER_PATH_MOVE_TO and the subsequent knots are used in
 * %CLUTTER_PATH_LINE_TO<!-- -->s.
 *
 * If @alpha is not %NULL, the #ClutterBehaviour will take ownership
 * of the #ClutterAlpha instance. In the case when @alpha is %NULL,
 * it can be set later with clutter_behaviour_set_alpha().
 *
 * Return value: (transfer full): a #ClutterBehaviour
 *
 * Since: 1.0
 *
 * Deprecated: 1.6
 */
ClutterBehaviour *
clutter_behaviour_path_new_with_knots (ClutterAlpha      *alpha,
                                       const ClutterKnot *knots,
                                       guint              n_knots)
{
  ClutterPath *path = clutter_path_new ();
  guint i;

  if (n_knots > 0)
    {
      clutter_path_add_move_to (path, knots[0].x, knots[0].y);

      for (i = 1; i < n_knots; i++)
        clutter_path_add_line_to (path, knots[i].x, knots[i].y);
    }

  return g_object_new (CLUTTER_TYPE_BEHAVIOUR_PATH,
                       "alpha", alpha,
                       "path", path,
                       NULL);
}