From 2188e9954fceda58e4ec8e1ca3e2b780aa68ba87 Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Wed, 17 Jun 2009 00:22:10 +0200 Subject: [PATCH] [demo] Updated adg-demo to use the new AdgPath APIs Using adg_path_dup_cpml_path() and some CPML transformations to reverse the shape, reflect it and readd to AdgPath. --- demo/adg-demo.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/demo/adg-demo.c b/demo/adg-demo.c index fc296271..d8fcd08c 100644 --- a/demo/adg-demo.c +++ b/demo/adg-demo.c @@ -251,6 +251,9 @@ drawing_path(const DrawingData *data) { AdgPath *path; double x, y; + cairo_path_t *cairo_path; + CpmlSegment segment; + cairo_matrix_t matrix; path = (AdgPath *) adg_path_new(); @@ -278,20 +281,21 @@ drawing_path(const DrawingData *data) adg_path_line_to(path, data->A - data->LD7, data->D7 / 2); adg_path_line_to(path, data->A, data->D7 / 2); -#if 0 /* Build the shape by reflecting the current path, reversing the order * and joining the result to the current path */ - path = cairo_copy_path(cr); - cpml_segment_from_cairo(&segment, path); + cairo_path = adg_path_dup_cpml_path(path); + + cpml_segment_from_cairo(&segment, cairo_path); cpml_segment_reverse(&segment); adg_matrix_init_reflection(&matrix, 0); cpml_segment_transform(&segment, &matrix); - path->data[0].header.type = CAIRO_PATH_LINE_TO; - cairo_append_path(cr, path); - cairo_path_destroy(path); - cairo_close_path(cr); -#endif + cairo_path->data[0].header.type = CAIRO_PATH_LINE_TO; + + adg_path_append_cairo_path(path, cairo_path); + g_free(cairo_path); + + adg_path_close(path); return path; } -- 2.11.4.GIT