Diff of /trunk/src/canvas_goocanvas.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 45 by achadwick, Mon Dec 15 14:17:29 2008 UTC revision 46 by achadwick, Mon Feb 2 20:59:14 2009 UTC
# Line 109  void canvas_item_set_zoom_max(canvas_ite Line 109  void canvas_item_set_zoom_max(canvas_ite
109                 NULL);                 NULL);
110  }  }
111    
112  void canvas_item_set_dashed(canvas_item_t *item) {  void canvas_item_set_dashed(canvas_item_t *item, gint line_width, gint dash_length) {
113    static GooCanvasLineDash *dash;    GooCanvasLineDash *dash;
114    if (!dash) {    if (dash_length <= 0) {
115      dash = goo_canvas_line_dash_new(2, 3.0, 4.0, 0);      dash_length = line_width + 1;
     goo_canvas_line_dash_ref(dash);  
116    }    }
117    // TODO: make the pattern width-dependent, or extend the elemstyles language    gfloat off_len = dash_length;
118    // to allow line patterns to be specified.    gfloat on_len = dash_length;
119      guint cap = CAIRO_LINE_CAP_BUTT;
120      if (dash_length > line_width) {
121        off_len += ((gfloat)line_width)/2;
122        on_len -= ((gfloat)line_width)/2;
123        cap = CAIRO_LINE_CAP_ROUND;
124      }
125      dash = goo_canvas_line_dash_new(2, on_len, off_len, 0);
126      goo_canvas_line_dash_ref(dash);
127    g_object_set(G_OBJECT(item),    g_object_set(G_OBJECT(item),
128                 "line-dash", dash,                 "line-dash", dash,
129                   "line-cap", cap,
130                 NULL);                 NULL);
131  }  }
132    

Legend:
Removed from v.45  
changed lines
  Added in v.46