From 367c9cb514c9da766488b9bdb218a18e31cb7624 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 27 Mar 2016 01:38:28 +0000 Subject: Promote Stable (10.47) to Super Stable git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@2691 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/pamtosvg/curve.h | 46 +++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-) (limited to 'converter/other/pamtosvg/curve.h') diff --git a/converter/other/pamtosvg/curve.h b/converter/other/pamtosvg/curve.h index ee046620..ba5f1833 100644 --- a/converter/other/pamtosvg/curve.h +++ b/converter/other/pamtosvg/curve.h @@ -20,19 +20,27 @@ typedef struct { -struct curve { +typedef struct curve { /*---------------------------------------------------------------------------- An ordered list of contiguous points in the raster, with no corners in it. I.e. something that could reasonably be fit to a spline. -----------------------------------------------------------------------------*/ point_type * point_list; + /* Array of the points in the curve. Malloc'ed. Size is 'length'. + if 'length' is zero, this is meaningless and no memory is + allocated. + */ unsigned length; + /* Number of points in the curve */ bool cyclic; - vector_type * start_tangent; - vector_type * end_tangent; + + /* 'previous' and 'next' links are for the doubly linked list which is + a chain of all curves in an outline. The chain is a cycle for a + closed outline and linear for an open outline. + */ struct curve * previous; struct curve * next; -}; +} curve; typedef struct curve * curve_type; @@ -61,9 +69,6 @@ typedef struct curve * curve_type; ? CURVE_CYCLIC (c) ? (signed int) CURVE_LENGTH (c) + (signed int) (n) - 1 : -1\ : (signed int) (n) - 1) -/* The tangents at the endpoints are computed using the neighboring curves. */ -#define CURVE_START_TANGENT(c) ((c)->start_tangent) -#define CURVE_END_TANGENT(c) ((c)->end_tangent) #define PREVIOUS_CURVE(c) ((c)->previous) #define NEXT_CURVE(c) ((c)->next) @@ -74,17 +79,23 @@ extern curve_type new_curve (void); /* Return a curve the same as C, except without any points. */ extern curve_type copy_most_of_curve (curve_type c); -/* Free the memory C uses. */ -extern void free_curve (curve_type c); +void +move_curve(curve * const dstP, + curve * const srcP); + +void +free_curve(curve * const curveP); + +/* Like `append_pixel', for a point in real coordinates. */ +void +append_point(curve_type const curve, + float_coord const coord); /* Append the point P to the end of C's list. */ void append_pixel(curve_type const c, pm_pixelcoord const p); -/* Like `append_pixel', for a point in real coordinates. */ -extern void append_point (curve_type const c, float_coord const p); - /* Write some or all, respectively, of the curve C in human-readable form to the log file, if logging is enabled. */ extern void log_curve (curve_type c, bool print_t); @@ -99,11 +110,12 @@ typedef struct { /*---------------------------------------------------------------------------- An ordered list of contiguous curves of a particular color. -----------------------------------------------------------------------------*/ - curve_type * data; - unsigned length; - bool clockwise; - pixel color; - bool open; + curve ** data; + /* data[i] is the handle of the ith curve in the list */ + unsigned length; + bool clockwise; + pixel color; + bool open; /* The curve list does not form a closed shape; i.e. the last curve doesn't end where the first one starts. */ -- cgit 1.4.1