# define USE_CAIRO
#endif
+/* #undef USE_CAIRO */
+/* #define NO_THICK_LINE */
#ifdef DEBUGGING
static FILE *debug_fp = NULL;
cairo_stroke(fe->cr);
}
+static void do_draw_thick_line(frontend *fe, float thickness,
+ float x1, float y1, float x2, float y2)
+{
+ cairo_save(fe->cr);
+ cairo_set_line_width(fe->cr, thickness);
+ cairo_new_path(fe->cr);
+ cairo_move_to(fe->cr, x1, y1);
+ cairo_line_to(fe->cr, x2, y2);
+ cairo_stroke(fe->cr);
+ cairo_restore(fe->cr);
+}
+
static void do_draw_poly(frontend *fe, int *coords, int npoints,
int fillcolour, int outlinecolour)
{
static void repaint_rectangle(frontend *fe, GtkWidget *widget,
int x, int y, int w, int h)
{
+ if (x < fe->ox) {
+ gdk_draw_rectangle(widget->window,
+ widget->style->bg_gc[GTK_WIDGET_STATE(fe->area)],
+ TRUE, x, y, fe->ox - x, h);
+ w -= (fe->ox - x);
+ x = fe->ox;
+ }
+ if (y < fe->oy) {
+ gdk_draw_rectangle(widget->window,
+ widget->style->bg_gc[GTK_WIDGET_STATE(fe->area)],
+ TRUE, x, y, w, fe->oy - y);
+ h -= (fe->oy - y);
+ y = fe->oy;
+ }
+ if (w > fe->pw) {
+ gdk_draw_rectangle(widget->window,
+ widget->style->bg_gc[GTK_WIDGET_STATE(fe->area)],
+ TRUE, x + fe->pw, y, w - fe->pw, h);
+ w = fe->pw;
+ }
+ if (h > fe->ph) {
+ gdk_draw_rectangle(widget->window,
+ widget->style->bg_gc[GTK_WIDGET_STATE(fe->area)],
+ TRUE, x, y + fe->ph, w, h - fe->ph);
+ h = fe->ph;
+ }
gdk_draw_pixmap(widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE(fe->area)],
fe->pixmap,
gdk_draw_line(fe->pixmap, fe->gc, x1, y1, x2, y2);
}
+static void do_draw_thick_line(frontend *fe, float thickness,
+ float x1, float y1, float x2, float y2)
+{
+ GdkGCValues save;
+
+ gdk_gc_get_values(fe->gc, &save);
+ gdk_gc_set_line_attributes(fe->gc,
+ thickness,
+ GDK_LINE_SOLID,
+ GDK_CAP_BUTT,
+ GDK_JOIN_BEVEL);
+ gdk_draw_line(fe->pixmap, fe->gc, x1, y1, x2, y2);
+ gdk_gc_set_line_attributes(fe->gc,
+ save.line_width,
+ save.line_style,
+ save.cap_style,
+ save.join_style);
+}
+
static void do_draw_poly(frontend *fe, int *coords, int npoints,
int fillcolour, int outlinecolour)
{
do_draw_line(fe, x1, y1, x2, y2);
}
+void gtk_draw_thick_line(void *handle, float thickness,
+ float x1, float y1, float x2, float y2, int colour)
+{
+ frontend *fe = (frontend *)handle;
+ set_colour(fe, colour);
+ do_draw_thick_line(fe, thickness, x1, y1, x2, y2);
+}
+
void gtk_draw_poly(void *handle, int *coords, int npoints,
int fillcolour, int outlinecolour)
{
#else
NULL,
#endif
+#ifdef NO_THICK_LINE
+ NULL,
+#else
+ gtk_draw_thick_line,
+#endif
};
static void destroy(GtkWidget *widget, gpointer data)