Commit f0838c6d authored by Raph Levien's avatar Raph Levien

Added API documentation.

parent 7484e518
2000-01-09 Raph Levien <raph@gimp.org>
art_rgb_pixbuf_affine.c, art_rgb_rgba_affine.c, art_rgb_svp.c,
art_svp.c, art_svp_ops.c, art_svp_point.c, art_svp_render_aa.c,
art_svp_vpath.c, art_svp_vpath_stroke.c, art_svp_wind.c,
art_uta.c, art_uta_ops.c, art_uta_rect.c, art_uta_svp.c,
art_uta_vpath.c, art_vpath.c, art_vpath_bpath.c, art_vpath_dash.c,
art_vpath_svp.c: Added API documentation.
Fri Sep 24 17:53:21 1999 Raph Levien <raph@acm.org>
* art_svp_render_aa.c (art_svp_render_insert_active): Avoid
......
......@@ -32,7 +32,33 @@
/* Composite the source image over the destination image, applying the
affine transform. */
/**
* art_rgb_pixbuf_affine: Affine transform source RGB pixbuf and composite.
* @dst: Destination image RGB buffer.
* @x0: Left coordinate of destination rectangle.
* @y0: Top coordinate of destination rectangle.
* @x1: Right coordinate of destination rectangle.
* @y1: Bottom coordinate of destination rectangle.
* @dst_rowstride: Rowstride of @dst buffer.
* @pixbuf: source image pixbuf.
* @affine: Affine transform.
* @level: Filter level.
* @alphagamma: #ArtAlphaGamma for gamma-correcting the compositing.
*
* Affine transform the source image stored in @src, compositing over
* the area of destination image @dst specified by the rectangle
* (@x0, @y0) - (@x1, @y1). As usual in libart, the left and top edges
* of this rectangle are included, and the right and bottom edges are
* excluded.
*
* The @alphagamma parameter specifies that the alpha compositing be
* done in a gamma-corrected color space. In the current
* implementation, it is ignored.
*
* The @level parameter specifies the speed/quality tradeoff of the
* image interpolation. Currently, only ART_FILTER_NEAREST is
* implemented.
**/
void
art_rgb_pixbuf_affine (art_u8 *dst,
int x0, int y0, int x1, int y1, int dst_rowstride,
......
......@@ -30,6 +30,36 @@
/* Composite the source image over the destination image, applying the
affine transform. */
/**
* art_rgb_rgba_affine: Affine transform source RGBA image and composite.
* @dst: Destination image RGB buffer.
* @x0: Left coordinate of destination rectangle.
* @y0: Top coordinate of destination rectangle.
* @x1: Right coordinate of destination rectangle.
* @y1: Bottom coordinate of destination rectangle.
* @dst_rowstride: Rowstride of @dst buffer.
* @src: Source image RGBA buffer.
* @src_width: Width of source image.
* @src_height: Height of source image.
* @src_rowstride: Rowstride of @src buffer.
* @affine: Affine transform.
* @level: Filter level.
* @alphagamma: #ArtAlphaGamma for gamma-correcting the compositing.
*
* Affine transform the source image stored in @src, compositing over
* the area of destination image @dst specified by the rectangle
* (@x0, @y0) - (@x1, @y1). As usual in libart, the left and top edges
* of this rectangle are included, and the right and bottom edges are
* excluded.
*
* The @alphagamma parameter specifies that the alpha compositing be
* done in a gamma-corrected color space. In the current
* implementation, it is ignored.
*
* The @level parameter specifies the speed/quality tradeoff of the
* image interpolation. Currently, only ART_FILTER_NEAREST is
* implemented.
**/
void
art_rgb_rgba_affine (art_u8 *dst,
int x0, int y0, int x1, int y1, int dst_rowstride,
......
......@@ -107,6 +107,35 @@ art_rgb_svp_callback (void *callback_data, int y,
/* Render the vector path into the RGB buffer. */
/**
* art_rgb_svp_aa: Render sorted vector path into RGB buffer.
* @svp: The source sorted vector path.
* @x0: Left coordinate of destination rectangle.
* @y0: Top coordinate of destination rectangle.
* @x1: Right coordinate of destination rectangle.
* @y1: Bottom coordinate of destination rectangle.
* @fg_color: Foreground color in 0xRRGGBB format.
* @bg_color: Background color in 0xRRGGBB format.
* @buf: Destination RGB buffer.
* @rowstride: Rowstride of @buf buffer.
* @alphagamma: #ArtAlphaGamma for gamma-correcting the rendering.
*
* Renders the shape specified with @svp into the @buf RGB buffer.
* @x1 - @x0 specifies the width, and @y1 - @y0 specifies the height,
* of the rectangle rendered. The new pixels are stored starting at
* the first byte of @buf. Thus, the @x0 and @y0 parameters specify
* an offset within @svp, and may be tweaked as a way of doing
* integer-pixel translations without fiddling with @svp itself.
*
* The @fg_color and @bg_color arguments specify the opaque colors to
* be used for rendering. For pixels of entirely 0 winding-number,
* @bg_color is used. For pixels of entirely 1 winding number,
* @fg_color is used. In between, the color is interpolated based on
* the fraction of the pixel with a winding number of 1. If
* @alphagamma is NULL, then linear interpolation (in pixel counts) is
* the default. Otherwise, the interpolation is as specified by
* @alphagamma.
**/
void
art_rgb_svp_aa (const ArtSVP *svp,
int x0, int y0, int x1, int y1,
......@@ -360,6 +389,33 @@ art_rgb_svp_alpha_opaque_callback (void *callback_data, int y,
data->buf += data->rowstride;
}
/**
* art_rgb_svp_alpha: Alpha-composite sorted vector path over RGB buffer.
* @svp: The source sorted vector path.
* @x0: Left coordinate of destination rectangle.
* @y0: Top coordinate of destination rectangle.
* @x1: Right coordinate of destination rectangle.
* @y1: Bottom coordinate of destination rectangle.
* @rgba: Color in 0xRRGGBBAA format.
* @buf: Destination RGB buffer.
* @rowstride: Rowstride of @buf buffer.
* @alphagamma: #ArtAlphaGamma for gamma-correcting the compositing.
*
* Renders the shape specified with @svp over the @buf RGB buffer.
* @x1 - @x0 specifies the width, and @y1 - @y0 specifies the height,
* of the rectangle rendered. The new pixels are stored starting at
* the first byte of @buf. Thus, the @x0 and @y0 parameters specify
* an offset within @svp, and may be tweaked as a way of doing
* integer-pixel translations without fiddling with @svp itself.
*
* The @rgba argument specifies the color for the rendering. Pixels of
* entirely 0 winding number are left untouched. Pixels of entirely
* 1 winding number have the color @rgba composited over them (ie,
* are replaced by the red, green, blue components of @rgba if the alpha
* component is 0xff). Pixels of intermediate coverage are interpolated
* according to the rule in @alphagamma, or default to linear if
* @alphagamma is NULL.
**/
void
art_rgb_svp_alpha (const ArtSVP *svp,
int x0, int y0, int x1, int y1,
......
......@@ -30,6 +30,28 @@
We also realloc one auxiliary array of ints of size n_segs if
desired.
*/
/**
* art_svp_add_segment: Add a segment to an #ArtSVP structure.
* @p_vp: Pointer to where the #ArtSVP structure is stored.
* @pn_segs_max: Pointer to the allocated size of *@p_vp.
* @pn_points_max: Pointer to where auxiliary array is stored.
* @n_points: Number of points for new segment.
* @dir: Direction for new segment; 0 is up, 1 is down.
* @points: Points for new segment.
* @bbox: Bounding box for new segment.
*
* Adds a new segment to an ArtSVP structure. This routine reallocates
* the structure if necessary, updating *@p_vp and *@pn_segs_max as
* necessary.
*
* The new segment is simply added after all other segments. Thus,
* this routine should be called in order consistent with the #ArtSVP
* sorting rules.
*
* If the @bbox argument is given, it is simply stored in the new
* segment. Otherwise (if it is NULL), the bounding box is computed
* from the @points given.
**/
int
art_svp_add_segment (ArtSVP **p_vp, int *pn_segs_max,
int **pn_points_max,
......@@ -79,6 +101,13 @@ art_svp_add_segment (ArtSVP **p_vp, int *pn_segs_max,
return seg_num;
}
/**
* art_svp_free: Free an #ArtSVP structure.
* @svp: #ArtSVP to free.
*
* Frees an #ArtSVP structure and all the segments in it.
**/
void
art_svp_free (ArtSVP *svp)
{
......@@ -92,6 +121,15 @@ art_svp_free (ArtSVP *svp)
#define EPSILON 1e-6
/**
* art_svp_seg_compare: Compare two segments of an svp.
* @seg1: First segment to compare.
* @seg2: Second segment to compare.
*
* Compares two segments of an svp. Return 1 if @seg2 is below or to the
* right of @seg1, -1 otherwise. The comparison rules are "interesting"
* with respect to numerical robustness, rtfs if in doubt.
**/
int
art_svp_seg_compare (const void *s1, const void *s2)
{
......
/* Libart_LGPL - library of basic graphic primitives
* Copyright (C) 1998 Raph Levien
* Copyright (C) 1998-2000 Raph Levien
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -33,7 +33,18 @@
/* Merge the segments of the two svp's. The resulting svp will share
segments with args passed in, so be super-careful with the
allocation. */
/**
* art_svp_merge: Merge the segments of two svp's.
* @svp1: One svp to merge.
* @svp2: The other svp to merge.
*
* Merges the segments of two SVP's into a new one. The resulting
* #ArtSVP data structure will share the segments of the argument
* svp's, so it is probably a good idea to free it shallowly,
* especially if the arguments will be freed with art_svp_free().
*
* Return value: The merged #ArtSVP.
**/
static ArtSVP *
art_svp_merge (const ArtSVP *svp1, const ArtSVP *svp2)
{
......@@ -179,7 +190,21 @@ art_svp_merge_perturbed (const ArtSVP *svp1, const ArtSVP *svp2)
cases of butting segments, razor thin long holes may appear.
*/
/**
* art_svp_union: Compute the union of two sorted vector paths.
* @svp1: One sorted vector path.
* @svp2: The other sorted vector path.
*
* Computes the union of the two argument svp's. Given two svp's with
* winding numbers of 0 and 1 everywhere, the resulting winding number
* will be 1 where either (or both) of the argument svp's has a
* winding number 1, 0 otherwise. The result is newly allocated.
*
* Currently, this routine has accuracy problems pending the
* implementation of the new intersector.
*
* Return value: The union of @svp1 and @svp2.
**/
ArtSVP *
art_svp_union (const ArtSVP *svp1, const ArtSVP *svp2)
{
......@@ -217,6 +242,21 @@ art_svp_union (const ArtSVP *svp1, const ArtSVP *svp2)
*/
/**
* art_svp_intersect: Compute the intersection of two sorted vector paths.
* @svp1: One sorted vector path.
* @svp2: The other sorted vector path.
*
* Computes the intersection of the two argument svp's. Given two
* svp's with winding numbers of 0 and 1 everywhere, the resulting
* winding number will be 1 where both of the argument svp's has a
* winding number 1, 0 otherwise. The result is newly allocated.
*
* Currently, this routine has accuracy problems pending the
* implementation of the new intersector.
*
* Return value: The intersection of @svp1 and @svp2.
**/
ArtSVP *
art_svp_intersect (const ArtSVP *svp1, const ArtSVP *svp2)
{
......@@ -253,6 +293,21 @@ art_svp_intersect (const ArtSVP *svp1, const ArtSVP *svp2)
*/
/**
* art_svp_diff: Compute the symmetric difference of two sorted vector paths.
* @svp1: One sorted vector path.
* @svp2: The other sorted vector path.
*
* Computes the symmetric of the two argument svp's. Given two svp's
* with winding numbers of 0 and 1 everywhere, the resulting winding
* number will be 1 where either, but not both, of the argument svp's
* has a winding number 1, 0 otherwise. The result is newly allocated.
*
* Currently, this routine has accuracy problems pending the
* implementation of the new intersector.
*
* Return value: The symmetric difference of @svp1 and @svp2.
**/
ArtSVP *
art_svp_diff (const ArtSVP *svp1, const ArtSVP *svp2)
{
......@@ -267,3 +322,4 @@ art_svp_diff (const ArtSVP *svp1, const ArtSVP *svp2)
return svp_new;
}
/* todo: implement minus */
......@@ -26,6 +26,16 @@
/* Determine whether a point is inside, or near, an svp. */
/* return winding number of point wrt svp */
/**
* art_svp_point_wind: Determine winding number of a point with respect to svp.
* @svp: The svp.
* @x: The X coordinate of the point.
* @y: The Y coordinate of the point.
*
* Determine the winding number of the point @x, @y with respect to @svp.
*
* Return value: the winding number.
**/
int
art_svp_point_wind (ArtSVP *svp, double x, double y)
{
......@@ -68,8 +78,17 @@ art_svp_point_wind (ArtSVP *svp, double x, double y)
return wind;
}
/* Return a very large number if the svp is empty, or distance to the
edge otherwise. */
/**
* art_svp_point_dist: Determine distance between point and svp.
* @svp: The svp.
* @x: The X coordinate of the point.
* @y: The Y coordinate of the point.
*
* Determines the distance of the point @x, @y to the closest edge in
* @svp. A large number is returned if @svp is empty.
*
* Return value: the distance.
**/
double
art_svp_point_dist (ArtSVP *svp, double x, double y)
{
......
/* Libart_LGPL - library of basic graphic primitives
* Copyright (C) 1998 Raph Levien
* Copyright (C) 1998-2000 Raph Levien
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -111,6 +111,43 @@ art_svp_render_step_compare (const void *s1, const void *s2)
*/
/**
* art_svp_render_aa: Render SVP antialiased.
* @svp: The #ArtSVP to render.
* @x0: Left coordinate of destination rectangle.
* @y0: Top coordinate of destination rectangle.
* @x1: Right coordinate of destination rectangle.
* @y1: Bottom coordinate of destination rectangle.
* @callback: The callback which actually paints the pixels.
* @callback_data: Private data for @callback.
*
* Renders the sorted vector path in the given rectangle, antialiased.
*
* This interface uses a callback for the actual pixel rendering. The
* callback is called @y1 - @y0 times (once for each scan line). The y
* coordinate is given as an argument for convenience (it could be
* stored in the callback's private data and incremented on each
* call).
*
* The rendered polygon is represented in a semi-runlength format: a
* start value and a sequence of "steps". Each step has an x
* coordinate and a value delta. The resulting value at position x is
* equal to the sum of the start value and all step delta values for
* which the step x coordinate is less than or equal to x. An
* efficient algorithm will traverse the steps left to right, keeping
* a running sum.
*
* All x coordinates in the steps are guaranteed to be @x0 <= x < @x1.
* (This guarantee is a change from the gfonted vpaar renderer from
* which this routine is derived, and is designed to simplify the
* callback).
*
* The value 0x8000 represents 0% coverage by the polygon, while
* 0xff8000 represents 100% coverage. This format is designed so that
* >> 16 results in a standard 0x00..0xff value range, with nice
* rounding.
*
**/
void
art_svp_render_aa (const ArtSVP *svp,
int x0, int y0, int x1, int y1,
......
/* Libart_LGPL - library of basic graphic primitives
* Copyright (C) 1998 Raph Levien
* Copyright (C) 1998-2000 Raph Levien
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -44,7 +44,23 @@ reverse_points (ArtPoint *points, int n_points)
}
}
/* convert a vec_path to sorted form */
/**
* art_svp_from_vpath: Convert a vpath to a sorted vector path.
* @vpath: #ArtVPath to convert.
*
* Converts a vector path into sorted vector path form. The svp form is
* more efficient for rendering and other vector operations.
*
* Basically, the implementation is to traverse the vector path,
* generating a new segment for each "run" of points in the vector
* path with monotonically increasing Y values. All the resulting
* values are then sorted.
*
* Note: I'm not sure that the sorting rule is correct with respect
* to numerical stability issues.
*
* Return value: Resulting sorted vector path.
**/
ArtSVP *
art_svp_from_vpath (ArtVpath *vpath)
{
......
/* Libart_LGPL - library of basic graphic primitives
* Copyright (C) 1998-1999 Raph Levien
* Copyright (C) 1998-2000 Raph Levien
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -17,7 +17,6 @@
* Boston, MA 02111-1307, USA.
*/
/* Sort vector paths into sorted vector paths */
#include <stdlib.h>
#include <math.h>
......@@ -378,6 +377,21 @@ render_cap (ArtVpath **p_result, int *pn_result, int *pn_result_max,
}
}
/**
* art_svp_from_vpath_raw: Stroke a vector path, raw version
* @vpath: #ArtVPath to stroke.
* @join: Join style.
* @cap: Cap style.
* @line_width: Width of stroke.
* @miter_limit: Miter limit.
* @flatness: Flatness.
*
* Exactly the same as art_svp_vpath_stroke(), except that the resulting
* stroke outline may self-intersect and have regions of winding number
* greater than 1.
*
* Return value: Resulting raw stroked outline in svp format.
**/
ArtVpath *
art_svp_vpath_stroke_raw (ArtVpath *vpath,
ArtPathStrokeJoinType join,
......@@ -602,6 +616,47 @@ print_ps_svp (ArtSVP *vpath)
Precision: The perturbation fuzzes the coordinates slightly,
but not enough to be visible. */
/**
* art_svp_from_vpath: Stroke a vector path.
* @vpath: #ArtVPath to stroke.
* @join: Join style.
* @cap: Cap style.
* @line_width: Width of stroke.
* @miter_limit: Miter limit.
* @flatness: Flatness.
*
* Computes an svp representing the stroked outline of @vpath. The
* width of the stroked line is @line_width.
*
* Lines are joined according to the @join rule. Possible values are
* ART_PATH_STROKE_JOIN_MITER (for mitered joins),
* ART_PATH_STROKE_JOIN_ROUND (for round joins), and
* ART_PATH_STROKE_JOIN_BEVEL (for bevelled joins). The mitered join
* is converted to a bevelled join if the miter would extend to a
* distance of more than @miter_limit * @line_width from the actual
* join point.
*
* If there are open subpaths, the ends of these subpaths are capped
* according to the @cap rule. Possible values are
* ART_PATH_STROKE_CAP_BUTT (squared cap, extends exactly to end
* point), ART_PATH_STROKE_CAP_ROUND (rounded half-circle centered at
* the end point), and ART_PATH_STROKE_CAP_SQUARE (squared cap,
* extending half @line_width past the end point).
*
* The @flatness parameter controls the accuracy of the rendering. It
* is most important for determining the number of points to use to
* approximate circular arcs for round lines and joins. In general, the
* resulting vector path will be within @flatness pixels of the "ideal"
* path containing actual circular arcs. I reserve the right to use
* the @flatness parameter to convert bevelled joins to miters for very
* small turn angles, as this would reduce the number of points in the
* resulting outline path.
*
* The resulting path is "clean" with respect to self-intersections, i.e.
* the winding number is 0 or 1 at each point.
*
* Return value: Resulting stroked outline in svp format.
**/
ArtSVP *
art_svp_vpath_stroke (ArtVpath *vpath,
ArtPathStrokeJoinType join,
......
/* Libart_LGPL - library of basic graphic primitives
* Copyright (C) 1998 Raph Levien
* Copyright (C) 1998-2000 Raph Levien
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -952,6 +952,18 @@ fix_crossing (int start, int end, int *active_segs, int n_active_segs,
problem, I'll just keep it this way, because it will probably help
to make the code clearer, and I believe this code could use all the
clarity it can get. */
/**
* art_svp_uncross: Resolve self-intersections of an svp.
* @vp: The original svp.
*
* Finds all the intersections within @vp, and constructs a new svp
* with new points added at these intersections.
*
* This routine needs to be redone from scratch with numerical robustness
* in mind. I'm working on it.
*
* Return value: The new svp.
**/
ArtSVP *
art_svp_uncross (ArtSVP *vp)
{
......@@ -1286,6 +1298,36 @@ art_svp_uncross (ArtSVP *vp)
Doing random perturbation just makes matters worse.
*/
/**
* art_svp_rewind_uncrossed: Rewind an svp satisfying the nocross invariant.
* @vp: The original svp.
* @rule: The winding rule.
*
* Creates a new svp with winding number of 0 or 1 everywhere. The @rule
* argument specifies a rule for how winding numbers in the original
* @vp map to the winding numbers in the result.
*
* With @rule == ART_WIND_RULE_NONZERO, the resulting svp has a
* winding number of 1 where @vp has a nonzero winding number.
*
* With @rule == ART_WIND_RULE_INTERSECT, the resulting svp has a
* winding number of 1 where @vp has a winding number greater than
* 1. It is useful for computing intersections.
*
* With @rule == ART_WIND_RULE_ODDEVEN, the resulting svp has a
* winding number of 1 where @vp has an odd winding number. It is
* useful for implementing the even-odd winding rule of the
* PostScript imaging model.
*
* With @rule == ART_WIND_RULE_POSITIVE, the resulting svp has a
* winding number of 1 where @vp has a positive winding number. It is
* usefull for implementing asymmetric difference.
*
* This routine needs to be redone from scratch with numerical robustness
* in mind. I'm working on it.
*
* Return value: The new svp.
**/
ArtSVP *
art_svp_rewind_uncrossed (ArtSVP *vp, ArtWindRule rule)
{
......
......@@ -21,7 +21,18 @@
#include "art_misc.h"
#include "art_uta.h"
/* Arguments are tile numbers */
/**
* art_uta_new: Allocate a new uta.
* @x0: Left coordinate of uta.
* @y0: Top coordinate of uta.
* @x1: Right coordinate of uta.
* @y1: Bottom coordinate of uta.
*
* Allocates a new microtile array. The arguments are in units of
* tiles, not pixels.
*
* Returns: the newly allocated #ArtUta.
**/
ArtUta *
art_uta_new (int x0, int y0, int x1, int y1)
{
......@@ -39,7 +50,17 @@ art_uta_new (int x0, int y0, int x1, int y1)
return uta;
}
/* Arguments are coordinates */
/**
* art_uta_new_coords: Allocate a new uta, based on pixel coordinates.
* @x0: Left coordinate of uta.
* @y0: Top coordinate of uta.
* @x1: Right coordinate of uta.
* @y1: Bottom coordinate of uta.
*
* Allocates a new microtile array. The arguments are in pixels
*
* Returns: the newly allocated #ArtUta.
**/
ArtUta *
art_uta_new_coords (int x0, int y0, int x1, int y1)
{
......@@ -48,6 +69,13 @@ art_uta_new_coords (int x0, int y0, int x1, int y1)
1 + (y1 >> ART_UTILE_SHIFT));
}
/**
* art_uta_free: Free a uta.
* @uta: The uta to free.
*
* Frees the microtile array structure, including the actual microtile
* data.
**/
void
art_uta_free (ArtUta *uta)
{
......
/* Libart_LGPL - library of basic graphic primitives
* Copyright (C) 1998 Raph Levien
* Copyright (C) 1998-2000 Raph Levien
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -29,6 +29,28 @@
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
/**
* art_uta_union: Compute union of two uta's.
* @uta1: One uta.
* @uta2: The other uta.
*
* Computes the union of @uta1 and @uta2. The union is approximate,
* but coverage is guaranteed over all pixels included in either of
* the arguments, ie more pixels may be covered than the "exact"
* union.
*
* Note: this routine is used in the Gnome Canvas to accumulate the
* region that needs to be repainted. However, since it copies over
* the entire uta (which might be largish) even when the update may be
* small, it can be a performance bottleneck. There are two approaches
* to this problem, both of which are probably worthwhile. First, the
* generated uta's should always be limited to the visible window,
* thus guaranteeing that uta's never become large. Second, there
* should be a new, destructive union operation that only touches a
* small part of the uta when the update is small.
*
* Return value: The new union uta.
**/
ArtUta *
art_uta_union (ArtUta *uta1, ArtUta *uta2)
{
......
......@@ -21,7 +21,15 @@
#include "art_uta.h"
#include "art_rect.h"
/* please do not feed this function a degenerate rectangle */
/**
* art_uta_from_irect: Generate uta covering a rectangle.
* @bbox: The source rectangle.
*
* Generates a uta exactly covering @bbox. Please do not call this
* function with a @bbox with zero height or width.
*
* Return value: the new uta.
**/
ArtUta *
art_uta_from_irect (ArtIRect *bbox)
{
......
/* Libart_LGPL - library of basic graphic primitives
* Copyright (C) 1998 Raph Levien
* Copyright (C) 1998-2000 Raph Levien
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -27,9 +27,18 @@
#include "art_uta_svp.h"
#include "art_vpath_svp.h"
/* I will of course want to replace this with a more direct implementation.
But this gets the api in place. */
/**
* art_uta_from_svp: Generate uta covering an svp.
* @svp: The source svp.
*
* Generates a uta covering @svp. The resulting uta is of course
* approximate, ie it may cover more pixels than covered by @svp.
*
* Note: I will want to replace this with a more direct
* implementation. But this gets the api in place.
*
* Return value: the new uta.
**/
ArtUta *
art_uta_from_svp (const ArtSVP *svp)
{
......
/* Libart_LGPL - library of basic graphic primitives
* Copyright (C) 1998 Raph Levien
* Copyright (C) 1998-2000 Raph Levien
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -34,13 +34,26 @@
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif /* MIN */
/* Add the line to the uta, and also perform the basic step in rendering
the interior of a vpath. Specifically, for each time that a line
crosses a horizontal microtile grid line, increment (if y1 > y0,
decrement otherwise) the grid point lying to the right of the line.
Somewhat delicate handling of edge cases is called for.
*/
/**
* art_uta_add_line: Add a line to the uta.
* @uta: The uta to modify.
* @x0: X coordinate of line start point.
* @y0: Y coordinate of line start point.
* @x1: X coordinate of line end point.
* @y1: Y coordinate of line end point.
* @rbuf: Buffer containing first difference of winding number.
* @rbuf_rowstride: Rowstride of @rbuf.
*
* Add the line (@x0, @y0) - (@x1, @y1) to @uta, and also update the
* winding number buffer used for rendering the interior. @rbuf
* contains the first partial difference (in the X direction) of the
* winding number, measured in grid cells. Thus, each time that a line
* crosses a horizontal uta grid line, an entry of @rbuf is
* incremented if @y1 > @y0, decremented otherwise.
*
* Note that edge handling is fairly delicate. Please rtfs for
* details.
**/
void
art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1,
int *rbuf, int rbuf_rowstride)
......@@ -259,6 +272,15 @@ art_uta_add_line (ArtUta *uta, double x0, double y0, double x1, double y1,
}
}
/**
* art_uta_from_vpath: Generate uta covering a vpath.
* @vec: The source vpath.
*
* Generates a uta covering @vec. The resulting uta is of course
* approximate, ie it may cover more pixels than covered by @vec.
*
* Return value: the new uta.
**/
ArtUta *
art_uta_from_vpath (const ArtVpath *vec)
{
......
/* Libart_LGPL - library of basic graphic primitives
* Copyright (C) 1998 Raph Levien
* Copyright (C) 1998-2000 Raph Levien
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -27,6 +27,22 @@
#include "art_rect.h"
#include "art_vpath.h"
/**
* art_vpath_add_point: Add point to vpath.
* @p_vpath: Where the pointer to the #ArtVpath structure is stored.
* @pn_points: Pointer to the number of points in *@p_vpath.