[murrine] Changed option: glowstyle = 5 for a glow around the edges.



commit c04c6aa6ae28f9b6171a48b157d3eb512c8b5651
Author: Andrea Cimitan <andrea cimitan gmail com>
Date:   Thu Aug 5 21:11:28 2010 +0100

    Changed option: glowstyle = 5 for a glow around the edges.

 NEWS                     |    1 +
 schema/murrine.xml.in.in |    3 +++
 src/cairo-support.c      |   32 ++++++++++++++++++++++++++++++++
 src/murrine_draw.c       |    9 +++++----
 src/murrine_draw_rgba.c  |   11 ++++++-----
 5 files changed, 47 insertions(+), 9 deletions(-)
---
diff --git a/NEWS b/NEWS
index a0b459c..7a73ef5 100644
--- a/NEWS
+++ b/NEWS
@@ -44,6 +44,7 @@ Changes in this release:
               the border of the trough of GtkScrollbar and GtkProgressBar.
 - New option: trough_shades = { 1.0, 1.0 } to draw a gradient on
               the trough of GtkScrollbar and GtkProgressBar.
+- Changed option: glowstyle = 5 for a glow around the edges.
 - Changed option: listviewstyle = 2 for a solid line.
 - Changed option: menustyle = 2 for glow on the sides of the menu.
 - Changed option: reliefstyle = 3 for a gradient on shadow.
diff --git a/schema/murrine.xml.in.in b/schema/murrine.xml.in.in
index 2e197c6..3959c41 100644
--- a/schema/murrine.xml.in.in
+++ b/schema/murrine.xml.in.in
@@ -157,6 +157,9 @@
 		<enumeration value="4">
 			<label>Centered glow</label>
 		</enumeration>
+		<enumeration value="5">
+			<label>Glow around edges</label>
+		</enumeration>
 	</option>
 
 	<option type="enumeration" name="handlestyle" default="0">
diff --git a/src/cairo-support.c b/src/cairo-support.c
index 0d5def9..6d18927 100644
--- a/src/cairo-support.c
+++ b/src/cairo-support.c
@@ -23,6 +23,7 @@
 #include "cairo-support.h"
 #include "support.h"
 #include "murrine_types.h"
+#include "raico-blur.h"
 
 G_GNUC_INTERNAL void
 murrine_rgb_to_hls (gdouble *r,
@@ -672,6 +673,34 @@ murrine_draw_top_glow (cairo_t *cr,
 }
 
 static void
+murrine_draw_blur_glow (cairo_t *cr,
+                        const MurrineRGB *glow,
+                        int x, int y, int width, int height,
+                        int roundness, uint8 corners)
+{
+	raico_blur_t* blur = NULL;
+	cairo_t *cr_surface; 
+	cairo_surface_t *surface;
+	double bradius = 6;
+
+	/* draw glow */
+	surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width+bradius*2, height+bradius*2);
+	cr_surface = cairo_create (surface); 
+	blur = raico_blur_create (RAICO_BLUR_QUALITY_LOW);
+	raico_blur_set_radius (blur, bradius);
+	cairo_set_line_width (cr_surface, 4.0);
+	murrine_rounded_rectangle_closed (cr_surface, bradius, bradius, width, height, roundness, corners);
+	murrine_set_color_rgb (cr_surface, glow);
+	cairo_stroke (cr_surface);
+	raico_blur_apply (blur, surface);
+	cairo_set_source_surface (cr, surface, -bradius+2, -bradius+2); 
+	cairo_paint (cr);
+	cairo_surface_destroy (surface); 
+	cairo_destroy (cr_surface); 
+}
+
+
+static void
 murrine_draw_lightborder (cairo_t *cr,
                           const MurrineRGB *fill,
                           MurrineGradients mrn_gradient,
@@ -839,6 +868,9 @@ murrine_draw_glaze (cairo_t *cr,
 			case 4:
 				murrine_draw_centered_glow (cr, &glow, x, y, width, height);
 				break;
+			case 5:
+				murrine_draw_blur_glow (cr, &glow, x, y, width, height, radius, corners);
+				break;
 		}
 	}
 
diff --git a/src/murrine_draw.c b/src/murrine_draw.c
index b4a62e6..b5d7c1c 100644
--- a/src/murrine_draw.c
+++ b/src/murrine_draw.c
@@ -2301,21 +2301,22 @@ murrine_draw_menu_frame (cairo_t *cr,
 		raico_blur_t* blur = NULL;
 		cairo_t *cr_surface; 
 		cairo_surface_t *surface; 
+		int bradius = 20;
 
 		MurrineRGB fill;
 		murrine_shade (&colors->bg[0], 0.1, &fill);
 
 		/* draw glow */
-		surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width+40, height+40);
+		surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width+bradius*2, height+bradius*2);
 		cr_surface = cairo_create (surface); 
 		blur = raico_blur_create (RAICO_BLUR_QUALITY_LOW);
-		raico_blur_set_radius (blur, 20);
+		raico_blur_set_radius (blur, bradius);
 		cairo_set_line_width (cr_surface, 4.0);
-		cairo_rectangle (cr_surface, 20, 15, width, height+5);
+		cairo_rectangle (cr_surface, bradius, bradius-5, width, height+5);
 		murrine_set_color_rgb (cr_surface, &fill);
 		cairo_stroke (cr_surface);
 		raico_blur_apply (blur, surface);
-		cairo_set_source_surface (cr, surface, -20, -20); 
+		cairo_set_source_surface (cr, surface, -bradius, -bradius); 
 		cairo_paint (cr);
 		cairo_surface_destroy (surface); 
 		cairo_destroy (cr_surface); 
diff --git a/src/murrine_draw_rgba.c b/src/murrine_draw_rgba.c
index 550ff62..73bbd3f 100644
--- a/src/murrine_draw_rgba.c
+++ b/src/murrine_draw_rgba.c
@@ -2263,24 +2263,25 @@ murrine_rgba_draw_menu_frame (cairo_t *cr,
 		raico_blur_t* blur = NULL;
 		cairo_t *cr_surface; 
 		cairo_surface_t *surface; 
+		int bradius = 20;
 
 		MurrineRGB fill;
 		murrine_shade (&colors->bg[0], 0.1, &fill);
 
 		/* draw glow */
-		surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width+40, height+40);
+		surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width+bradius*2, height+bradius*2);
 		cr_surface = cairo_create (surface); 
 		blur = raico_blur_create (RAICO_BLUR_QUALITY_LOW);
-		raico_blur_set_radius (blur, 20);
+		raico_blur_set_radius (blur, bradius);
 		cairo_set_line_width (cr_surface, 4.0);
-		cairo_rectangle (cr_surface, 20, 15, width, height+5);
+		cairo_rectangle (cr_surface, bradius, bradius-5, width, height+5);
 		murrine_set_color_rgb (cr_surface, &fill);
 		cairo_stroke (cr_surface);
 		raico_blur_apply (blur, surface);
-		cairo_set_source_surface (cr, surface, -20, -20); 
+		cairo_set_source_surface (cr, surface, -bradius, -bradius); 
 		cairo_paint (cr);
 		cairo_surface_destroy (surface); 
-		cairo_destroy (cr_surface); 
+		cairo_destroy (cr_surface);
 	}
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]