mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 19:40:43 -05:00
types: Add ClutterMatrix
A simple typedef to CoglMatrix, that we can use for GObject properties and signal marshallers, without requiring Cogl to change.
This commit is contained in:
parent
3f732cdc2b
commit
25ba5374fe
@ -1266,3 +1266,120 @@ clutter_rect_progress (const GValue *a,
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterMatrix:
|
||||||
|
*
|
||||||
|
* A type representing a 4x4 matrix.
|
||||||
|
*
|
||||||
|
* It is identicaly to #CoglMatrix.
|
||||||
|
*
|
||||||
|
* Since: 1.12
|
||||||
|
*/
|
||||||
|
|
||||||
|
static gpointer
|
||||||
|
clutter_matrix_copy (gpointer data)
|
||||||
|
{
|
||||||
|
return g_memdup (data, sizeof (ClutterMatrix));
|
||||||
|
}
|
||||||
|
|
||||||
|
G_DEFINE_BOXED_TYPE (ClutterMatrix, clutter_matrix,
|
||||||
|
clutter_matrix_copy,
|
||||||
|
clutter_matrix_free)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_matrix_alloc:
|
||||||
|
*
|
||||||
|
* Allocates enough memory to hold a #ClutterMatrix.
|
||||||
|
*
|
||||||
|
* Return value: (transfer full): the newly allocated #ClutterMatrix
|
||||||
|
*
|
||||||
|
* Since: 1.12
|
||||||
|
*/
|
||||||
|
ClutterMatrix *
|
||||||
|
clutter_matrix_alloc (void)
|
||||||
|
{
|
||||||
|
return g_new0 (ClutterMatrix, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_matrix_free:
|
||||||
|
* @matrix: (allow-none): a #ClutterMatrix
|
||||||
|
*
|
||||||
|
* Frees the memory allocated by clutter_matrix_alloc().
|
||||||
|
*
|
||||||
|
* Since: 1.12
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_matrix_free (ClutterMatrix *matrix)
|
||||||
|
{
|
||||||
|
g_free (matrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_matrix_init_identity:
|
||||||
|
* @matrix: a #ClutterMatrix
|
||||||
|
*
|
||||||
|
* Initializes @matrix with the identity matrix, i.e.:
|
||||||
|
*
|
||||||
|
* |[
|
||||||
|
* .xx = 1.0, .xy = 0.0, .xz = 0.0, .xw = 0.0
|
||||||
|
* .yx = 0.0, .yy = 1.0, .yz = 0.0, .yw = 0.0
|
||||||
|
* .zx = 0.0, .zy = 0.0, .zz = 1.0, .zw = 0.0
|
||||||
|
* .wx = 0.0, .wy = 0.0, .wz = 0.0, .ww = 1.0
|
||||||
|
* ]|
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): the initialized #ClutterMatrix
|
||||||
|
*
|
||||||
|
* Since: 1.12
|
||||||
|
*/
|
||||||
|
ClutterMatrix *
|
||||||
|
clutter_matrix_init_identity (ClutterMatrix *matrix)
|
||||||
|
{
|
||||||
|
cogl_matrix_init_identity (matrix);
|
||||||
|
|
||||||
|
return matrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_matrix_init_from_array:
|
||||||
|
* @matrix: a #ClutterMatrix
|
||||||
|
* @values: (array fixed-size=16): a C array of 16 floating point values,
|
||||||
|
* representing a 4x4 matrix, with column-major order
|
||||||
|
*
|
||||||
|
* Initializes @matrix with the contents of a C array of floating point
|
||||||
|
* values.
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): the initialzed #ClutterMatrix
|
||||||
|
*
|
||||||
|
* Since: 1.12
|
||||||
|
*/
|
||||||
|
ClutterMatrix *
|
||||||
|
clutter_matrix_init_from_array (ClutterMatrix *matrix,
|
||||||
|
const float values[16])
|
||||||
|
{
|
||||||
|
cogl_matrix_init_from_array (matrix, values);
|
||||||
|
|
||||||
|
return matrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_matrix_init_from_matrix:
|
||||||
|
* @a: the #ClutterMatrix to initialize
|
||||||
|
* @b: the #ClutterMatrix to copy
|
||||||
|
*
|
||||||
|
* Initializes the #ClutterMatrix @a with the contents of the
|
||||||
|
* #ClutterMatrix @b.
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): the initialized #ClutterMatrix
|
||||||
|
*
|
||||||
|
* Since: 1.12
|
||||||
|
*/
|
||||||
|
ClutterMatrix *
|
||||||
|
clutter_matrix_init_from_matrix (ClutterMatrix *a,
|
||||||
|
ClutterMatrix *b)
|
||||||
|
{
|
||||||
|
memcpy (b, a, sizeof (ClutterMatrix));
|
||||||
|
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#define __CLUTTER_TYPES_H__
|
#define __CLUTTER_TYPES_H__
|
||||||
|
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
|
#include <cogl/cogl.h>
|
||||||
#include <clutter/clutter-macros.h>
|
#include <clutter/clutter-macros.h>
|
||||||
#include <clutter/clutter-enums.h>
|
#include <clutter/clutter-enums.h>
|
||||||
|
|
||||||
@ -40,6 +40,7 @@ G_BEGIN_DECLS
|
|||||||
#define CLUTTER_TYPE_GEOMETRY (clutter_geometry_get_type ())
|
#define CLUTTER_TYPE_GEOMETRY (clutter_geometry_get_type ())
|
||||||
#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ())
|
#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ())
|
||||||
#define CLUTTER_TYPE_MARGIN (clutter_margin_get_type ())
|
#define CLUTTER_TYPE_MARGIN (clutter_margin_get_type ())
|
||||||
|
#define CLUTTER_TYPE_MATRIX (clutter_matrix_get_type ())
|
||||||
#define CLUTTER_TYPE_PAINT_VOLUME (clutter_paint_volume_get_type ())
|
#define CLUTTER_TYPE_PAINT_VOLUME (clutter_paint_volume_get_type ())
|
||||||
#define CLUTTER_TYPE_PERSPECTIVE (clutter_perspective_get_type ())
|
#define CLUTTER_TYPE_PERSPECTIVE (clutter_perspective_get_type ())
|
||||||
#define CLUTTER_TYPE_VERTEX (clutter_vertex_get_type ())
|
#define CLUTTER_TYPE_VERTEX (clutter_vertex_get_type ())
|
||||||
@ -93,6 +94,8 @@ typedef struct _ClutterState ClutterState;
|
|||||||
|
|
||||||
typedef struct _ClutterInputDevice ClutterInputDevice;
|
typedef struct _ClutterInputDevice ClutterInputDevice;
|
||||||
|
|
||||||
|
typedef CoglMatrix ClutterMatrix;
|
||||||
|
|
||||||
typedef union _ClutterEvent ClutterEvent;
|
typedef union _ClutterEvent ClutterEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -673,6 +676,16 @@ typedef gboolean (* ClutterProgressFunc) (const GValue *a,
|
|||||||
void clutter_interval_register_progress_func (GType value_type,
|
void clutter_interval_register_progress_func (GType value_type,
|
||||||
ClutterProgressFunc func);
|
ClutterProgressFunc func);
|
||||||
|
|
||||||
|
GType clutter_matrix_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
ClutterMatrix * clutter_matrix_alloc (void);
|
||||||
|
ClutterMatrix * clutter_matrix_init_identity (ClutterMatrix *matrix);
|
||||||
|
ClutterMatrix * clutter_matrix_init_from_array (ClutterMatrix *matrix,
|
||||||
|
const float values[16]);
|
||||||
|
ClutterMatrix * clutter_matrix_init_from_matrix (ClutterMatrix *a,
|
||||||
|
ClutterMatrix *b);
|
||||||
|
void clutter_matrix_free (ClutterMatrix *matrix);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_TYPES_H__ */
|
#endif /* __CLUTTER_TYPES_H__ */
|
||||||
|
@ -899,6 +899,12 @@ clutter_margin_copy
|
|||||||
clutter_margin_free
|
clutter_margin_free
|
||||||
clutter_margin_get_type
|
clutter_margin_get_type
|
||||||
clutter_margin_new
|
clutter_margin_new
|
||||||
|
clutter_matrix_alloc
|
||||||
|
clutter_matrix_free
|
||||||
|
clutter_matrix_get_type
|
||||||
|
clutter_matrix_init_identity
|
||||||
|
clutter_matrix_init_from_array
|
||||||
|
clutter_matrix_init_from_matrix
|
||||||
clutter_media_get_audio_volume
|
clutter_media_get_audio_volume
|
||||||
clutter_media_get_buffer_fill
|
clutter_media_get_buffer_fill
|
||||||
clutter_media_get_can_seek
|
clutter_media_get_can_seek
|
||||||
|
Loading…
Reference in New Issue
Block a user