mirror of
https://github.com/brl/mutter.git
synced 2025-06-13 16:59:30 +00:00
bezier spline behaviours
This commit is contained in:
@ -59,6 +59,85 @@
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-private.h"
|
||||
|
||||
/**
|
||||
* clutter_knot_copy:
|
||||
* @knot: a #ClutterKnot
|
||||
*
|
||||
* Makes an allocated copy of a knot.
|
||||
*
|
||||
* Return value: the copied knot.
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
ClutterKnot *
|
||||
clutter_knot_copy (const ClutterKnot *knot)
|
||||
{
|
||||
ClutterKnot *copy;
|
||||
|
||||
copy = g_slice_new0 (ClutterKnot);
|
||||
|
||||
*copy = *knot;
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_knot_free:
|
||||
* @knot: a #ClutterKnot
|
||||
*
|
||||
* Frees the memory of an allocated knot.
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
void
|
||||
clutter_knot_free (ClutterKnot *knot)
|
||||
{
|
||||
if (G_LIKELY (knot))
|
||||
{
|
||||
g_slice_free (ClutterKnot, knot);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_knot_equal:
|
||||
* @knot_a: First knot
|
||||
* @knot_b: Second knot
|
||||
*
|
||||
* Compares to knot and checks if the point to the same location.
|
||||
*
|
||||
* Return value: %TRUE if the knots point to the same location.
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
gboolean
|
||||
clutter_knot_equal (const ClutterKnot *knot_a,
|
||||
const ClutterKnot *knot_b)
|
||||
{
|
||||
g_return_val_if_fail (knot_a != NULL, FALSE);
|
||||
g_return_val_if_fail (knot_b != NULL, FALSE);
|
||||
|
||||
if (knot_a == knot_b)
|
||||
return TRUE;
|
||||
|
||||
return knot_a->x == knot_b->x && knot_a->y == knot_b->y;
|
||||
}
|
||||
|
||||
GType
|
||||
clutter_knot_get_type (void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
|
||||
if (G_UNLIKELY (!our_type))
|
||||
{
|
||||
our_type =
|
||||
g_boxed_type_register_static ("ClutterKnot",
|
||||
(GBoxedCopyFunc) clutter_knot_copy,
|
||||
(GBoxedFreeFunc) clutter_knot_free);
|
||||
}
|
||||
|
||||
return our_type;
|
||||
}
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (ClutterBehaviour,
|
||||
clutter_behaviour,
|
||||
G_TYPE_OBJECT);
|
||||
|
Reference in New Issue
Block a user