diff --git a/sch2fig/cairo.c b/sch2fig/cairo.c index aeb080d..42384ce 100644 --- a/sch2fig/cairo.c +++ b/sch2fig/cairo.c @@ -116,7 +116,8 @@ static void paint(cairo_t *cr, int color, int fill_color) /* ----- General items ----------------------------------------------------- */ -static void cr_poly(void *ctx, int points, int x[points], int y[points], +static void cr_poly(void *ctx, + int points, const int x[points], const int y[points], int color, int fill_color, unsigned layer) { struct cairo_ctx *cc = ctx; diff --git a/sch2fig/fig.c b/sch2fig/fig.c index ef1e90c..59b5c31 100644 --- a/sch2fig/fig.c +++ b/sch2fig/fig.c @@ -84,7 +84,8 @@ static void fig_rect(void *ctx, int sx, int sy, int ex, int ey, } -static void fig_poly(void *ctx, int points, int x[points], int y[points], +static void fig_poly(void *ctx, + int points, const int x[points], const int y[points], int color, int fill_color, unsigned layer) { int i; @@ -152,6 +153,14 @@ static void fig_arc(void *ctx, int x, int y, int r, int sa, int ea, } +static void fig_tag(void *ctx, const char *s, + int points, const int x[points], const int y[points]) +{ + printf("# href=\"%s\" alt=\"\"\n", s); + fig_poly(ctx, points, x, y, COLOR_NONE, COLOR_NONE, 999); +} + + static void fig_text(void *ctx, int x, int y, const char *s, unsigned size, enum text_align align, int rot, unsigned color, unsigned layer) { @@ -275,6 +284,7 @@ const struct gfx_ops fig_ops = { .circ = fig_circ, .arc = fig_arc, .text = fig_text, + .tag = fig_tag, .text_width = fig_text_width, .init = fig_init, }; diff --git a/sch2fig/gfx.c b/sch2fig/gfx.c index 6dc90e8..7234fe2 100644 --- a/sch2fig/gfx.c +++ b/sch2fig/gfx.c @@ -52,7 +52,7 @@ void gfx_rect(int sx, int sy, int ex, int ey, } -void gfx_poly(int points, int x[points], int y[points], +void gfx_poly(int points, const int x[points], const int y[points], int color, int fill_color, unsigned layer) { gfx_ops->poly(gfx_ctx, points, x, y, color, fill_color, layer); @@ -79,6 +79,14 @@ void gfx_text(int x, int y, const char *s, unsigned size, } +void gfx_tag(const char *s, + unsigned points, const int x[points], int const y[points]) +{ + if (gfx_ops->tag) + gfx_ops->tag(gfx_ctx, s, points, x, y); +} + + unsigned gfx_text_width(const char *s, unsigned size) { return gfx_ops->text_width(gfx_ctx, s, size); diff --git a/sch2fig/gfx.h b/sch2fig/gfx.h index bdbb124..4500c9e 100644 --- a/sch2fig/gfx.h +++ b/sch2fig/gfx.h @@ -25,7 +25,8 @@ struct gfx_ops { int color, unsigned layer); void (*rect)(void *ctx, int sx, int sy, int ex, int ey, int color, int fill_color, unsigned layer); - void (*poly)(void *ctx, int points, int x[points], int y[points], + void (*poly)(void *ctx, + int points, const int x[points], const int y[points], int color, int fill_color, unsigned layer); void (*circ)(void *ctx, int x, int y, int r, int color, int fill_color, unsigned layer); @@ -33,6 +34,8 @@ struct gfx_ops { int color, int fill_color, unsigned layer); void (*text)(void *ctx, int x, int y, const char *s, unsigned size, enum text_align align, int rot, unsigned color, unsigned layer); + void (*tag)(void *ctx, const char *s, + int points, const int x[points], const int y[points]); unsigned (*text_width)(void *ctx, const char *s, unsigned size); void *(*init)(int argc, char *const *argv); void (*new_sheet)(void *ctx); @@ -45,13 +48,15 @@ struct gfx_ops { void gfx_line(int sx, int sy, int ex, int ey, int color, unsigned layer); void gfx_rect(int sx, int sy, int ex, int ey, int color, int fill_color, unsigned layer); -void gfx_poly(int points, int x[points], int y[points], +void gfx_poly(int points, const int x[points], const int y[points], int color, int fill_color, unsigned layer); void gfx_circ(int x, int y, int r, int color, int fill_color, unsigned layer); void gfx_arc(int x, int y, int r, int sa, int ea, int color, int fill_color, unsigned layer); void gfx_text(int x, int y, const char *s, unsigned size, enum text_align align, int rot, unsigned color, unsigned layer); +void gfx_tag(const char *s, + unsigned points, const int x[points], int const y[points]); unsigned gfx_text_width(const char *s, unsigned size); /* inititalization and termination */ diff --git a/sch2fig/layer.c b/sch2fig/layer.c index 7b3eb6c..598dbbb 100644 --- a/sch2fig/layer.c +++ b/sch2fig/layer.c @@ -153,7 +153,8 @@ void layer_rect(void *ctx, int sx, int sy, int ex, int ey, } -void layer_poly(void *ctx, int points, int x[points], int y[points], +void layer_poly(void *ctx, + int points, const int x[points], const int y[points], int color, int fill_color, unsigned layer) { struct layer *lc = ctx; diff --git a/sch2fig/layer.h b/sch2fig/layer.h index e7caae4..d265111 100644 --- a/sch2fig/layer.h +++ b/sch2fig/layer.h @@ -39,7 +39,7 @@ void layer_line(void *ctx, int sx, int sy, int ex, int ey, int color, unsigned layer); void layer_rect(void *ctx, int sx, int sy, int ex, int ey, int color, int fill_color, unsigned layer); -void layer_poly(void *ctx, int points, int x[points], int y[points], +void layer_poly(void *ctx, int points, const int x[points], const int y[points], int color, int fill_color, unsigned layer); void layer_circ(void *ctx, int x, int y, int r, int color, int fill_color, unsigned layer);