diff options
Diffstat (limited to 'gtk/gtk_print.c')
-rw-r--r-- | gtk/gtk_print.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/gtk/gtk_print.c b/gtk/gtk_print.c index 851b690ba..0685d2f9e 100644 --- a/gtk/gtk_print.c +++ b/gtk/gtk_print.c @@ -46,8 +46,7 @@ #include "utils/utils.h" static bool nsgtk_print_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style); -static bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, int width, - colour c, bool dotted, bool dashed); +bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style); static bool nsgtk_print_plot_polygon(const int *p, unsigned int n, colour fill); static bool nsgtk_print_plot_path(const float *p, unsigned int n, colour fill, float width, colour c, const float transform[6]); @@ -160,24 +159,32 @@ bool nsgtk_print_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style -bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, int width, - colour c, bool dotted, bool dashed) +bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style) { - nsgtk_print_set_colour(c); + nsgtk_print_set_colour(style->stroke_colour); + + switch (style->stroke_type) { + case PLOT_OP_TYPE_SOLID: /**< Solid colour */ + default: + nsgtk_print_set_solid(); + break; - if (dotted) + case PLOT_OP_TYPE_DOT: /**< Doted plot */ nsgtk_print_set_dotted(); - else if (dashed) + break; + + case PLOT_OP_TYPE_DASH: /**< dashed plot */ nsgtk_print_set_dashed(); - else - nsgtk_print_set_solid(); + break; + } - if (width == 0) - width = 1; + if (style->stroke_width == 0) + cairo_set_line_width(gtk_print_current_cr, 1); + else + cairo_set_line_width(gtk_print_current_cr, style->stroke_width); - cairo_set_line_width(gtk_print_current_cr, width); - cairo_move_to(gtk_print_current_cr, x0, y0 - 0.5); - cairo_line_to(gtk_print_current_cr, x1, y1 - 0.5); + cairo_move_to(gtk_print_current_cr, x0 + 0.5, y0 + 0.5); + cairo_line_to(gtk_print_current_cr, x1 + 0.5, y1 + 0.5); cairo_stroke(gtk_print_current_cr); return true; |