From 388ce7b8c46ae20b97f891605f014db7fcb2fc6f Mon Sep 17 00:00:00 2001 From: Rob Kendrick Date: Tue, 21 Mar 2006 17:22:41 +0000 Subject: [project @ 2006-03-21 17:22:41 by rjek] Radio and checkbox widgets are now 3D, and implemented arc plotting for them svn path=/import/netsurf/; revision=2145 --- gtk/gtk_plotters.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'gtk/gtk_plotters.c') diff --git a/gtk/gtk_plotters.c b/gtk/gtk_plotters.c index 911cd2135..8da2d3c51 100644 --- a/gtk/gtk_plotters.c +++ b/gtk/gtk_plotters.c @@ -31,6 +31,8 @@ static bool nsgtk_plot_clip(int clip_x0, int clip_y0, static bool nsgtk_plot_text(int x, int y, struct css_style *style, const char *text, size_t length, colour bg, colour c); static bool nsgtk_plot_disc(int x, int y, int radius, colour c, bool filled); +static bool nsgtk_plot_arc(int x, int y, int radius, int angle1, int angle2, + colour c); static bool nsgtk_plot_bitmap(int x, int y, int width, int height, struct bitmap *bitmap, colour bg); static bool nsgtk_plot_bitmap_tile(int x, int y, int width, int height, @@ -53,6 +55,7 @@ const struct plotter_table nsgtk_plotters = { nsgtk_plot_clip, nsgtk_plot_text, nsgtk_plot_disc, + nsgtk_plot_arc, nsgtk_plot_bitmap, nsgtk_plot_bitmap_tile, nsgtk_plot_group_start, @@ -65,7 +68,6 @@ bool nsgtk_plot_clg(colour c) return true; } - bool nsgtk_plot_rectangle(int x0, int y0, int width, int height, int line_width, colour c, bool dotted, bool dashed) { @@ -197,6 +199,23 @@ bool nsgtk_plot_disc(int x, int y, int radius, colour c, bool filled) return true; } +bool nsgtk_plot_arc(int x, int y, int radius, int angle1, int angle2, colour c) +{ + nsgtk_set_colour(c); +#ifdef CAIRO_VERSION + cairo_set_line_width(current_cr, 1); + cairo_arc(current_cr, x, y, radius, + (angle1 + 90) * (M_PI / 180), + (angle2 + 90) * (M_PI / 180)); + cairo_stroke(current_cr); +#else + gdk_draw_arc(current_drawable, current_gc, + FALSE, x - (radius), y - radius, + radius * 2, radius * 2, + angle1 * 64, angle2 * 64); +#endif + return true; +} bool nsgtk_plot_bitmap(int x, int y, int width, int height, struct bitmap *bitmap, colour bg) -- cgit v1.2.3