Commit Graph

16 Commits

Author SHA1 Message Date
Emmanuele Bassi
8c32637eea Deprecate ClutterGeometry
It's a bad rectangle type, with caveats and gotchas. We have better
types, courtesy of Cairo, as well as our own (ClutterRect).

https://bugzilla.gnome.org/show_bug.cgi?id=682789
2013-04-04 11:53:39 +01:00
Emmanuele Bassi
2f5aee9cb5 Fix interpolation between ClutterRect instances
A stupid typo broke the linear interpolation function.
2013-01-15 18:19:07 +00:00
Tristan Van Berkom
f49aff9682 Fixed clutter_rect_intersection()
There was a typo where y was used instead of x.
2012-12-09 03:30:57 +09:00
Emmanuele Bassi
22ce4409b3 Add interpolation for matrices
Interpolating between two transformations expressed using a 3D matrix
can be achieved by decomposing the matrices into their transformations
and do a simple numeric interpolation between the initial and final
states, like we do for other data types.

Luckily for us, the CSS Transforms specification from the W3C provides
the decomposition algorithm, using the "unmatrix" code taken from the
book "Graphics Gems II, edited by Jim Arvo".

Once the matrices have been decomposed, we can simply interpolate the
transformations, and re-apply them onto the result matrix, using the
facilities that Clutter provides for interpolating between two known
GTypes.
2012-09-03 20:54:43 +01:00
Emmanuele Bassi
f7dd2d3746 matrix: Fix the init_with_matrix() implementation
As usual, I swapped the memcpy() arguments around.
2012-08-19 17:23:26 +01:00
Emmanuele Bassi
b6e8f9d61e Remove (constructor) annotation
ClutterMatrix is an alias to CoglMatrix, and g-ir-scanner complains if
a function marked as a constructor does not return the correct type.
2012-08-16 12:22:56 +01:00
Emmanuele Bassi
3e4277c2e8 base-types: Add (constructor) annotations
The alloc() functions are the constructors for their types, so it's
better to have the introspection data match the intent of the API.
2012-08-10 15:05:44 +01:00
Emmanuele Bassi
25ba5374fe types: Add ClutterMatrix
A simple typedef to CoglMatrix, that we can use for GObject properties
and signal marshallers, without requiring Cogl to change.
2012-07-26 14:01:00 +01:00
Emmanuele Bassi
5eb07a3010 base-types: Don't free zero point and rect
Calling clutter_point_free(clutter_point_zero()) or calling
clutter_rect_free(clutter_rect_zero()) should be safe, exactly like it's
safe to call those functions with a NULL argument.
2012-06-10 17:54:22 +01:00
Emmanuele Bassi
17539bca95 base-types: Add zero point and rect
A constant ClutterPoint for (0, 0) and a constant degenerate ClutterRect
can be useful as guards for pointers, freeing the NULL value to mean
"unset".
2012-06-10 17:54:22 +01:00
Emmanuele Bassi
a9cc06257f docs: Add a reference section for geometric types 2012-04-27 12:30:47 +01:00
Emmanuele Bassi
b2feb463bd Add a rect-contains-rect function
Similar to the contains-point one.
2012-04-27 12:30:47 +01:00
Emmanuele Bassi
9c637ccb41 Use an epsilon for float comparison
We tend to use float comparison for structured data types like Vertex,
Point, and Size; we should take into consideration fluctuations in the
floating point representation as well.
2012-04-27 12:30:47 +01:00
Emmanuele Bassi
d021cc7c02 Add a function to compute the distance between points 2012-04-27 12:30:47 +01:00
Emmanuele Bassi
bc914bb8a2 Move towards an alloc/init pair for base types
Instead of a single new() constructor that both allocates and
initializes, split the allocation and initialization into two separate
functions for types that are typically used on the stack, and rarely
allocated on the heap, like ClutterPoint and friends.

This is also applied retroactively to ClutterActorBox and ClutterVertex,
given that the same considerations on usage apply to them as well; we
can add a return value to clutter_actor_box_init() and
clutter_vertex_init() in an ABI-compatible way, so that
clutter_actor_box_new() and clutter_vertex_new() can be effectively
reimplemented as "init (alloc ())".
2012-04-27 12:30:47 +01:00
Emmanuele Bassi
61f17e345a Add base geometric types
Clutter should provide some more basic geometric types - Point, Size,
Rect - so that we can use them in properties and accessors.
2012-04-27 12:30:46 +01:00