actor-box: Adds clutter_actor_box_union utility

When using ClutterActorBoxs for representing clip regions it can be
convenient to be able to union multiple boxes together.
This commit is contained in:
Robert Bragg 2010-08-19 15:38:15 +01:00
parent 2da127dcff
commit 48a24a2e08
2 changed files with 31 additions and 0 deletions

View File

@ -9331,6 +9331,34 @@ clutter_actor_box_clamp_to_pixel (ClutterActorBox *box)
box->y2 = ceilf (box->y2);
}
/**
* clutter_actor_box_union:
* @a: (in): the first #ClutterActorBox
* @a: (in): a second #ClutterActorBox
* @result: (out): the #ClutterActorBox representing a union of @a and
* @b
*
* Unions the two boxes @a and @b and stores the result in @result.
*
* Since: 1.4
*/
void
clutter_actor_box_union (ClutterActorBox *a,
ClutterActorBox *b,
ClutterActorBox *result)
{
g_return_if_fail (a != NULL);
g_return_if_fail (b != NULL);
g_return_if_fail (result != NULL);
result->x1 = MIN (a->x1, b->x1);
result->y1 = MIN (a->y1, b->y1);
result->x2 = MAX (a->x2, b->x2);
result->y2 = MAX (a->y2, b->y2);
}
/******************************************************************************/
struct _ShaderData

View File

@ -169,6 +169,9 @@ void clutter_actor_box_interpolate (const ClutterActorBox *initial
gdouble progress,
ClutterActorBox *result);
void clutter_actor_box_clamp_to_pixel (ClutterActorBox *box);
void clutter_actor_box_union (ClutterActorBox *a,
ClutterActorBox *b,
ClutterActorBox *result);
/**
* ClutterGeometry: