* Added bezier routines.
[scdataviz] / graphwidget.c
index 7dbfbbd..7f2d944 100644 (file)
@@ -72,6 +72,9 @@ static void draw_lines(gpointer data, gpointer user_data) {
   double p2_y = (l->p2_y + cxt->yoffset)*cxt->yscaling;
   double p3_x = (l->p3_x + cxt->xoffset)*cxt->xscaling;
   double p3_y = (l->p3_y + cxt->yoffset)*cxt->yscaling;
+  #ifdef DEBUG
+  fprintf(stderr, "draw_lines: p0_x=%g, p0_y=%g, p1_x=%g, p1_y=%g, p2_x=%g, p2_y=%g, p3_x=%g, p3_y=%g\n", p0_x, p0_y, p1_x, p1_y, p2_x, p2_y, p3_x, p3_y);
+  #endif
   cairo_move_to(cxt->cr, p0_x, p0_y);
   cairo_curve_to(cxt->cr, p1_x, p1_y, p2_x, p2_y, p3_x, p3_y);
 }
@@ -110,11 +113,15 @@ static void draw(GtkWidget *graph, cairo_t *cr) {
   cairo_select_font_face (cr, "Georgia",
                          CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
   cairo_set_font_size (cr, 0.05);
-  g_ptr_array_foreach(gw->graph->points, &draw_point, (gpointer)&cxt);
   cairo_set_source_rgb(cr, 1, 1, 1);
   cairo_fill_preserve(cr);
   cairo_set_source_rgb(cr, 0, 0, 0);
   cairo_stroke(cr);
+  g_ptr_array_foreach(gw->graph->points, &draw_point, (gpointer)&cxt);
+  if(gw->graph->lines != NULL) {
+    g_ptr_array_foreach(gw->graph->lines, &draw_lines, (gpointer)&cxt);
+    cairo_stroke(cr);
+  }
   cairo_restore(cr);
 }