mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
2007-12-07 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.h: * clutter/clutter-actor.c: (clutter_actor_get_sizeu), (clutter_actor_get_positionu): Add unit-based accessors to the size and position.
This commit is contained in:
parent
a4234ab4cf
commit
f476cfbd4c
@ -1,3 +1,11 @@
|
||||
2007-12-07 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-actor.h:
|
||||
* clutter/clutter-actor.c:
|
||||
(clutter_actor_get_sizeu),
|
||||
(clutter_actor_get_positionu): Add unit-based accessors to
|
||||
the size and position.
|
||||
|
||||
2007-12-07 Tomas Frydrych <tf@openedhand.com>
|
||||
|
||||
* clutter/clutter-behaviour-ellipse.c:
|
||||
|
@ -2109,6 +2109,35 @@ clutter_actor_get_size (ClutterActor *self,
|
||||
*height = CLUTTER_UNITS_TO_INT (box.y2 - box.y1);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_get_sizeu:
|
||||
* @self: A #ClutterActor
|
||||
* @width: Location to store width if non NULL.
|
||||
* @height: Location to store height if non NULL.
|
||||
*
|
||||
* Gets the size of an actor in #ClutterUnit<!-- -->s ignoring any scaling
|
||||
* factors.
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
void
|
||||
clutter_actor_get_sizeu (ClutterActor *self,
|
||||
ClutterUnit *width,
|
||||
ClutterUnit *height)
|
||||
{
|
||||
ClutterActorBox box;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
clutter_actor_query_coords (self, &box);
|
||||
|
||||
if (width)
|
||||
*width = box.x2 - box.x1;
|
||||
|
||||
if (height)
|
||||
*height = box.y2 - box.y1;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_get_position:
|
||||
* @self: a #ClutterActor
|
||||
@ -2137,6 +2166,34 @@ clutter_actor_get_position (ClutterActor *self,
|
||||
*y = CLUTTER_UNITS_TO_INT (box.y1);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_get_positionu:
|
||||
* @self: a #ClutterActor
|
||||
* @x: return location for the X coordinate, or %NULL
|
||||
* @y: return location for the Y coordinate, or %NULL
|
||||
*
|
||||
* Retrieves the position of an actor in #ClutterUnit<!-- -->s.
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
void
|
||||
clutter_actor_get_positionu (ClutterActor *self,
|
||||
ClutterUnit *x,
|
||||
ClutterUnit *y)
|
||||
{
|
||||
ClutterActorBox box = { 0, };
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
clutter_actor_query_coords (self, &box);
|
||||
|
||||
if (x)
|
||||
*x = box.x1;
|
||||
|
||||
if (y)
|
||||
*y = box.y1;
|
||||
}
|
||||
|
||||
/*
|
||||
* clutter_actor_get_abs_position_units
|
||||
* @self: A #ClutterActor
|
||||
@ -3949,27 +4006,27 @@ clutter_scriptable_iface_init (ClutterScriptableIface *iface)
|
||||
/**
|
||||
* clutter_actor_transform_stage_point
|
||||
* @self: A #ClutterActor
|
||||
* @x: x screen coordiance of point to unproject, in #ClutterUnit
|
||||
* @y: y screen coordiance of point to unproject, in #ClutterUnit
|
||||
* @x: x_out location where to store the unprojected x coordinance, in
|
||||
* #ClutterUnit.
|
||||
* @y: y_out location where to store the unprojected y coordinance, in
|
||||
* #ClutterUnit.
|
||||
* @x: x screen coordinate of the point to unproject, in #ClutterUnit<!-- -->s
|
||||
* @y: y screen coordinate of the point to unproject, in #ClutterUnit<!-- -->s
|
||||
* @x_out: return location for the unprojected x coordinance, in
|
||||
* #ClutterUnit<!-- -->s
|
||||
* @y_out: return location for the unprojected y coordinance, in
|
||||
* #ClutterUnit<!-- -->s
|
||||
*
|
||||
* Return value: TRUE if conversion was successful.
|
||||
*
|
||||
* The function translates point with screen coordinates x,y to coordinates
|
||||
* relative to the actor, i.e., it can be used, to translate screen events
|
||||
* from global screen coordinates into local coordinates.
|
||||
* The function translates point with screen coordinates (@x, @y) to
|
||||
* coordinates relative to the actor, i.e. it can be used to translate
|
||||
* screen events from global screen coordinates into local coordinates.
|
||||
*
|
||||
* The conversion can fail, notably if the transform stack results in the
|
||||
* actor being projected on the screen as a mere line.
|
||||
*
|
||||
* The conversion should not be expected to be pixel-perfect due to the nature
|
||||
* of the operation. In general the error grows when the skewing of the actor
|
||||
* rectangle on screen increases.
|
||||
* The conversion should not be expected to be pixel-perfect due to the
|
||||
* nature of the operation. In general the error grows when the skewing
|
||||
* of the actor rectangle on screen increases.
|
||||
*
|
||||
* WARNING: This function is fairly computationally intensive.
|
||||
* Note: This function is fairly computationally intensive.
|
||||
*
|
||||
* Return value: %TRUE if conversion was successful.
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
|
@ -256,6 +256,15 @@ void clutter_actor_set_size (ClutterActor *sel
|
||||
void clutter_actor_set_sizeu (ClutterActor *self,
|
||||
ClutterUnit width,
|
||||
ClutterUnit height);
|
||||
void clutter_actor_get_size (ClutterActor *self,
|
||||
guint *width,
|
||||
guint *height);
|
||||
void clutter_actor_get_sizeu (ClutterActor *self,
|
||||
ClutterUnit *width,
|
||||
ClutterUnit *height);
|
||||
void clutter_actor_get_abs_size (ClutterActor *self,
|
||||
guint *width,
|
||||
guint *height);
|
||||
void clutter_actor_set_position (ClutterActor *self,
|
||||
gint x,
|
||||
gint y);
|
||||
@ -265,6 +274,9 @@ void clutter_actor_set_positionu (ClutterActor *sel
|
||||
void clutter_actor_get_position (ClutterActor *self,
|
||||
gint *x,
|
||||
gint *y);
|
||||
void clutter_actor_get_positionu (ClutterActor *self,
|
||||
ClutterUnit *x,
|
||||
ClutterUnit *y);
|
||||
void clutter_actor_get_abs_position (ClutterActor *self,
|
||||
gint *x,
|
||||
gint *y);
|
||||
@ -368,12 +380,6 @@ void clutter_actor_get_scale (ClutterActor *sel
|
||||
gdouble *scale_x,
|
||||
gdouble *scale_y);
|
||||
|
||||
void clutter_actor_get_abs_size (ClutterActor *self,
|
||||
guint *width,
|
||||
guint *height);
|
||||
void clutter_actor_get_size (ClutterActor *self,
|
||||
guint *width,
|
||||
guint *height);
|
||||
void clutter_actor_move_by (ClutterActor *self,
|
||||
gint dx,
|
||||
gint dy);
|
||||
|
Loading…
Reference in New Issue
Block a user