All pastes #920329 Raw Edit

Stuff

public text v1 · immutable
#920329 ·published 2008-02-27 10:40 UTC
rendered paste body

ge_gdk_color_to_cairo (&style->bg[state_type], &base);
ge_hsb_from_color (&base, &h, &s, &b);
ge_color_from_hsb (h, s, b + 0.156, &inner_top);
ge_color_from_hsb (h, s, b, &inner_bot);
ge_color_from_hsb (h, s, b + 0.117, &grad_top);
ge_color_from_hsb (h, s, b - 0.156, &grad_bot);
ge_color_from_hsb (h, s, b - 0.588, &stroke);

-------------------------

/* shadow */
ge_cairo_rounded_rectangle (cr, x, y, width, height, radius, CR_CORNER_ALL);
ge_cairo_set_color (cr, &grad_bot);
cairo_stroke (cr);

/* border */
++x; ++y;
width -= 2; height -= 2;
--radius;

ge_cairo_rounded_rectangle (cr, x, y, width, height, radius, CR_CORNER_ALL);
ge_cairo_set_color (cr, &stroke);
cairo_stroke (cr);


/* inner stroke */
++x; ++y;
width -= 2; height -= 2;
--radius;

crp = cairo_pattern_create_linear (x, y, x, y + height);
cairo_pattern_add_color_stop_rgb (crp, 0.0, inner_top.r, inner_top.g, inner_top.b);
cairo_pattern_add_color_stop_rgb (crp, 1.0, inner_bot.r, inner_bot.g, inner_bot.b);
cairo_set_source (cr, crp);

ge_cairo_rounded_rectangle (cr, x, y, width, height, radius, CR_CORNER_ALL);
cairo_stroke (cr);
cairo_pattern_destroy (crp);


/* gradient */
x+=.5; y+=.5;
width -= 1; height -= 1;

crp = cairo_pattern_create_linear (x, y, x, y + height);
cairo_pattern_add_color_stop_rgb (crp, 0.0, grad_top.r, grad_top.g, grad_top.b);
cairo_pattern_add_color_stop_rgb (crp, 0.2, grad_top.r, grad_top.g, grad_top.b);
cairo_pattern_add_color_stop_rgb (crp, 0.8, grad_bot.r, grad_bot.g, grad_bot.b);
cairo_pattern_add_color_stop_rgb (crp, 1.0, grad_bot.r, grad_bot.g, grad_bot.b);
cairo_set_source (cr, crp);

cairo_rectangle (cr, x, y, width, height);
cairo_fill (cr);
cairo_pattern_destroy (crp);