2006-12-14 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-color.h: * clutter/clutter-color.c: Expose clutter_color_copy() and clutter_color_free() for the python bindings, so that they can manager the conversion automatically; use the slice allocator when copying/freeing a ClutterColor.
This commit is contained in:
parent
4d168e81fa
commit
9118c2ef99
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
||||
2006-12-14 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-color.h:
|
||||
* clutter/clutter-color.c: Expose clutter_color_copy()
|
||||
and clutter_color_free() for the python bindings, so that
|
||||
they can manager the conversion automatically; use the
|
||||
slice allocator when copying/freeing a ClutterColor.
|
||||
|
||||
2006-12-13 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-color.h:
|
||||
* clutter/clutter-color.c: Add clutter_color_equal(),
|
||||
a function for comparing two colors.
|
||||
|
||||
* clutter/clutter-rectangle.c:
|
||||
(clutter_rectangle_set_color),
|
||||
(clutter_rectangle_set_border_color): Unset the border if
|
||||
the color of the rectangle and the color of the border are
|
||||
the same.
|
||||
|
||||
2006-12-13 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-actor.c:
|
||||
|
@ -416,16 +416,73 @@ clutter_color_parse (const gchar *color,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static ClutterColor *
|
||||
clutter_color_copy (ClutterColor *color)
|
||||
/**
|
||||
* clutter_color_equal:
|
||||
* @a: a #ClutterColor
|
||||
* @b: a #ClutterColor
|
||||
*
|
||||
* Compares two #ClutterColor<!-- -->s and checks if they are the same.
|
||||
*
|
||||
* Return: %TRUE if the two colors are the same.
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
gboolean
|
||||
clutter_color_equal (const ClutterColor *a,
|
||||
const ClutterColor *b)
|
||||
{
|
||||
ClutterColor *result = g_new0 (ClutterColor, 1);
|
||||
g_return_val_if_fail (a != NULL, FALSE);
|
||||
g_return_val_if_fail (b != NULL, FALSE);
|
||||
|
||||
if (a == b)
|
||||
return TRUE;
|
||||
|
||||
return (a->red == b->red &&
|
||||
a->green == b->green &&
|
||||
a->blue == b->blue &&
|
||||
a->alpha == b->alpha);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_color_copy:
|
||||
* @color: a #ClutterColor
|
||||
*
|
||||
* Makes a copy of the color structure. The result must be
|
||||
* freed using clutter_color_free().
|
||||
*
|
||||
* Return value: an allocated copy of @color.
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
ClutterColor *
|
||||
clutter_color_copy (const ClutterColor *color)
|
||||
{
|
||||
ClutterColor *result;
|
||||
|
||||
g_return_val_if_fail (color != NULL, NULL);
|
||||
|
||||
result = g_slice_new (ClutterColor);
|
||||
*result = *color;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_color_free:
|
||||
* @color: a #ClutterColor
|
||||
*
|
||||
* Frees a color structure created with clutter_color_copy().
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
void
|
||||
clutter_color_free (ClutterColor *color)
|
||||
{
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
g_slice_free (ClutterColor, color);
|
||||
}
|
||||
|
||||
GType
|
||||
clutter_color_get_type (void)
|
||||
{
|
||||
@ -434,6 +491,6 @@ clutter_color_get_type (void)
|
||||
if (!our_type)
|
||||
our_type = g_boxed_type_register_static ("ClutterColor",
|
||||
(GBoxedCopyFunc) clutter_color_copy,
|
||||
(GBoxedFreeFunc) g_free);
|
||||
(GBoxedFreeFunc) clutter_color_free);
|
||||
return our_type;
|
||||
}
|
||||
|
@ -43,37 +43,42 @@ struct _ClutterColor
|
||||
guint8 alpha;
|
||||
};
|
||||
|
||||
GType clutter_color_get_type (void) G_GNUC_CONST;
|
||||
ClutterColor *clutter_color_copy (const ClutterColor *color);
|
||||
void clutter_color_free (ClutterColor *color);
|
||||
gboolean clutter_color_parse (const gchar *color,
|
||||
ClutterColor *dest);
|
||||
gboolean clutter_color_equal (const ClutterColor *a,
|
||||
const ClutterColor *b);
|
||||
|
||||
gboolean clutter_color_parse (const gchar *color,
|
||||
ClutterColor *dest);
|
||||
void clutter_color_add (const ClutterColor *src1,
|
||||
const ClutterColor *src2,
|
||||
ClutterColor *dest);
|
||||
void clutter_color_subtract (const ClutterColor *src1,
|
||||
const ClutterColor *src2,
|
||||
ClutterColor *dest);
|
||||
GType clutter_color_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void clutter_color_lighten (const ClutterColor *src,
|
||||
ClutterColor *dest);
|
||||
void clutter_color_darken (const ClutterColor *src,
|
||||
ClutterColor *dest);
|
||||
void clutter_color_shade (const ClutterColor *src,
|
||||
ClutterColor *dest,
|
||||
gdouble shade);
|
||||
|
||||
void clutter_color_to_hls (const ClutterColor *src,
|
||||
guint8 *hue,
|
||||
guint8 *luminance,
|
||||
guint8 *saturation);
|
||||
void clutter_color_from_hls (ClutterColor *dest,
|
||||
guint8 hue,
|
||||
guint8 luminance,
|
||||
guint8 saturation);
|
||||
void clutter_color_add (const ClutterColor *src1,
|
||||
const ClutterColor *src2,
|
||||
ClutterColor *dest);
|
||||
void clutter_color_subtract (const ClutterColor *src1,
|
||||
const ClutterColor *src2,
|
||||
ClutterColor *dest);
|
||||
void clutter_color_lighten (const ClutterColor *src,
|
||||
ClutterColor *dest);
|
||||
void clutter_color_darken (const ClutterColor *src,
|
||||
ClutterColor *dest);
|
||||
void clutter_color_shade (const ClutterColor *src,
|
||||
ClutterColor *dest,
|
||||
gdouble shade);
|
||||
|
||||
guint32 clutter_color_to_pixel (const ClutterColor *src);
|
||||
void clutter_color_from_pixel (ClutterColor *dest,
|
||||
guint32 pixel);
|
||||
void clutter_color_to_hls (const ClutterColor *src,
|
||||
guint8 *hue,
|
||||
guint8 *luminance,
|
||||
guint8 *saturation);
|
||||
void clutter_color_from_hls (ClutterColor *dest,
|
||||
guint8 hue,
|
||||
guint8 luminance,
|
||||
guint8 saturation);
|
||||
|
||||
guint32 clutter_color_to_pixel (const ClutterColor *src);
|
||||
void clutter_color_from_pixel (ClutterColor *dest,
|
||||
guint32 pixel);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -377,10 +377,16 @@ clutter_rectangle_set_color (ClutterRectangle *rectangle,
|
||||
clutter_actor_set_opacity (CLUTTER_ACTOR (rectangle),
|
||||
priv->color.alpha);
|
||||
|
||||
if (clutter_color_equal (&priv->color, &priv->border_color))
|
||||
priv->has_border = FALSE;
|
||||
else
|
||||
priv->has_border = TRUE;
|
||||
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (rectangle)))
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
|
||||
|
||||
g_object_notify (G_OBJECT (rectangle), "color");
|
||||
g_object_notify (G_OBJECT (rectangle), "has-border");
|
||||
g_object_unref (rectangle);
|
||||
}
|
||||
|
||||
@ -498,10 +504,16 @@ clutter_rectangle_set_border_color (ClutterRectangle *rectangle,
|
||||
priv->border_color.blue = color->blue;
|
||||
priv->border_color.alpha = color->alpha;
|
||||
|
||||
if (clutter_color_equal (&priv->color, &priv->border_color))
|
||||
priv->has_border = FALSE;
|
||||
else
|
||||
priv->has_border = TRUE;
|
||||
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (rectangle)))
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));
|
||||
|
||||
g_object_notify (G_OBJECT (rectangle), "border-color");
|
||||
g_object_notify (G_OBJECT (rectangle), "has-border");
|
||||
g_object_unref (rectangle);
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,9 @@
|
||||
2006-12-13 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter-sections.txt: Update; add clutter_color_equal().
|
||||
|
||||
* tmpl/clutter-color.sgml: Update template.
|
||||
|
||||
2006-12-13 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter-sections.txt: Update.
|
||||
|
@ -466,9 +466,12 @@ CLUTTER_FIXED_DIV
|
||||
<SECTION>
|
||||
<FILE>clutter-color</FILE>
|
||||
ClutterColor
|
||||
clutter_color_copy
|
||||
clutter_color_free
|
||||
clutter_color_parse
|
||||
clutter_color_add
|
||||
clutter_color_subtract
|
||||
clutter_color_equal
|
||||
clutter_color_lighten
|
||||
clutter_color_darken
|
||||
clutter_color_shade
|
||||
@ -495,12 +498,11 @@ clutter_event_new
|
||||
clutter_event_copy
|
||||
clutter_event_free
|
||||
clutter_event_type
|
||||
clutter_key_event_type
|
||||
clutter_key_event_time
|
||||
clutter_key_event_state
|
||||
clutter_button_event_time
|
||||
clutter_button_event_x
|
||||
clutter_button_event_y
|
||||
clutter_key_event_time
|
||||
clutter_key_event_state
|
||||
clutter_key_event_symbol
|
||||
clutter_key_event_code
|
||||
clutter_key_event_unicode
|
||||
|
@ -22,7 +22,7 @@ ClutterActor
|
||||
Sets a flag from #ClutterActorFlags to an actor
|
||||
</para>
|
||||
|
||||
@e: a #ClutterActor
|
||||
@e: a #ClutterActor
|
||||
@f: the flag to set
|
||||
|
||||
|
||||
|
@ -27,6 +27,23 @@ clutter-color
|
||||
@blue:
|
||||
@alpha:
|
||||
|
||||
<!-- ##### FUNCTION clutter_color_copy ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@color:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION clutter_color_free ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@color:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION clutter_color_parse ##### -->
|
||||
<para>
|
||||
|
||||
@ -57,6 +74,16 @@ clutter-color
|
||||
@dest:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION clutter_color_equal ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@a:
|
||||
@b:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION clutter_color_lighten ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -122,24 +122,6 @@ Windowing events handled by Clutter.
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION clutter_key_event_time ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@keyev:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION clutter_key_event_state ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@keyev:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION clutter_button_event_time ##### -->
|
||||
<para>
|
||||
|
||||
@ -167,6 +149,24 @@ Windowing events handled by Clutter.
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION clutter_key_event_time ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@keyev:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION clutter_key_event_state ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@keyev:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION clutter_key_event_symbol ##### -->
|
||||
<para>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user