2016-07-31 03:50:02 +03:00
|
|
|
/*
|
|
|
|
* gfx.h - Generate graphical output for Eeschema items
|
|
|
|
*
|
|
|
|
* Written 2016 by Werner Almesberger
|
|
|
|
* Copyright 2016 by Werner Almesberger
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef GFX_H
|
|
|
|
#define GFX_H
|
|
|
|
|
2016-08-01 02:25:06 +03:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2016-07-31 03:50:02 +03:00
|
|
|
#include "text.h"
|
|
|
|
|
|
|
|
|
|
|
|
struct gfx_ops {
|
2016-08-01 03:52:35 +03:00
|
|
|
const char *name;
|
2016-07-31 03:55:23 +03:00
|
|
|
void (*line)(void *ctx, int sx, int sy, int ex, int ey,
|
|
|
|
int color, unsigned layer);
|
2016-07-31 03:50:02 +03:00
|
|
|
void (*rect)(void *ctx, int sx, int sy, int ex, int ey,
|
|
|
|
int color, int fill_color, unsigned layer);
|
2016-08-01 16:12:29 +03:00
|
|
|
void (*poly)(void *ctx,
|
|
|
|
int points, const int x[points], const int y[points],
|
2016-07-31 03:50:02 +03:00
|
|
|
int color, int fill_color, unsigned layer);
|
|
|
|
void (*circ)(void *ctx, int x, int y, int r,
|
|
|
|
int color, int fill_color, unsigned layer);
|
|
|
|
void (*arc)(void *ctx, int x, int y, int r, int sa, int ea,
|
|
|
|
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);
|
2016-08-01 16:12:29 +03:00
|
|
|
void (*tag)(void *ctx, const char *s,
|
|
|
|
int points, const int x[points], const int y[points]);
|
2016-07-31 09:28:08 +03:00
|
|
|
unsigned (*text_width)(void *ctx, const char *s, unsigned size);
|
2016-08-01 02:46:45 +03:00
|
|
|
void *(*init)(int argc, char *const *argv);
|
2016-08-01 02:25:06 +03:00
|
|
|
void (*new_sheet)(void *ctx);
|
2016-07-31 05:02:15 +03:00
|
|
|
void (*end)(void *ctx);
|
2016-07-31 03:50:02 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-08-01 20:38:36 +03:00
|
|
|
extern void *gfx_ctx;
|
|
|
|
|
|
|
|
|
2016-07-31 03:50:02 +03:00
|
|
|
/* wrappers */
|
|
|
|
|
2016-07-31 03:55:23 +03:00
|
|
|
void gfx_line(int sx, int sy, int ex, int ey, int color, unsigned layer);
|
2016-07-31 03:50:02 +03:00
|
|
|
void gfx_rect(int sx, int sy, int ex, int ey,
|
|
|
|
int color, int fill_color, unsigned layer);
|
2016-08-01 16:12:29 +03:00
|
|
|
void gfx_poly(int points, const int x[points], const int y[points],
|
2016-07-31 03:50:02 +03:00
|
|
|
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);
|
2016-08-01 16:12:29 +03:00
|
|
|
void gfx_tag(const char *s,
|
|
|
|
unsigned points, const int x[points], int const y[points]);
|
2016-07-31 09:28:08 +03:00
|
|
|
unsigned gfx_text_width(const char *s, unsigned size);
|
2016-07-31 03:50:02 +03:00
|
|
|
|
2016-07-31 05:02:15 +03:00
|
|
|
/* inititalization and termination */
|
2016-07-31 03:50:02 +03:00
|
|
|
|
2016-08-01 02:46:45 +03:00
|
|
|
void gfx_init(const struct gfx_ops *ops, int argc, char *const *argv);
|
2016-08-01 02:25:06 +03:00
|
|
|
void gfx_new_sheet(void);
|
|
|
|
bool gfx_multi_sheet(void);
|
2016-07-31 05:02:15 +03:00
|
|
|
void gfx_end(void);
|
2016-07-31 03:50:02 +03:00
|
|
|
|
|
|
|
#endif /* !GFX_H */
|