diff --git a/sch2fig/gfx.c b/sch2fig/gfx.c index 27dab66..f0b4c23 100644 --- a/sch2fig/gfx.c +++ b/sch2fig/gfx.c @@ -74,3 +74,10 @@ void gfx_init(const struct gfx_ops *ops, gfx_ops = ops; gfx_ctx = ops->init(template, n_vars, vars); } + + +void gfx_end(void) +{ + if (gfx_ops->end) + gfx_ops->end(gfx_ctx); +} diff --git a/sch2fig/gfx.h b/sch2fig/gfx.h index dce5383..938f57b 100644 --- a/sch2fig/gfx.h +++ b/sch2fig/gfx.h @@ -31,6 +31,7 @@ struct gfx_ops { void (*text)(void *ctx, int x, int y, const char *s, unsigned size, enum text_align align, int rot, unsigned color, unsigned layer); void *(*init)(const char *template, int n_vars, const char **vars); + void (*end)(void *ctx); }; @@ -47,9 +48,10 @@ void gfx_arc(int x, int y, int r, int sa, int ea, void gfx_text(int x, int y, const char *s, unsigned size, enum text_align align, int rot, unsigned color, unsigned layer); -/* inititalization */ +/* inititalization and termination */ void gfx_init(const struct gfx_ops *ops, const char *template, int n_vars, const char **vars); +void gfx_end(void); #endif /* !GFX_H */ diff --git a/sch2fig/main.c b/sch2fig/main.c index 82366e9..2d96c9f 100644 --- a/sch2fig/main.c +++ b/sch2fig/main.c @@ -107,4 +107,5 @@ int main(int argc, char **argv) read_file(argv[arg], &ctx, do_lib_parse); } } + gfx_end(); }