2007-12-24 Emmanuele Bassi <ebassi@openedhand.com>

* clutter.symbols: Add clutter_actor_set_clipu() and
	clutter_actor_get_clipu()

	* clutter/clutter-actor.h:
	* clutter/clutter-actor.c:
	(clutter_actor_set_clipu), (clutter_actor_get_clipu): Add the
	new units-based versions of the clip accessors

	(clutter_actor_set_clip), (clutter_actor_get_clip): Reimplement
	the pixels-based clip accessors as proxies for the units-based
	ones
This commit is contained in:
Emmanuele Bassi 2007-12-24 14:21:19 +00:00
parent 97dd890ae1
commit 53aee5ffb4
6 changed files with 136 additions and 30 deletions

View File

@ -1,3 +1,17 @@
2007-12-24 Emmanuele Bassi <ebassi@openedhand.com>
* clutter.symbols: Add clutter_actor_set_clipu() and
clutter_actor_get_clipu()
* clutter/clutter-actor.h:
* clutter/clutter-actor.c:
(clutter_actor_set_clipu), (clutter_actor_get_clipu): Add the
new units-based versions of the clip accessors
(clutter_actor_set_clip), (clutter_actor_get_clip): Reimplement
the pixels-based clip accessors as proxies for the units-based
ones
2007-12-24 Emmanuele Bassi <ebassi@openedhand.com> 2007-12-24 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/cogl/cogl.h: Update cogl_clip_set() to accept the * clutter/cogl/cogl.h: Update cogl_clip_set() to accept the

View File

@ -7,6 +7,7 @@ clutter_actor_get_abs_size
clutter_actor_get_anchor_point clutter_actor_get_anchor_point
clutter_actor_get_anchor_pointu clutter_actor_get_anchor_pointu
clutter_actor_get_clip clutter_actor_get_clip
clutter_actor_get_clipu
clutter_actor_get_coords clutter_actor_get_coords
clutter_actor_get_depth clutter_actor_get_depth
clutter_actor_get_geometry clutter_actor_get_geometry
@ -50,6 +51,7 @@ clutter_actor_set_anchor_point
clutter_actor_set_anchor_point_from_gravity clutter_actor_set_anchor_point_from_gravity
clutter_actor_set_anchor_pointu clutter_actor_set_anchor_pointu
clutter_actor_set_clip clutter_actor_set_clip
clutter_actor_set_clipu
clutter_actor_set_depth clutter_actor_set_depth
clutter_actor_set_geometry clutter_actor_set_geometry
clutter_actor_set_height clutter_actor_set_height

View File

@ -3383,13 +3383,53 @@ clutter_actor_get_rotation (ClutterActor *self,
x, y, z)); x, y, z));
} }
/**
* clutter_actor_set_clipu:
* @self: A #ClutterActor
* @xoff: X offset of the clip rectangle, in #ClutterUnit<!-- -->s
* @yoff: Y offset of the clip rectangle, in #ClutterUnit<!-- -->s
* @width: Width of the clip rectangle, in #ClutterUnit<!-- -->s
* @height: Height of the clip rectangle, in #ClutterUnit<!-- -->s
*
* Unit-based variant of clutter_actor_set_clip()
*
* Sets clip area for @self. The clip area is always computed from the
* upper left corner of the actor, even if the anchor point is set
* otherwise.
*
* Since: 0.6
*/
void
clutter_actor_set_clipu (ClutterActor *self,
ClutterUnit xoff,
ClutterUnit yoff,
ClutterUnit width,
ClutterUnit height)
{
ClutterActorPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
priv = self->priv;
priv->clip[0] = xoff;
priv->clip[1] = yoff;
priv->clip[2] = width;
priv->clip[3] = height;
priv->has_clip = TRUE;
g_object_notify (G_OBJECT (self), "has-clip");
g_object_notify (G_OBJECT (self), "clip");
}
/** /**
* clutter_actor_set_clip: * clutter_actor_set_clip:
* @self: A #ClutterActor * @self: A #ClutterActor
* @xoff: X offset of the clip rectangle * @xoff: X offset of the clip rectangle, in pixels
* @yoff: Y offset of the clip rectangle * @yoff: Y offset of the clip rectangle, in pixels
* @width: Width of the clip rectangle * @width: Width of the clip rectangle, in pixels
* @height: Height of the clip rectangle * @height: Height of the clip rectangle, in pixels
* *
* Sets clip area in pixels for @self. The clip area is always computed * Sets clip area in pixels for @self. The clip area is always computed
* from the upper left corner of the actor, even if the anchor point is * from the upper left corner of the actor, even if the anchor point is
@ -3402,21 +3442,13 @@ clutter_actor_set_clip (ClutterActor *self,
gint width, gint width,
gint height) gint height)
{ {
ClutterActorPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
priv = self->priv; clutter_actor_set_clipu (self,
CLUTTER_UNITS_FROM_DEVICE (xoff),
priv->clip[0] = CLUTTER_UNITS_FROM_DEVICE (xoff); CLUTTER_UNITS_FROM_DEVICE (yoff),
priv->clip[1] = CLUTTER_UNITS_FROM_DEVICE (yoff); CLUTTER_UNITS_FROM_DEVICE (width),
priv->clip[2] = CLUTTER_UNITS_FROM_DEVICE (width); CLUTTER_UNITS_FROM_DEVICE (height));
priv->clip[3] = CLUTTER_UNITS_FROM_DEVICE (height);
priv->has_clip = TRUE;
g_object_notify (G_OBJECT (self), "has-clip");
g_object_notify (G_OBJECT (self), "clip");
} }
/** /**
@ -3453,6 +3485,49 @@ clutter_actor_has_clip (ClutterActor *self)
return self->priv->has_clip; return self->priv->has_clip;
} }
/**
* clutter_actor_get_clipu:
* @self: a #ClutterActor
* @xoff: return location for the X offset of the clip rectangle, or %NULL
* @yoff: return location for the Y offset of the clip rectangle, or %NULL
* @width: return location for the width of the clip rectangle, or %NULL
* @height: return location for the height of the clip rectangle, or %NULL
*
* Unit-based variant of clutter_actor_get_clip().
*
* Gets the clip area for @self, in #ClutterUnit<!-- -->s.
*
* Since: 0.6
*/
void
clutter_actor_get_clipu (ClutterActor *self,
ClutterUnit *xoff,
ClutterUnit *yoff,
ClutterUnit *width,
ClutterUnit *height)
{
ClutterActorPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
priv = self->priv;
if (!priv->has_clip)
return;
if (xoff)
*xoff = priv->clip[0];
if (yoff)
*yoff = priv->clip[1];
if (width)
*width = priv->clip[2];
if (height)
*height = priv->clip[3];
}
/** /**
* clutter_actor_get_clip: * clutter_actor_get_clip:
* @self: a #ClutterActor * @self: a #ClutterActor
@ -3472,26 +3547,23 @@ clutter_actor_get_clip (ClutterActor *self,
gint *width, gint *width,
gint *height) gint *height)
{ {
ClutterActorPrivate *priv; struct clipu { ClutterUnit x, y, width, height; } c = { 0, };
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
priv = self->priv; clutter_actor_get_clipu (self, &c.x, &c.y, &c.width, &c.height);
if (!priv->has_clip)
return;
if (xoff) if (xoff)
*xoff = CLUTTER_UNITS_TO_DEVICE (priv->clip[0]); *xoff = CLUTTER_UNITS_TO_DEVICE (c.x);
if (yoff) if (yoff)
*yoff = CLUTTER_UNITS_TO_DEVICE (priv->clip[1]); *yoff = CLUTTER_UNITS_TO_DEVICE (c.y);
if (width) if (width)
*width = CLUTTER_UNITS_TO_DEVICE (priv->clip[2]); *width = CLUTTER_UNITS_TO_DEVICE (c.width);
if (height) if (height)
*height = CLUTTER_UNITS_TO_DEVICE (priv->clip[3]); *height = CLUTTER_UNITS_TO_DEVICE (c.height);
} }
/** /**

View File

@ -334,6 +334,11 @@ void clutter_actor_set_clip (ClutterActor *sel
gint yoff, gint yoff,
gint width, gint width,
gint height); gint height);
void clutter_actor_set_clipu (ClutterActor *self,
ClutterUnit xoff,
ClutterUnit yoff,
ClutterUnit width,
ClutterUnit height);
void clutter_actor_remove_clip (ClutterActor *self); void clutter_actor_remove_clip (ClutterActor *self);
gboolean clutter_actor_has_clip (ClutterActor *self); gboolean clutter_actor_has_clip (ClutterActor *self);
void clutter_actor_get_clip (ClutterActor *self, void clutter_actor_get_clip (ClutterActor *self,
@ -341,6 +346,11 @@ void clutter_actor_get_clip (ClutterActor *sel
gint *yoff, gint *yoff,
gint *width, gint *width,
gint *height); gint *height);
void clutter_actor_get_clipu (ClutterActor *self,
ClutterUnit *xoff,
ClutterUnit *yoff,
ClutterUnit *width,
ClutterUnit *height);
void clutter_actor_set_parent (ClutterActor *self, void clutter_actor_set_parent (ClutterActor *self,
ClutterActor *parent); ClutterActor *parent);
ClutterActor * clutter_actor_get_parent (ClutterActor *self); ClutterActor * clutter_actor_get_parent (ClutterActor *self);

View File

@ -1,3 +1,9 @@
2007-12-24 Emmanuele Bassi,,, <ebassi@sprite>
reviewed by: <delete if not using a buddy>
* clutter-sections.txt:
2007-12-21 Emmanuele Bassi <ebassi@openedhand.com> 2007-12-21 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-sections.txt: Add clutter_group_add() and * clutter-sections.txt: Add clutter_group_add() and

View File

@ -384,6 +384,8 @@ clutter_actor_set_sizeu
clutter_actor_get_sizeu clutter_actor_get_sizeu
clutter_actor_set_anchor_pointu clutter_actor_set_anchor_pointu
clutter_actor_get_anchor_pointu clutter_actor_get_anchor_pointu
clutter_actor_set_clipu
clutter_actor_get_clipu
<SUBSECTION> <SUBSECTION>
clutter_actor_set_scalex clutter_actor_set_scalex