Root/eeshow/gfx/gfx.h

1/*
2 * gfx/gfx.h - Generate graphical output for Eeschema items
3 *
4 * Written 2016 by Werner Almesberger
5 * Copyright 2016 by Werner Almesberger
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13
14#ifndef GFX_GFX_H
15#define GFX_GFX_H
16
17#include <stdbool.h>
18
19#include "gfx/text.h"
20
21
22struct gfx_ops {
23    const char *name;
24    void (*line)(void *ctx, int sx, int sy, int ex, int ey,
25        int color, unsigned layer);
26    void (*rect)(void *ctx, int sx, int sy, int ex, int ey,
27        int color, int fill_color, unsigned layer);
28    void (*poly)(void *ctx,
29        int points, const int x[points], const int y[points],
30        int color, int fill_color, unsigned layer);
31    void (*circ)(void *ctx, int x, int y, int r,
32        int color, int fill_color, unsigned layer);
33    void (*arc)(void *ctx, int x, int y, int r, int sa, int ea,
34        int color, int fill_color, unsigned layer);
35    void (*text)(void *ctx, int x, int y, const char *s, unsigned size,
36        enum text_align align, int rot, unsigned color, unsigned layer);
37    void (*tag)(void *ctx, const char *s,
38        int points, const int x[points], const int y[points]);
39    unsigned (*text_width)(void *ctx, const char *s, unsigned size);
40    void *(*init)(int argc, char *const *argv);
41    void (*sheet_name)(void *ctx, const char *name);
42    void (*new_sheet)(void *ctx);
43    void (*end)(void *ctx);
44};
45
46
47extern void *gfx_ctx;
48
49
50/* wrappers */
51
52void gfx_line(int sx, int sy, int ex, int ey, int color, unsigned layer);
53void gfx_rect(int sx, int sy, int ex, int ey,
54    int color, int fill_color, unsigned layer);
55void gfx_poly(int points, const int x[points], const int y[points],
56    int color, int fill_color, unsigned layer);
57void gfx_circ(int x, int y, int r, int color, int fill_color, unsigned layer);
58void gfx_arc(int x, int y, int r, int sa, int ea,
59    int color, int fill_color, unsigned layer);
60void gfx_text(int x, int y, const char *s, unsigned size,
61    enum text_align align, int rot, unsigned color, unsigned layer);
62void gfx_tag(const char *s,
63    unsigned points, const int x[points], int const y[points]);
64unsigned gfx_text_width(const char *s, unsigned size);
65
66/* inititalization and termination */
67
68void gfx_init(const struct gfx_ops *ops, int argc, char *const *argv);
69void gfx_sheet_name(const char *name);
70void gfx_new_sheet(void);
71bool gfx_multi_sheet(void);
72void gfx_end(void);
73
74#endif /* !GFX_GFX_H */
75

Archive Download this file

Branches:
master



interactive