=?utf-8?q?=5Blibgxps=5D_Implement_Quadratic_B=C3=A9zier_curve?=
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgxps] Implement Quadratic BÃzier curve
- Date: Sun, 6 Nov 2011 16:04:40 +0000 (UTC)
commit e2fee33fe68deffe5592824a4c1c33b195347caf
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Sun Nov 6 17:00:10 2011 +0100
Implement Quadratic BÃzier curve
TODO | 1 -
libgxps/gxps-page.c | 14 +++++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/TODO b/TODO
index 8ce338c..0b59275 100644
--- a/TODO
+++ b/TODO
@@ -32,7 +32,6 @@ Rendering
+ Opacity
+ Opacity Masks
- Visual Brush
-- Quadratic BÃzier curve
- Smooth Cubic BÃzier curve
- Elliptical Arc
- Radial gradients when center != origin
diff --git a/libgxps/gxps-page.c b/libgxps/gxps-page.c
index a9ea683..9acc579 100644
--- a/libgxps/gxps-page.c
+++ b/libgxps/gxps-page.c
@@ -704,6 +704,7 @@ path_data_parse (const gchar *data,
case 'Q':
while (token.type == PD_TOKEN_NUMBER) {
gdouble x1, y1, x2, y2;
+ gdouble x, y;
if (!path_data_get_point (&token, &x1, &y1, error))
return FALSE;
@@ -715,7 +716,18 @@ path_data_parse (const gchar *data,
GXPS_DEBUG (g_message ("%s (%f, %f, %f, %f)", is_rel ? "rel_quad_curve_to" : "quad_curve_to",
x1, y1, x2, y2));
- GXPS_DEBUG (g_debug ("Unsupported command in path: %c", command));
+
+ cairo_get_current_point (cr, &x, &y);
+ x1 += is_rel ? x : 0;
+ y1 += is_rel ? y : 0;
+ x2 += is_rel ? x : 0;
+ y2 += is_rel ? y : 0;
+ cairo_curve_to (cr,
+ 2.0 / 3.0 * x1 + 1.0 / 3.0 * x,
+ 2.0 / 3.0 * y1 + 1.0 / 3.0 * y,
+ 2.0 / 3.0 * x1 + 1.0 / 3.0 * x2,
+ 2.0 / 3.0 * y1 + 1.0 / 3.0 * y2,
+ x2, y2);
if (!path_data_iter_next (&token, error))
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]