Skip to content

Instantly share code, notes, and snippets.

@sander
Created March 18, 2009 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sander/81296 to your computer and use it in GitHub Desktop.
Save sander/81296 to your computer and use it in GitHub Desktop.
/**
* shell_global_get_vertical_gradient:
*
* @top: the color at the top
* @bottom: the color at the bottom
*
* Creates a vertical gradient actor.
*
* Return value: a #ClutterCairoTexture actor with the gradient
*/
ClutterCairoTexture *
shell_global_get_vertical_gradient (ClutterColor *top, ClutterColor *bottom)
{
ClutterCairoTexture *texture;
texture = CLUTTER_CAIRO_TEXTURE (clutter_cairo_texture_new (8, 8));
cairo_t *cr = clutter_cairo_texture_create (texture);
#if 0
cairo_pattern_t *pattern = cairo_pattern_create_linear (0, 0, 1, 1);
cairo_pattern_add_color_stop_rgba (pattern, 0,
top->red / 255.,
top->green / 255.,
top->blue / 255.,
top->alpha / 255.);
cairo_pattern_add_color_stop_rgba (pattern, 1,
bottom->red / 255.,
bottom->green / 255.,
bottom->blue / 255.,
bottom->alpha / 255.);
cairo_set_source (cr, pattern);
cairo_rectangle (cr, 0, 0, 1, 1);
cairo_fill (cr);
#endif
cairo_destroy (cr);
#if 0
guint width;
clutter_cairo_texture_get_surface_size (CLUTTER_CAIRO_TEXTURE (texture),
&width, NULL);
g_debug ("width: %d", width);
#endif
return texture;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment