[nautilus] [eel] add an 'outline-stippling' property to the rect item
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] [eel] add an 'outline-stippling' property to the rect item
- Date: Fri, 13 Aug 2010 17:00:56 +0000 (UTC)
commit b453aaacb0b17392eacacd8a9e378b7227da6413
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Aug 13 18:57:09 2010 +0200
[eel] add an 'outline-stippling' property to the rect item
eel/eel-canvas-rect-ellipse.c | 24 ++++++++++++++++++++++++
eel/eel-canvas-rect-ellipse.h | 2 ++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/eel/eel-canvas-rect-ellipse.c b/eel/eel-canvas-rect-ellipse.c
index 4ed1fd8..688e289 100644
--- a/eel/eel-canvas-rect-ellipse.c
+++ b/eel/eel-canvas-rect-ellipse.c
@@ -59,6 +59,7 @@ enum {
PROP_OUTLINE_COLOR,
PROP_OUTLINE_COLOR_GDK,
PROP_OUTLINE_COLOR_RGBA,
+ PROP_OUTLINE_STIPPLING,
PROP_WIDTH_PIXELS,
PROP_WIDTH_UNITS
};
@@ -200,6 +201,11 @@ eel_canvas_re_class_init (EelCanvasREClass *klass)
g_param_spec_uint ("outline-color-rgba", NULL, NULL,
0, G_MAXUINT, 0,
G_PARAM_READWRITE));
+ g_object_class_install_property
+ (gobject_class,
+ PROP_OUTLINE_STIPPLING,
+ g_param_spec_boolean ("outline-stippling", NULL, NULL,
+ FALSE, G_PARAM_READWRITE));
g_object_class_install_property
(gobject_class,
PROP_WIDTH_PIXELS,
@@ -430,6 +436,12 @@ eel_canvas_re_set_property (GObject *object,
eel_canvas_item_request_redraw (item);
break;
+ case PROP_OUTLINE_STIPPLING:
+ re->outline_stippling = g_value_get_boolean (value);
+
+ eel_canvas_item_request_redraw (item);
+ break;
+
case PROP_WIDTH_PIXELS:
re->width = g_value_get_uint (value);
re->width_pixels = TRUE;
@@ -514,6 +526,10 @@ eel_canvas_re_get_property (GObject *object,
g_value_set_uint (value, re->outline_color);
break;
+ case PROP_OUTLINE_STIPPLING:
+ g_value_set_boolean (value, re->outline_stippling);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -732,6 +748,8 @@ eel_canvas_set_source_color (cairo_t *cr,
((rgba >> 0) & 0xff) / 255.);
}
+#define DASH_ON 0.8
+#define DASH_OFF 1.7
static void
eel_canvas_rect_draw (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose *expose)
{
@@ -781,6 +799,12 @@ eel_canvas_rect_draw (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose
cairo_set_line_width (cr, (int) (re->width * re->item.canvas->pixels_per_unit + 0.5));
}
+ if (re->outline_stippling) {
+ double dash[2] = { DASH_ON, DASH_OFF };
+
+ cairo_set_dash (cr, dash, G_N_ELEMENTS (dash), 0);
+ }
+
cairo_rectangle (cr,
cx1 + 0.5, cy1 + 0.5,
cx2 - cx1,
diff --git a/eel/eel-canvas-rect-ellipse.h b/eel/eel-canvas-rect-ellipse.h
index 288c66a..6036361 100644
--- a/eel/eel-canvas-rect-ellipse.h
+++ b/eel/eel-canvas-rect-ellipse.h
@@ -84,6 +84,8 @@ struct _EelCanvasRE {
guint fill_color; /* Fill color, RGBA */
guint outline_color; /* Outline color, RGBA */
+ gboolean outline_stippling;
+
/* Configuration flags */
unsigned int fill_set : 1; /* Is fill color set? */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]