From e0db864fa0f2b31e00c46c29d74e47c4a29b3001 Mon Sep 17 00:00:00 2001 From: kramm Date: Sat, 30 Apr 2005 12:36:19 +0000 Subject: [PATCH] new function gfxdraw_conicTo() --- lib/gfxtools.c | 10 ++++++++++ lib/gfxtools.h | 1 + 2 files changed, 11 insertions(+) diff --git a/lib/gfxtools.c b/lib/gfxtools.c index 296bea1..2a6409b 100644 --- a/lib/gfxtools.c +++ b/lib/gfxtools.c @@ -454,6 +454,16 @@ static int approximate3(const cspline_t*s, qspline_t*q, int size, double quality return num; } +void gfxdraw_conicTo(gfxdrawer_t*draw, double cx, double cy, double tox, double toy) +{ + double c1x = (draw->x + 2 * cx) / 3; + double c1y = (draw->y + 2 * cy) / 3; + double c2x = (2 * cx + tox) / 3; + double c2y = (2 * cy + toy) / 3; + gfxdraw_cubicTo(draw, c1x, c1y, c2x, c2y, tox, toy); +} + + void gfxdraw_cubicTo(gfxdrawer_t*draw, double c1x, double c1y, double c2x, double c2y, double x, double y) { qspline_t q[128]; diff --git a/lib/gfxtools.h b/lib/gfxtools.h index 1e9bf70..0058397 100644 --- a/lib/gfxtools.h +++ b/lib/gfxtools.h @@ -55,6 +55,7 @@ void gfxline_dump(gfxline_t*l, FILE*fi, char*prefix); void gfxline_free(gfxline_t*l); void gfxdraw_cubicTo(gfxdrawer_t*draw, double c1x, double c1y, double c2x, double c2y, double x, double y); +void gfxdraw_conicTo(gfxdrawer_t*draw, double cx, double cy, double tox, double toy); gfxbbox_t gfxline_getbbox(gfxline_t*line); gfxbbox_t gfxbbox_expand_to_point(gfxbbox_t box, gfxcoord_t x, gfxcoord_t y); -- 1.7.10.4