diff options
Diffstat (limited to 'libart_lgpl/art_vpath.c')
-rw-r--r-- | libart_lgpl/art_vpath.c | 126 |
1 files changed, 0 insertions, 126 deletions
diff --git a/libart_lgpl/art_vpath.c b/libart_lgpl/art_vpath.c index fa7b903d11..5152188b1b 100644 --- a/libart_lgpl/art_vpath.c +++ b/libart_lgpl/art_vpath.c @@ -63,77 +63,6 @@ art_vpath_add_point (ArtVpath **p_vpath, int *pn_points, int *pn_points_max, #define CIRCLE_STEPS 128 /** - * art_vpath_new_circle: Create a new circle. - * @x: X coordinate of center. - * @y: Y coordinate of center. - * @r: radius. - * - * Creates a new polygon closely approximating a circle with center - * (@x, @y) and radius @r. Currently, the number of points used in the - * approximation is fixed, but that will probably change. - * - * Return value: The newly created #ArtVpath. - **/ -ArtVpath * -art_vpath_new_circle (double x, double y, double r) -{ - int i; - ArtVpath *vec; - double theta; - - vec = art_new (ArtVpath, CIRCLE_STEPS + 2); - - for (i = 0; i < CIRCLE_STEPS + 1; i++) - { - vec[i].code = i ? ART_LINETO : ART_MOVETO; - theta = (i & (CIRCLE_STEPS - 1)) * (M_PI * 2.0 / CIRCLE_STEPS); - vec[i].x = x + r * cos (theta); - vec[i].y = y - r * sin (theta); - } - vec[i].code = ART_END; - - return vec; -} - -/** - * art_vpath_affine_transform: Affine transform a vpath. - * @src: Source vpath to transform. - * @matrix: Affine transform. - * - * Computes the affine transform of the vpath, using @matrix as the - * transform. @matrix is stored in the same format as PostScript, ie. - * x' = @matrix[0] * x + @matrix[2] * y + @matrix[4] - * y' = @matrix[1] * x + @matrix[3] * y + @matrix[5] - * - * Return value: the newly allocated vpath resulting from the transform. -**/ -ArtVpath * -art_vpath_affine_transform (const ArtVpath *src, const double matrix[6]) -{ - int i; - int size; - ArtVpath *new; - double x, y; - - for (i = 0; src[i].code != ART_END; i++); - size = i; - - new = art_new (ArtVpath, size + 1); - - for (i = 0; i < size; i++) - { - new[i].code = src[i].code; - x = src[i].x; - y = src[i].y; - new[i].x = matrix[0] * x + matrix[2] * y + matrix[4]; - new[i].y = matrix[1] * x + matrix[3] * y + matrix[5]; - } - new[i].code = ART_END; - - return new; -} - -/** * art_vpath_bbox_drect: Determine bounding box of vpath. * @vec: Source vpath. * @drect: Where to store bounding box. @@ -184,58 +113,3 @@ art_vpath_bbox_irect (const ArtVpath *vec, ArtIRect *irect) art_drect_to_irect (irect, &drect); } -#define PERTURBATION 2e-3 - -/** - * art_vpath_perturb: Perturb each point in vpath by small random amount. - * @src: Source vpath. - * - * Perturbs each of the points by a small random amount. This is - * helpful for cheating in cases when algorithms haven't attained - * numerical stability yet. - * - * Return value: Newly allocated vpath containing perturbed @src. - **/ -ArtVpath * -art_vpath_perturb (ArtVpath *src) -{ - int i; - int size; - ArtVpath *new; - double x, y; - double x_start, y_start; - int open; - - for (i = 0; src[i].code != ART_END; i++); - size = i; - - new = art_new (ArtVpath, size + 1); - - x_start = 0; - y_start = 0; - open = 0; - for (i = 0; i < size; i++) - { - new[i].code = src[i].code; - x = src[i].x + (PERTURBATION * rand ()) / RAND_MAX - PERTURBATION * 0.5; - y = src[i].y + (PERTURBATION * rand ()) / RAND_MAX - PERTURBATION * 0.5; - if (src[i].code == ART_MOVETO) - { - x_start = x; - y_start = y; - open = 0; - } - else if (src[i].code == ART_MOVETO_OPEN) - open = 1; - if (!open && (i + 1 == size || src[i + 1].code != ART_LINETO)) - { - x = x_start; - y = y_start; - } - new[i].x = x; - new[i].y = y; - } - new[i].code = ART_END; - - return new; -} |