ClutterActorBox *box;
box = g_slice_new (ClutterActorBox);
+ clutter_actor_box_init (box, x_1, y_1, x_2, y_2);
+
+ return box;
+}
+
+/**
+ * clutter_actor_box_init:
+ * @box: a #ClutterActorBox
+ * @x_1: X coordinate of the top left point
+ * @y_1: Y coordinate of the top left point
+ * @x_2: X coordinate of the bottom right point
+ * @y_2: Y coordinate of the bottom right point
+ *
+ * Initializes @box with the given coordinates.
+ *
+ * Since: 1.10
+ */
+void
+clutter_actor_box_init (ClutterActorBox *box,
+ gfloat x_1,
+ gfloat y_1,
+ gfloat x_2,
+ gfloat y_2)
+{
+ g_return_if_fail (box != NULL);
+
box->x1 = x_1;
box->y1 = y_1;
box->x2 = x_2;
box->y2 = y_2;
+}
- return box;
+/**
+ * clutter_actor_box_init_rect:
+ * @box: a #ClutterActorBox
+ * @x: X coordinate of the origin
+ * @y: Y coordinate of the origin
+ * @width: width of the box
+ * @height: height of the box
+ *
+ * Initializes @box with the given origin and size.
+ *
+ * Since: 1.10
+ */
+void
+clutter_actor_box_init_rect (ClutterActorBox *box,
+ gfloat x,
+ gfloat y,
+ gfloat width,
+ gfloat height)
+{
+ g_return_if_fail (box != NULL);
+
+ box->x1 = x;
+ box->y1 = y;
+ box->x2 = box->x1 + width;
+ box->y2 = box->y1 + height;
}
/**
width = box->x2 - box->x1;
height = box->y2 - box->y1;
- box->x1 = x;
- box->y1 = y;
- box->x2 = box->x1 + width;
- box->y2 = box->y1 + height;
+ clutter_actor_box_init_rect (box, x, y, width, height);
}
/**
gfloat y2;
};
+/**
+ * CLUTTER_ACTOR_BOX_INIT:
+ * @x_1: the X coordinate of the top left corner
+ * @y_1: the Y coordinate of the top left corner
+ * @x_2: the X coordinate of the bottom right corner
+ * @y_2: the Y coordinate of the bottom right corner
+ *
+ * A simple macro for initializing a #ClutterActorBox when declaring
+ * it, e.g.:
+ *
+ * |[
+ * ClutterActorBox box = CLUTTER_ACTOR_BOX_INIT (0, 0, 400, 600);
+ * ]|
+ *
+ * Since: 1.10
+ */
+#define CLUTTER_ACTOR_BOX_INIT(x_1,y_1,x_2,y_2) { (x_1), (y_1), (x_2), (y_2) }
+
GType clutter_actor_box_get_type (void) G_GNUC_CONST;
ClutterActorBox *clutter_actor_box_new (gfloat x_1,
gfloat y_1,
gfloat x_2,
gfloat y_2);
+void clutter_actor_box_init (ClutterActorBox *box,
+ gfloat x_1,
+ gfloat y_1,
+ gfloat x_2,
+ gfloat y_2);
+void clutter_actor_box_init_rect (ClutterActorBox *box,
+ gfloat x,
+ gfloat y,
+ gfloat width,
+ gfloat height);
ClutterActorBox *clutter_actor_box_copy (const ClutterActorBox *box);
void clutter_actor_box_free (ClutterActorBox *box);
gboolean clutter_actor_box_equal (const ClutterActorBox *box_a,