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>
* 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_pointu
clutter_actor_get_clip
clutter_actor_get_clipu
clutter_actor_get_coords
clutter_actor_get_depth
clutter_actor_get_geometry
@ -50,6 +51,7 @@ clutter_actor_set_anchor_point
clutter_actor_set_anchor_point_from_gravity
clutter_actor_set_anchor_pointu
clutter_actor_set_clip
clutter_actor_set_clipu
clutter_actor_set_depth
clutter_actor_set_geometry
clutter_actor_set_height

View File

@ -3384,23 +3384,27 @@ clutter_actor_get_rotation (ClutterActor *self,
}
/**
* clutter_actor_set_clip:
* clutter_actor_set_clipu:
* @self: A #ClutterActor
* @xoff: X offset of the clip rectangle
* @yoff: Y offset of the clip rectangle
* @width: Width of the clip rectangle
* @height: Height of the clip rectangle
* @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
*
* 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
* set otherwise.
* 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_clip (ClutterActor *self,
gint xoff,
gint yoff,
gint width,
gint height)
clutter_actor_set_clipu (ClutterActor *self,
ClutterUnit xoff,
ClutterUnit yoff,
ClutterUnit width,
ClutterUnit height)
{
ClutterActorPrivate *priv;
@ -3408,10 +3412,10 @@ clutter_actor_set_clip (ClutterActor *self,
priv = self->priv;
priv->clip[0] = CLUTTER_UNITS_FROM_DEVICE (xoff);
priv->clip[1] = CLUTTER_UNITS_FROM_DEVICE (yoff);
priv->clip[2] = CLUTTER_UNITS_FROM_DEVICE (width);
priv->clip[3] = CLUTTER_UNITS_FROM_DEVICE (height);
priv->clip[0] = xoff;
priv->clip[1] = yoff;
priv->clip[2] = width;
priv->clip[3] = height;
priv->has_clip = TRUE;
@ -3419,6 +3423,34 @@ clutter_actor_set_clip (ClutterActor *self,
g_object_notify (G_OBJECT (self), "clip");
}
/**
* clutter_actor_set_clip:
* @self: A #ClutterActor
* @xoff: X offset of the clip rectangle, in pixels
* @yoff: Y offset of the clip rectangle, in pixels
* @width: Width of the clip rectangle, in pixels
* @height: Height of the clip rectangle, in pixels
*
* 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
* set otherwise.
*/
void
clutter_actor_set_clip (ClutterActor *self,
gint xoff,
gint yoff,
gint width,
gint height)
{
g_return_if_fail (CLUTTER_IS_ACTOR (self));
clutter_actor_set_clipu (self,
CLUTTER_UNITS_FROM_DEVICE (xoff),
CLUTTER_UNITS_FROM_DEVICE (yoff),
CLUTTER_UNITS_FROM_DEVICE (width),
CLUTTER_UNITS_FROM_DEVICE (height));
}
/**
* clutter_actor_remove_clip
* @self: A #ClutterActor
@ -3453,6 +3485,49 @@ clutter_actor_has_clip (ClutterActor *self)
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:
* @self: a #ClutterActor
@ -3467,31 +3542,28 @@ clutter_actor_has_clip (ClutterActor *self)
*/
void
clutter_actor_get_clip (ClutterActor *self,
gint *xoff,
gint *yoff,
gint *width,
gint *height)
gint *xoff,
gint *yoff,
gint *width,
gint *height)
{
ClutterActorPrivate *priv;
struct clipu { ClutterUnit x, y, width, height; } c = { 0, };
g_return_if_fail (CLUTTER_IS_ACTOR (self));
priv = self->priv;
if (!priv->has_clip)
return;
clutter_actor_get_clipu (self, &c.x, &c.y, &c.width, &c.height);
if (xoff)
*xoff = CLUTTER_UNITS_TO_DEVICE (priv->clip[0]);
*xoff = CLUTTER_UNITS_TO_DEVICE (c.x);
if (yoff)
*yoff = CLUTTER_UNITS_TO_DEVICE (priv->clip[1]);
*yoff = CLUTTER_UNITS_TO_DEVICE (c.y);
if (width)
*width = CLUTTER_UNITS_TO_DEVICE (priv->clip[2]);
*width = CLUTTER_UNITS_TO_DEVICE (c.width);
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 width,
gint height);
void clutter_actor_set_clipu (ClutterActor *self,
ClutterUnit xoff,
ClutterUnit yoff,
ClutterUnit width,
ClutterUnit height);
void clutter_actor_remove_clip (ClutterActor *self);
gboolean clutter_actor_has_clip (ClutterActor *self);
void clutter_actor_get_clip (ClutterActor *self,
@ -341,6 +346,11 @@ void clutter_actor_get_clip (ClutterActor *sel
gint *yoff,
gint *width,
gint *height);
void clutter_actor_get_clipu (ClutterActor *self,
ClutterUnit *xoff,
ClutterUnit *yoff,
ClutterUnit *width,
ClutterUnit *height);
void clutter_actor_set_parent (ClutterActor *self,
ClutterActor *parent);
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>
* clutter-sections.txt: Add clutter_group_add() and

View File

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