Add some utility initializers to ClutterActorBox
This commit is contained in:
parent
e1a31bb587
commit
5e9d6f7257
@ -32,12 +32,63 @@ clutter_actor_box_new (gfloat x_1,
|
|||||||
ClutterActorBox *box;
|
ClutterActorBox *box;
|
||||||
|
|
||||||
box = g_slice_new (ClutterActorBox);
|
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->x1 = x_1;
|
||||||
box->y1 = y_1;
|
box->y1 = y_1;
|
||||||
box->x2 = x_2;
|
box->x2 = x_2;
|
||||||
box->y2 = y_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -444,10 +495,7 @@ clutter_actor_box_set_origin (ClutterActorBox *box,
|
|||||||
width = box->x2 - box->x1;
|
width = box->x2 - box->x1;
|
||||||
height = box->y2 - box->y1;
|
height = box->y2 - box->y1;
|
||||||
|
|
||||||
box->x1 = x;
|
clutter_actor_box_init_rect (box, x, y, width, height);
|
||||||
box->y1 = y;
|
|
||||||
box->x2 = box->x1 + width;
|
|
||||||
box->y2 = box->y1 + height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,11 +151,39 @@ struct _ClutterActorBox
|
|||||||
gfloat y2;
|
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;
|
GType clutter_actor_box_get_type (void) G_GNUC_CONST;
|
||||||
ClutterActorBox *clutter_actor_box_new (gfloat x_1,
|
ClutterActorBox *clutter_actor_box_new (gfloat x_1,
|
||||||
gfloat y_1,
|
gfloat y_1,
|
||||||
gfloat x_2,
|
gfloat x_2,
|
||||||
gfloat y_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);
|
ClutterActorBox *clutter_actor_box_copy (const ClutterActorBox *box);
|
||||||
void clutter_actor_box_free (ClutterActorBox *box);
|
void clutter_actor_box_free (ClutterActorBox *box);
|
||||||
gboolean clutter_actor_box_equal (const ClutterActorBox *box_a,
|
gboolean clutter_actor_box_equal (const ClutterActorBox *box_a,
|
||||||
|
@ -58,6 +58,8 @@ clutter_actor_box_get_type
|
|||||||
clutter_actor_box_get_width
|
clutter_actor_box_get_width
|
||||||
clutter_actor_box_get_x
|
clutter_actor_box_get_x
|
||||||
clutter_actor_box_get_y
|
clutter_actor_box_get_y
|
||||||
|
clutter_actor_box_init_rect
|
||||||
|
clutter_actor_box_init
|
||||||
clutter_actor_box_interpolate
|
clutter_actor_box_interpolate
|
||||||
clutter_actor_box_new
|
clutter_actor_box_new
|
||||||
clutter_actor_box_set_origin
|
clutter_actor_box_set_origin
|
||||||
|
@ -522,7 +522,10 @@ clutter_actor_set_shader_param_int
|
|||||||
|
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
ClutterActorBox
|
ClutterActorBox
|
||||||
|
CLUTTER_ACTOR_BOX_INIT
|
||||||
clutter_actor_box_new
|
clutter_actor_box_new
|
||||||
|
clutter_actor_box_init
|
||||||
|
clutter_actor_box_init_rect
|
||||||
clutter_actor_box_copy
|
clutter_actor_box_copy
|
||||||
clutter_actor_box_free
|
clutter_actor_box_free
|
||||||
clutter_actor_box_equal
|
clutter_actor_box_equal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user