summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-09-05 05:44:52 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-09-05 05:44:52 (GMT)
commit1af1d9634aca7ea335579d81a21bfb7378a7ef1f (patch)
tree9bdff1e54e57ab4b75594020ab35d576108745c7 /gfx
parente90df0da664b3e256761e910573bbd7d1978ef91 (diff)
downloadeeshow-1af1d9634aca7ea335579d81a21bfb7378a7ef1f.zip
eeshow-1af1d9634aca7ea335579d81a21bfb7378a7ef1f.tar.gz
eeshow-1af1d9634aca7ea335579d81a21bfb7378a7ef1f.tar.bz2
add EPS (through Cairo) support
Diffstat (limited to 'gfx')
-rw-r--r--gfx/cro.c35
-rw-r--r--gfx/cro.h1
2 files changed, 34 insertions, 2 deletions
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 */