Esempio n. 1
0
static void
draw_arrow (GOArrow const *arrow, cairo_t *cr, GOStyle *style,
	    double *endx, double *endy, double phi)
{
	double dx, dy;

	if (arrow->typ == GO_ARROW_NONE)
		return;

	cairo_save (cr);
	cairo_translate (cr, *endx, *endy);
	cairo_set_source_rgba (cr, GO_COLOR_TO_CAIRO (style->line.color));
	go_arrow_draw (arrow, cr, &dx, &dy, phi - M_PI / 2);
	*endx += dx;
	*endy += dy;
	cairo_restore (cr);
}
Esempio n. 2
0
static gboolean
cb_draw_arrow (GtkWidget *widget, cairo_t *cr, GOArrowSel *as)
{
	guint width = gtk_widget_get_allocated_width (widget);
	guint height = gtk_widget_get_allocated_height (widget);
	double dx, dy;
	double x = width / 2;
	double y1 = height / 4, y2 = height * 3 / 4;

	cairo_save (cr);
	cairo_translate (cr, x, y2);
	/* cairo_scale (cr, 2, 2); */
	/* cairo_set_source_rgba (cr, GO_COLOR_TO_CAIRO (style->line.color)); */
	go_arrow_draw (&as->arrow, cr, &dx, &dy, 0);
	cairo_restore (cr);

	cairo_move_to (cr, x, y1);
	cairo_line_to (cr, x + dx, y2 + dy);
	cairo_stroke (cr);

	return FALSE;
}