ClutterActor * gb_player_rounded_rect (GbPlayer *self, gint width, gint height, ClutterColor *bgcolor, gint round_radius) { /* Mostly code of this function was got from Tweet, */ /* thanks to Emanuelle Bassi. (http://live.gnome.org/Tweet) */ ClutterActor *actor; cairo_t *cr; actor = clutter_cairo_new (width, height); cr = clutter_cairo_create (CLUTTER_CAIRO (actor)); cairo_move_to (cr, round_radius, 0); cairo_line_to (cr, width - round_radius, 0); cairo_curve_to (cr, width, 0, width, 0, width, round_radius); cairo_line_to (cr, width, height - round_radius); cairo_curve_to (cr, width, height, width, height, width - round_radius, height); cairo_line_to (cr, round_radius, height); cairo_curve_to (cr, 0, height, 0, height, 0, height - round_radius); cairo_line_to (cr, 0, round_radius); cairo_curve_to (cr, 0, 0, 0, 0, round_radius, 0); cairo_close_path (cr); clutter_cairo_set_source_color (cr, bgcolor); cairo_fill_preserve (cr); cairo_destroy (cr); return actor; }
static void tweet_overlay_constructed (GObject *gobject) { TweetOverlayPrivate *priv = TWEET_OVERLAY (gobject)->priv; priv->base = clutter_cairo_new (128, 128); clutter_actor_set_parent (priv->base, CLUTTER_ACTOR (gobject)); draw_background (TWEET_OVERLAY (gobject)); clutter_actor_set_size (priv->base, 128, 128); clutter_actor_set_position (priv->base, 0, 0); clutter_actor_show (priv->base); }