mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
geometry: Adds a clutter_geometry_intersects API
This adds a public function named clutter_geometry_intersects which determines if two geometries intersect or not returning TRUE if so else FALSE.
This commit is contained in:
parent
8a2e164354
commit
ff4c24f0a4
@ -8724,6 +8724,32 @@ clutter_geometry_union (const ClutterGeometry *geometry_a,
|
||||
result->height = y_2 - y_1;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_geometry_intersects:
|
||||
* @geometry0: The first geometry to test
|
||||
* @geometry1: The second geometry to test
|
||||
*
|
||||
* Determines if @geometry0 and geometry1 intersect returning %TRUE if
|
||||
* they do else %FALSE.
|
||||
*
|
||||
* Return value: %TRUE of @geometry0 and geometry1 intersect else
|
||||
* %FALSE.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
gboolean
|
||||
clutter_geometry_intersects (const ClutterGeometry *geometry0,
|
||||
const ClutterGeometry *geometry1)
|
||||
{
|
||||
if (geometry1->x >= (geometry0->x + (gint)geometry0->width) ||
|
||||
geometry1->y >= (geometry0->y + (gint)geometry0->height) ||
|
||||
(geometry1->x + (gint)geometry1->width) <= geometry0->x ||
|
||||
(geometry1->y + (gint)geometry1->height) <= geometry0->y)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* ClutterVertices
|
||||
*/
|
||||
|
@ -188,9 +188,11 @@ struct _ClutterGeometry
|
||||
|
||||
GType clutter_geometry_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void clutter_geometry_union (const ClutterGeometry *geometry_a,
|
||||
const ClutterGeometry *geometry_b,
|
||||
ClutterGeometry *result);
|
||||
void clutter_geometry_union (const ClutterGeometry *geometry_a,
|
||||
const ClutterGeometry *geometry_b,
|
||||
ClutterGeometry *result);
|
||||
gboolean clutter_geometry_intersects (const ClutterGeometry *geometry0,
|
||||
const ClutterGeometry *geometry1);
|
||||
|
||||
/**
|
||||
* ClutterKnot:
|
||||
|
@ -465,6 +465,7 @@ clutter_vertex_equal
|
||||
<SUBSECTION>
|
||||
ClutterGeometry
|
||||
clutter_geometry_union
|
||||
clutter_geometry_intersects
|
||||
|
||||
<SUBSECTION Standard>
|
||||
CLUTTER_TYPE_GEOMETRY
|
||||
|
Loading…
Reference in New Issue
Block a user