[murrine] Add a subtle outline on radiobutton and checkbox thick
- From: Andrea Cimitan <acimitan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [murrine] Add a subtle outline on radiobutton and checkbox thick
- Date: Fri, 23 Jul 2010 13:44:15 +0000 (UTC)
commit 2faac9be811b317a8e7198cdb03c849fc3aa5a22
Author: Andrea Cimitan <andrea cimitan gmail com>
Date: Fri Jul 23 15:40:59 2010 +0200
Add a subtle outline on radiobutton and checkbox thick
src/cairo-support.c | 25 ++++++++++++++++++++++++
src/cairo-support.h | 2 +
src/murrine_draw.c | 49 +++++++++++++++++++++++++++++++++++++---------
src/murrine_draw_rgba.c | 38 +++++++++++++++++++++++++++++++----
4 files changed, 99 insertions(+), 15 deletions(-)
---
diff --git a/src/cairo-support.c b/src/cairo-support.c
index 6a548bf..6c92c60 100644
--- a/src/cairo-support.c
+++ b/src/cairo-support.c
@@ -218,6 +218,31 @@ murrine_shade (const MurrineRGB *a, float k, MurrineRGB *b)
}
void
+murrine_invert_text (const MurrineRGB *a, MurrineRGB *b)
+{
+ double red;
+ double green;
+ double blue;
+
+ red = a->r;
+ green = a->g;
+ blue = a->b;
+
+ murrine_rgb_to_hls (&red, &green, &blue);
+
+ if (green < 0.8)
+ green = 1.0;
+ else
+ green = 0.0;
+
+ murrine_hls_to_rgb (&red, &green, &blue);
+
+ b->r = red;
+ b->g = green;
+ b->b = blue;
+}
+
+void
murrine_mix_color (const MurrineRGB *color1, const MurrineRGB *color2,
gdouble mix_factor, MurrineRGB *composite)
{
diff --git a/src/cairo-support.h b/src/cairo-support.h
index bbd8f9d..c121a19 100644
--- a/src/cairo-support.h
+++ b/src/cairo-support.h
@@ -25,6 +25,8 @@
G_GNUC_INTERNAL void murrine_shade (const MurrineRGB *a, float k, MurrineRGB *b);
+G_GNUC_INTERNAL void murrine_invert_text (const MurrineRGB *a, MurrineRGB *b);
+
G_GNUC_INTERNAL void murrine_mix_color (const MurrineRGB *color1, const MurrineRGB *color2,
gdouble mix_factor, MurrineRGB *composite);
diff --git a/src/murrine_draw.c b/src/murrine_draw.c
index dec4633..5fb3dcf 100644
--- a/src/murrine_draw.c
+++ b/src/murrine_draw.c
@@ -2528,9 +2528,20 @@ murrine_draw_radiobutton (cairo_t *cr,
else
{
if (!draw_box)
+ {
cairo_arc (cr, (double)width/2, (double)height/2, (double)(width+height)/4-4, 0, G_PI*2);
+ }
else
- cairo_arc (cr, (double)width/2, (double)height/2, (double)(width+height)/4-4.5, 0, G_PI*2);
+ {
+ MurrineRGB outline;
+ murrine_invert_text (dot, &outline);
+
+ cairo_arc (cr, (double)width/2, (double)height/2, (double)(width+height)/4-4, 0, G_PI*2);
+ murrine_set_color_rgba (cr, &outline, 0.3*trans);
+ cairo_fill (cr);
+
+ cairo_arc (cr, (double)width/2, (double)height/2, (double)(width+height)/4-5, 0, G_PI*2);
+ }
murrine_set_color_rgba (cr, dot, trans);
cairo_fill (cr);
@@ -2638,9 +2649,9 @@ murrine_draw_checkbox (cairo_t *cr,
}
murrine_draw_border (cr, border,
- 1.5, 1.5, width-3, height-3,
- roundness, widget->corners,
- mrn_gradient_new, 1.0);
+ 1.5, 1.5, width-3, height-3,
+ roundness, widget->corners,
+ mrn_gradient_new, 1.0);
}
if (draw_bullet)
@@ -2663,9 +2674,27 @@ murrine_draw_checkbox (cairo_t *cr,
}
else
{
+ MurrineRGB outline;
+ murrine_invert_text (dot, &outline);
+
cairo_scale (cr, (double)width/18.0, (double)height/18.0);
+
+ cairo_move_to (cr, 5.0, 5.65);
+ cairo_line_to (cr, 8.95, 9.57);
+ cairo_line_to (cr, 16.0, 2.54);
+ cairo_line_to (cr, 16.0, 8.36);
+ cairo_line_to (cr, 10.6, 15.1);
+ cairo_line_to (cr, 7.6, 15.1);
+ cairo_line_to (cr, 2.95, 10.48);
+ cairo_line_to (cr, 2.95, 7.65);
+ cairo_close_path (cr);
+
+ murrine_set_color_rgba (cr, &outline, 0.5*trans);
+ cairo_fill (cr);
+
cairo_translate (cr, 4.0, 2.0);
}
+
cairo_move_to (cr, 0.0, 6.0);
cairo_line_to (cr, 0.0, 8.0);
cairo_line_to (cr, 4.0, 12.0);
@@ -2920,10 +2949,10 @@ murrine_draw_expander_button (cairo_t *cr,
void
murrine_draw_expander (cairo_t *cr,
- const MurrineColors *colors,
- const WidgetParameters *widget,
- const ExpanderParameters *expander,
- int x, int y)
+ const MurrineColors *colors,
+ const WidgetParameters *widget,
+ const ExpanderParameters *expander,
+ int x, int y)
{
switch (expander->style)
{
@@ -2933,7 +2962,7 @@ murrine_draw_expander (cairo_t *cr,
break;
case 1:
murrine_draw_expander_circle (cr, colors, widget, expander, x, y);
- break;
+ break;
case 2:
murrine_draw_expander_button (cr, colors, widget, expander, x, y);
break;
@@ -3034,7 +3063,7 @@ murrine_draw_focus_border (cairo_t *cr,
focus_fill = FALSE;
focus_shadow = TRUE;
border_alpha = 0.8;
- shadow_alpha = 0.4;
+ shadow_alpha = 0.4;
break;
case MRN_FOCUS_BUTTON_FLAT:
xoffset = -(focus->padding)-2.0;
diff --git a/src/murrine_draw_rgba.c b/src/murrine_draw_rgba.c
index 11929c3..2803c84 100644
--- a/src/murrine_draw_rgba.c
+++ b/src/murrine_draw_rgba.c
@@ -1597,7 +1597,7 @@ murrine_rgba_draw_scrollbar_slider (cairo_t *cr,
}
case 1:
{
- MurrineRGB inset;
+ MurrineRGB inset;
murrine_shade (&fill, 1.08, &inset);
for (i=0; i<3; i++)
@@ -1714,7 +1714,7 @@ murrine_rgba_draw_handle (cairo_t *cr,
cairo_stroke (cr);
bar_y += bar_spacing;
- }
+ }
break;
}
case 1:
@@ -1732,9 +1732,9 @@ murrine_rgba_draw_handle (cairo_t *cr,
cairo_stroke (cr);
bar_y += bar_spacing;
- }
+ }
break;
- }
+ }
}
}
@@ -1864,9 +1864,20 @@ murrine_rgba_draw_radiobutton (cairo_t *cr,
else
{
if (!draw_box)
+ {
cairo_arc (cr, (double)width/2, (double)height/2, (double)(width+height)/4-4, 0, G_PI*2);
+ }
else
- cairo_arc (cr, (double)width/2, (double)height/2, (double)(width+height)/4-4.5, 0, G_PI*2);
+ {
+ MurrineRGB outline;
+ murrine_invert_text (dot, &outline);
+
+ cairo_arc (cr, (double)width/2, (double)height/2, (double)(width+height)/4-4, 0, G_PI*2);
+ murrine_set_color_rgba (cr, &outline, 0.3*trans);
+ cairo_fill (cr);
+
+ cairo_arc (cr, (double)width/2, (double)height/2, (double)(width+height)/4-5, 0, G_PI*2);
+ }
murrine_set_color_rgba (cr, dot, trans);
cairo_fill (cr);
@@ -2000,7 +2011,24 @@ murrine_rgba_draw_checkbox (cairo_t *cr,
}
else
{
+ MurrineRGB outline;
+ murrine_invert_text (dot, &outline);
+
cairo_scale (cr, (double)width/18.0, (double)height/18.0);
+
+ cairo_move_to (cr, 5.0, 5.65);
+ cairo_line_to (cr, 8.95, 9.57);
+ cairo_line_to (cr, 16.0, 2.54);
+ cairo_line_to (cr, 16.0, 8.36);
+ cairo_line_to (cr, 10.6, 15.1);
+ cairo_line_to (cr, 7.6, 15.1);
+ cairo_line_to (cr, 2.95, 10.48);
+ cairo_line_to (cr, 2.95, 7.65);
+ cairo_close_path (cr);
+
+ murrine_set_color_rgba (cr, &outline, 0.5*trans);
+ cairo_fill (cr);
+
cairo_translate (cr, 4.0, 2.0);
}
cairo_move_to (cr, 0.0, 6.0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]