1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-20 02:56:15 +02:00

eeshow/cro.c: set line cap to CAIRO_LINE_CAP_ROUND or CAIRO_LINE_CAP_SQUARE

CAIRO_LINE_CAP_ROUND is the same as in FIG mode.

Note that all non-dashed lines disappear when generating PDF and
CAIRO_LINE_CAP_ROUND is set. For now, we just use CAIRO_LINE_CAP_SQUARE.
This commit is contained in:
Werner Almesberger 2016-08-02 17:26:02 -03:00
parent 56b4cb89cc
commit ade54c6029
2 changed files with 6 additions and 1 deletions

View File

@ -22,3 +22,4 @@
- move path name guessing into file.c
- return indication of whether diff found any differences
- in diff, pass only options understood by cairo_png
- find out why in Cairo PDF non-dashed lines disappear if CAIRO_LINE_CAP_ROUND

View File

@ -121,7 +121,7 @@ static void cr_line(void *ctx, int sx, int sy, int ex, int ey,
int color, unsigned layer)
{
struct cro_ctx *cc = ctx;
static const double dashes[] = { 4, 2 };
static const double dashes[] = { 2, 4 };
cairo_new_path(cc->cr);
cairo_move_to(cc->cr, cx(cc, sx), cy(cc, sy));
@ -350,6 +350,7 @@ static void cr_png_end(void *ctx)
cairo_select_font_face(cc->cr, "Helvetica", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD);
cairo_set_line_width(cc->cr, 2);
cairo_set_line_cap(cc->cr, CAIRO_LINE_CAP_ROUND);
record_replay(&cc->record);
record_destroy(&cc->record);
@ -391,6 +392,8 @@ static void cr_pdf_end(void *ctx)
cairo_select_font_face(cc->cr, "Helvetica", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD);
cairo_set_line_width(cc->cr, 0.5 * cc->scale);
/* @@@ CAIRO_LINE_CAP_ROUND makes all non-dashed lines disappear */
cairo_set_line_cap(cc->cr, CAIRO_LINE_CAP_SQUARE);
for (i = 0; i != cc->n_sheets; i++) {
set_color(cc->cr, COLOR_WHITE);
@ -432,6 +435,7 @@ uint32_t *cro_img_end(void *ctx, int *w, int *h, int *stride)
cairo_select_font_face(cc->cr, "Helvetica", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD);
cairo_set_line_width(cc->cr, 2);
cairo_set_line_cap(cc->cr, CAIRO_LINE_CAP_ROUND);
record_replay(&cc->record);
record_destroy(&cc->record);