summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-09-05 02:44:52 -0300
committerWerner Almesberger <werner@almesberger.net>2016-09-05 02:44:52 -0300
commit1af1d9634aca7ea335579d81a21bfb7378a7ef1f (patch)
tree9bdff1e54e57ab4b75594020ab35d576108745c7
parente90df0da664b3e256761e910573bbd7d1978ef91 (diff)
downloadeeshow-1af1d9634aca7ea335579d81a21bfb7378a7ef1f.tar.gz
eeshow-1af1d9634aca7ea335579d81a21bfb7378a7ef1f.tar.bz2
eeshow-1af1d9634aca7ea335579d81a21bfb7378a7ef1f.zip
add EPS (through Cairo) support
-rw-r--r--README2
-rw-r--r--gfx/cro.c35
-rw-r--r--gfx/cro.h1
-rw-r--r--main/eeplot.c6
-rw-r--r--web/index.html2
5 files changed, 40 insertions, 6 deletions
diff --git a/README b/README
index ef9d168..c76f480 100644
--- a/README
+++ b/README
@@ -2,7 +2,7 @@ eeshow - Eeschema schematics renderer and viewer
================================================
Eeshow is a collection of programs to render schematics made by KiCad
-Eeschema to FIG, PDF, Postscript, or PNG, and to generate graphical
+Eeschema to FIG, PDF, Postscript, EPS, or PNG, and to generate graphical
differences between different versions of schematics sheets. It can
work in plain files but it can also retrieve design files directly
from a git repository. Furthermore, eeshow has an interactive mode for
diff --git a/gfx/cro.c b/gfx/cro.c
index dc63c6d..583d6dd 100644
--- a/gfx/cro.c
+++ b/gfx/cro.c
@@ -746,9 +746,8 @@ static void cr_ps_new_sheet(void *ctx)
}
-static int cr_ps_end(void *ctx)
+static int ps_end(struct cro_ctx *cc, int eps)
{
- struct cro_ctx *cc = ctx;
int w, h;
unsigned i;
@@ -764,6 +763,8 @@ static int cr_ps_end(void *ctx)
NULL, w, h);
cc->cr = cairo_create(cc->s);
+ cairo_ps_surface_set_eps(cc->s, eps);
+
cairo_set_tolerance(cc->cr, 72 / 10000.0); // 0.1 mil
cairo_scale(cc->cr, 1.0 / 16.0, 1.0 / 16);
setup_font(cc);
@@ -796,6 +797,18 @@ static int cr_ps_end(void *ctx)
}
+static int cr_ps_end(void *ctx)
+{
+ return ps_end(ctx, 0);
+}
+
+
+static int cr_eps_end(void *ctx)
+{
+ return ps_end(ctx, 1);
+}
+
+
/* ----- PNG (auto-sizing, using redraw) ----------------------------------- */
@@ -1071,3 +1084,21 @@ const struct gfx_ops cro_ps_ops = {
.new_sheet = cr_ps_new_sheet,
.end = cr_ps_end,
};
+
+static const char *const cro_eps_ext[] = { "eps" };
+
+const struct gfx_ops cro_eps_ops = {
+ .ext = cro_eps_ext,
+ .n_ext = ARRAY_ELEMENTS(cro_eps_ext),
+ .opts = "o:s:T",
+
+ .line = record_line,
+ .poly = record_poly,
+ .circ = record_circ,
+ .arc = record_arc,
+ .text = record_text,
+ .text_width = cr_text_width,
+ .init = cr_ps_init,
+ .args = cr_ps_args,
+ .end = cr_eps_end,
+};
diff --git a/gfx/cro.h b/gfx/cro.h
index 40b8f11..25725f1 100644
--- a/gfx/cro.h
+++ b/gfx/cro.h
@@ -31,6 +31,7 @@ extern bool disable_overline;
extern const struct gfx_ops cro_png_ops;
extern const struct gfx_ops cro_pdf_ops;
extern const struct gfx_ops cro_ps_ops;
+extern const struct gfx_ops cro_eps_ops;
#define cro_img_ops cro_png_ops /* just don't call cro_img_ops.end */
#define cro_canvas_ops cro_png_ops /* just don't call cro_canvas_ops.end */
diff --git a/main/eeplot.c b/main/eeplot.c
index 3721508..46de154 100644
--- a/main/eeplot.c
+++ b/main/eeplot.c
@@ -41,6 +41,7 @@ static struct gfx_ops const *ops_list[] = {
&cro_png_ops,
&cro_pdf_ops,
&cro_ps_ops,
+ &cro_eps_ops,
};
@@ -103,7 +104,8 @@ void usage(const char *name)
" -e show extra information (e.g., pin types)\n"
" -o [type:]output_file\n"
" output file. - for standard output. File type is derived from\n"
-" extension and can be overridden with type: prefix (fig, png, pdf).\n"
+" extension and can be overridden with type: prefix (fig, png, pdf,\n"
+" ps, eps).\n"
" -v increase verbosity of diagnostic output\n"
" -V print revision (version) number and exit\n"
" gdb run eeshow under gdb\n"
@@ -114,7 +116,7 @@ void usage(const char *name)
" -t template.fig merge this file with generated output\n"
" -D var=value substitute \"<var>\" with \"value\" in template\n"
"\n"
-"PNG and Postscript files:\n"
+"PNG, Postscript, and EPS files:\n"
" [-s scale]\n"
"\n"
" -s scale scale by indicated factor (default: 1.0)\n"
diff --git a/web/index.html b/web/index.html
index fc5ebe8..169e6c4 100644
--- a/web/index.html
+++ b/web/index.html
@@ -19,7 +19,7 @@ Eeshow is a collection of programs that read schematics made by
<A href="http://kicad-pcb.org/discover/eeschema/">Eeschema</A>
and can be used as
interactive viewer, or as a command-line tool to convert schematics
-to PNG, PDF, Postscript, or FIG.
+to PNG, PDF, Postscript, EPS, or FIG.
<BR>
Eeshow can show the differences between two versions of schematics sheets
and it can retrieve files directly from a