Commit f8288c6d authored by Raph Levien's avatar Raph Levien

Fixed some little bugs. Starting to check in the stroke outline code.

parent 79cc7908
Sun Dec 6 22:15:12 1998 Raph Levien <raph@gimp.org>
* art_svp_wind.[ch], art_svp_vpath_stroke.[ch]: Added, but it
doesn't work yet. These will do stroke outline and basic
vector ops like union, intersect, etc.
* art_svp_render_aa.c: Added a simple speedup based on bbox
culling. I will want to do more speedups, but none of this is
necessary for the freeze.
* art_svp_vpath.c: Fixed some bugs in the art_svp_from_vpath in
cases where there is more than one subpath.
* art_vpath.h:
* art_vpath.c (art_vpath_perturb): Added this function. This will
help cheat as long as the basic vector ops have numerical
stability problems.
Fri Dec 4 18:00:38 1998 Raph Levien <raph@gimp.org>
* art_svp_render_aa.c (art_svp_render_aa): Changed the api
......
......@@ -19,6 +19,8 @@ libart_lgpl_la_SOURCES = \
art_svp.c \
art_svp_render_aa.c \
art_svp_vpath.c \
art_svp_wind.c \
art_svp_wind.h \
art_uta.c \
art_uta_ops.c \
art_uta_rect.c \
......
......@@ -99,9 +99,12 @@ art_svp_render_step_compare (const void *s1, const void *s2)
Numerical stability: pretty good, although probably not
bulletproof.
Speed: Needs more aggressive culling of bounding boxes.
Can probably speed up the [x0,x1) clipping of step values.
Can do more of the step calculation in fixed point.
Speed: Needs more aggressive culling of bounding boxes. Can
probably speed up the [x0,x1) clipping of step values. Can do more
of the step calculation in fixed point.
Precision: No known problems, although it should be tested
thoroughly, especially for symmetry.
*/
......
......@@ -26,6 +26,7 @@
#include "art_vpath.h"
#include "art_svp.h"
#include "art_svp_vpath.h"
static int
art_svp_seg_compare (const void *s1, const void *s2);
......@@ -91,9 +92,15 @@ art_svp_from_vpath (ArtVpath *vpath)
if (dir < 0)
reverse_points (points, n_points);
svp->segs[n_segs].points = points;
svp->segs[n_segs].bbox.x0 = x_min;
svp->segs[n_segs].bbox.x1 = x_max;
svp->segs[n_segs].bbox.y0 = points[0].y;
svp->segs[n_segs].bbox.y1 = points[n_points - 1].y;
n_segs++;
points = NULL;
}
else if (points == NULL)
if (points == NULL)
{
n_points_max = 4;
points = art_new (ArtPoint, n_points_max);
......
This diff is collapsed.
/* Libart_LGPL - library of basic graphic primitives
* Copyright (C) 1998 Raph Levien
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __ART_SVP_VPATH_H__
#define __ART_SVP_VPATH_H__
/* Sort vector paths into sorted vector paths. */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef enum {
ART_PATH_STROKE_JOIN_MITER,
ART_PATH_STROKE_JOIN_ROUND,
ART_PATH_STROKE_JOIN_BEVEL
} ArtPathStrokeJoinType;
typedef enum {
ART_PATH_STROKE_CAP_BUTT,
ART_PATH_STROKE_CAP_ROUND,
ART_PATH_STROKE_CAP_SQUARE
} ArtPathStrokeCapType;
ArtSVP *
art_svp_vpath_stroke (ArtVpath *vpath,
ArtPathStrokeJoinType join,
ArtPathStrokeCapType cap,
double line_width,
double miter_limit,
double flatness);
/* This version may have winding numbers exceeding 1. */
ArtVpath *
art_svp_vpath_stroke_raw (ArtVpath *vpath,
ArtPathStrokeJoinType join,
ArtPathStrokeCapType cap,
double line_width,
double miter_limit,
double flatness);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __ART_SVP_VPATH_H__ */
This diff is collapsed.
/* Libart_LGPL - library of basic graphic primitives
* Copyright (C) 1998 Raph Levien
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __ART_SVP_WIND_H__
#define __ART_SVP_WIND_H__
/* Primitive intersection and winding number operations on sorted
vector paths. */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef enum {
ART_WIND_RULE_NONZERO,
ART_WIND_RULE_INTERSECT,
ART_WIND_RULE_ODDEVEN,
ART_WIND_RULE_POSITIVE
} ArtWindRule;
ArtSVP *
art_svp_uncross (ArtSVP *vp);
ArtSVP *
art_svp_rewind_uncrossed (ArtSVP *vp, ArtWindRule rule);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __ART_SVP_WIND_H__ */
......@@ -20,6 +20,7 @@
/* Basic constructors and operations for vector paths */
#include <math.h>
#include <stdlib.h>
#include "art_misc.h"
......@@ -131,3 +132,31 @@ art_vpath_bbox_irect (const ArtVpath *vec, ArtIRect *irect)
art_drect_to_irect (irect, &drect);
}
#define EPSILON 1e-6
/* Perturb each of the points by a small random amount. This is helpful
for cheating in cases when algorithms haven't attained numerical
stability yet. */
ArtVpath *
art_vpath_perturb (ArtVpath *src)
{
int i;
int size;
ArtVpath *new;
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;
new[i].x = src[i].x + (EPSILON * rand ()) / RAND_MAX - EPSILON * 0.5;
new[i].y = src[i].y + (EPSILON * rand ()) / RAND_MAX - EPSILON * 0.5;
}
new[i].code = ART_END;
return new;
}
......@@ -56,6 +56,9 @@ art_vpath_bbox_drect (const ArtVpath *vec, ArtDRect *drect);
void
art_vpath_bbox_irect (const ArtVpath *vec, ArtIRect *irect);
ArtVpath *
art_vpath_perturb (ArtVpath *src);
#ifdef __cplusplus
}
#endif /* __cplusplus */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment