app: BoundSeg -> GimpBoundSeg, boundary_foo() -> gimp_boundary_foo()

This commit is contained in:
Michael Natterer 2012-03-19 15:04:20 +01:00
parent 9323c2f28c
commit 2c62644f94
29 changed files with 757 additions and 754 deletions

View File

@ -177,7 +177,7 @@ typedef struct _GimpTagged GimpTagged; /* dummy typedef */
/* non-object types */
typedef struct _GimpArea GimpArea;
typedef struct _BoundSeg BoundSeg;
typedef struct _GimpBoundSeg GimpBoundSeg;
typedef struct _GimpCoords GimpCoords;
typedef struct _GimpGradientSegment GimpGradientSegment;
typedef struct _GimpPaletteEntry GimpPaletteEntry;

View File

@ -101,9 +101,9 @@ add_polyline (GArray *path_data,
}
GimpBezierDesc *
gimp_bezier_desc_new_from_bound_segs (BoundSeg *bound_segs,
gint n_bound_segs,
gint n_bound_groups)
gimp_bezier_desc_new_from_bound_segs (GimpBoundSeg *bound_segs,
gint n_bound_segs,
gint n_bound_groups)
{
GArray *path_data;
GimpVector2 *points;

View File

@ -31,8 +31,8 @@ GType gimp_bezier_desc_get_type (void) G_GNUC_CONST;
GimpBezierDesc * gimp_bezier_desc_new (cairo_path_data_t *data,
gint n_data);
/* expects sorted BoundSegs */
GimpBezierDesc * gimp_bezier_desc_new_from_bound_segs (BoundSeg *bound_segs,
/* expects sorted GimpBoundSegs */
GimpBezierDesc * gimp_bezier_desc_new_from_bound_segs (GimpBoundSeg *bound_segs,
gint n_bound_segs,
gint n_bound_groups);

View File

@ -33,106 +33,106 @@
#include "gimpboundary.h"
/* BoundSeg array growth parameter */
/* GimpBoundSeg array growth parameter */
#define MAX_SEGS_INC 2048
typedef struct _Boundary Boundary;
typedef struct _GimpBoundary GimpBoundary;
struct _Boundary
struct _GimpBoundary
{
/* The array of segments */
BoundSeg *segs;
gint num_segs;
gint max_segs;
GimpBoundSeg *segs;
gint num_segs;
gint max_segs;
/* The array of vertical segments */
gint *vert_segs;
gint *vert_segs;
/* The empty segment arrays */
gint *empty_segs_n;
gint *empty_segs_c;
gint *empty_segs_l;
gint max_empty_segs;
gint *empty_segs_n;
gint *empty_segs_c;
gint *empty_segs_l;
gint max_empty_segs;
};
/* local function prototypes */
static Boundary * boundary_new (PixelRegion *PR);
static BoundSeg * boundary_free (Boundary *boundary,
gboolean free_segs);
static GimpBoundary * gimp_boundary_new (PixelRegion *PR);
static GimpBoundSeg * gimp_boundary_free (GimpBoundary *boundary,
gboolean free_segs);
static void boundary_add_seg (Boundary *bounrady,
gint x1,
gint y1,
gint x2,
gint y2,
gboolean open);
static void gimp_boundary_add_seg (GimpBoundary *bounrady,
gint x1,
gint y1,
gint x2,
gint y2,
gboolean open);
static void find_empty_segs (PixelRegion *maskPR,
gint scanline,
gint empty_segs[],
gint max_empty,
gint *num_empty,
BoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2,
guchar threshold);
static void process_horiz_seg (Boundary *boundary,
gint x1,
gint y1,
gint x2,
gint y2,
gboolean open);
static void make_horiz_segs (Boundary *boundary,
gint start,
gint end,
gint scanline,
gint empty[],
gint num_empty,
gint top);
static Boundary * generate_boundary (PixelRegion *PR,
BoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2,
guchar threshold);
static void find_empty_segs (PixelRegion *maskPR,
gint scanline,
gint empty_segs[],
gint max_empty,
gint *num_empty,
GimpBoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2,
guchar threshold);
static void process_horiz_seg (GimpBoundary *boundary,
gint x1,
gint y1,
gint x2,
gint y2,
gboolean open);
static void make_horiz_segs (GimpBoundary *boundary,
gint start,
gint end,
gint scanline,
gint empty[],
gint num_empty,
gint top);
static GimpBoundary * generate_boundary (PixelRegion *PR,
GimpBoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2,
guchar threshold);
static gint cmp_segptr_xy1_addr (const BoundSeg **seg_ptr_a,
const BoundSeg **seg_ptr_b);
static gint cmp_segptr_xy2_addr (const BoundSeg **seg_ptr_a,
const BoundSeg **seg_ptr_b);
static gint cmp_segptr_xy1_addr (const GimpBoundSeg **seg_ptr_a,
const GimpBoundSeg **seg_ptr_b);
static gint cmp_segptr_xy2_addr (const GimpBoundSeg **seg_ptr_a,
const GimpBoundSeg **seg_ptr_b);
static gint cmp_segptr_xy1 (const BoundSeg **seg_ptr_a,
const BoundSeg **seg_ptr_b);
static gint cmp_segptr_xy2 (const BoundSeg **seg_ptr_a,
const BoundSeg **seg_ptr_b);
static gint cmp_segptr_xy1 (const GimpBoundSeg **seg_ptr_a,
const GimpBoundSeg **seg_ptr_b);
static gint cmp_segptr_xy2 (const GimpBoundSeg **seg_ptr_a,
const GimpBoundSeg **seg_ptr_b);
static const BoundSeg * find_segment (const BoundSeg **segs_by_xy1,
const BoundSeg **segs_by_xy2,
gint num_segs,
gint x,
gint y);
static const GimpBoundSeg * find_segment (const GimpBoundSeg **segs_by_xy1,
const GimpBoundSeg **segs_by_xy2,
gint num_segs,
gint x,
gint y);
static const BoundSeg * find_segment_with_func (const BoundSeg **segs,
gint num_segs,
const BoundSeg *search_seg,
GCompareFunc cmp_func);
static const GimpBoundSeg * find_segment_with_func (const GimpBoundSeg **segs,
gint num_segs,
const GimpBoundSeg *search_seg,
GCompareFunc cmp_func);
static void simplify_subdivide (const BoundSeg *segs,
gint start_idx,
gint end_idx,
GArray **ret_points);
static void simplify_subdivide (const GimpBoundSeg *segs,
gint start_idx,
gint end_idx,
GArray **ret_points);
/* public functions */
/**
* boundary_find:
* gimp_boundary_find:
* @maskPR: any PixelRegion
* @type: type of bounds
* @x1: left side of bounds
@ -140,9 +140,9 @@ static void simplify_subdivide (const BoundSeg *segs,
* @x2: right side of bounds
* @y2: botton side of bounds
* @threshold: pixel value of boundary line
* @num_segs: number of returned #BoundSeg's
* @num_segs: number of returned #GimpBoundSeg's
*
* This function returns an array of #BoundSeg's which describe all
* This function returns an array of #GimpBoundSeg's which describe all
* outlines along pixel value @threahold, optionally within specified
* bounds instead of the whole region.
*
@ -152,17 +152,17 @@ static void simplify_subdivide (const BoundSeg *segs,
*
* Return value: the boundary array.
**/
BoundSeg *
boundary_find (PixelRegion *maskPR,
BoundaryType type,
int x1,
int y1,
int x2,
int y2,
guchar threshold,
int *num_segs)
GimpBoundSeg *
gimp_boundary_find (PixelRegion *maskPR,
GimpBoundaryType type,
int x1,
int y1,
int x2,
int y2,
guchar threshold,
int *num_segs)
{
Boundary *boundary;
GimpBoundary *boundary;
g_return_val_if_fail (maskPR != NULL, NULL);
g_return_val_if_fail (num_segs != NULL, NULL);
@ -171,33 +171,33 @@ boundary_find (PixelRegion *maskPR,
*num_segs = boundary->num_segs;
return boundary_free (boundary, FALSE);
return gimp_boundary_free (boundary, FALSE);
}
/**
* boundary_sort:
* gimp_boundary_sort:
* @segs: unsorted input segs.
* @num_segs: number of input segs
* @num_groups: number of groups in the sorted segs
*
* This function takes an array of #BoundSeg's as returned by
* boundary_find() and sorts it by contiguous groups. The returned
* This function takes an array of #GimpBoundSeg's as returned by
* gimp_boundary_find() and sorts it by contiguous groups. The returned
* array contains markers consisting of -1 coordinates and is
* @num_groups elements longer than @segs.
*
* Return value: the sorted segs
**/
BoundSeg *
boundary_sort (const BoundSeg *segs,
gint num_segs,
gint *num_groups)
GimpBoundSeg *
gimp_boundary_sort (const GimpBoundSeg *segs,
gint num_segs,
gint *num_groups)
{
Boundary *boundary;
const BoundSeg **segs_ptrs_by_xy1;
const BoundSeg **segs_ptrs_by_xy2;
gint index;
gint x, y;
gint startx, starty;
GimpBoundary *boundary;
const GimpBoundSeg **segs_ptrs_by_xy1;
const GimpBoundSeg **segs_ptrs_by_xy2;
gint index;
gint x, y;
gint startx, starty;
g_return_val_if_fail ((segs == NULL && num_segs == 0) ||
(segs != NULL && num_segs > 0), NULL);
@ -208,9 +208,9 @@ boundary_sort (const BoundSeg *segs,
if (num_segs == 0)
return NULL;
/* prepare arrays with BoundSeg pointers sorted by xy1 and xy2 accordingly */
segs_ptrs_by_xy1 = g_new (const BoundSeg *, num_segs);
segs_ptrs_by_xy2 = g_new (const BoundSeg *, num_segs);
/* prepare arrays with GimpBoundSeg pointers sorted by xy1 and xy2 accordingly */
segs_ptrs_by_xy1 = g_new (const GimpBoundSeg *, num_segs);
segs_ptrs_by_xy2 = g_new (const GimpBoundSeg *, num_segs);
for (index = 0; index < num_segs; index++)
{
@ -218,29 +218,29 @@ boundary_sort (const BoundSeg *segs,
segs_ptrs_by_xy2[index] = segs + index;
}
qsort (segs_ptrs_by_xy1, num_segs, sizeof (BoundSeg *),
qsort (segs_ptrs_by_xy1, num_segs, sizeof (GimpBoundSeg *),
(GCompareFunc) cmp_segptr_xy1_addr);
qsort (segs_ptrs_by_xy2, num_segs, sizeof (BoundSeg *),
qsort (segs_ptrs_by_xy2, num_segs, sizeof (GimpBoundSeg *),
(GCompareFunc) cmp_segptr_xy2_addr);
for (index = 0; index < num_segs; index++)
((BoundSeg *) segs)[index].visited = FALSE;
((GimpBoundSeg *) segs)[index].visited = FALSE;
boundary = boundary_new (NULL);
boundary = gimp_boundary_new (NULL);
for (index = 0; index < num_segs; index++)
{
const BoundSeg *cur_seg;
const GimpBoundSeg *cur_seg;
if (segs[index].visited)
continue;
boundary_add_seg (boundary,
segs[index].x1, segs[index].y1,
segs[index].x2, segs[index].y2,
segs[index].open);
gimp_boundary_add_seg (boundary,
segs[index].x1, segs[index].y1,
segs[index].x2, segs[index].y2,
segs[index].open);
((BoundSeg *) segs)[index].visited = TRUE;
((GimpBoundSeg *) segs)[index].visited = TRUE;
startx = segs[index].x1;
starty = segs[index].y1;
@ -253,24 +253,24 @@ boundary_sort (const BoundSeg *segs,
/* make sure ordering is correct */
if (x == cur_seg->x1 && y == cur_seg->y1)
{
boundary_add_seg (boundary,
cur_seg->x1, cur_seg->y1,
cur_seg->x2, cur_seg->y2,
cur_seg->open);
gimp_boundary_add_seg (boundary,
cur_seg->x1, cur_seg->y1,
cur_seg->x2, cur_seg->y2,
cur_seg->open);
x = cur_seg->x2;
y = cur_seg->y2;
}
else
{
boundary_add_seg (boundary,
cur_seg->x2, cur_seg->y2,
cur_seg->x1, cur_seg->y1,
cur_seg->open);
gimp_boundary_add_seg (boundary,
cur_seg->x2, cur_seg->y2,
cur_seg->x1, cur_seg->y1,
cur_seg->open);
x = cur_seg->x1;
y = cur_seg->y1;
}
((BoundSeg *) cur_seg)->visited = TRUE;
((GimpBoundSeg *) cur_seg)->visited = TRUE;
}
if (G_UNLIKELY (x != startx || y != starty))
@ -278,31 +278,31 @@ boundary_sort (const BoundSeg *segs,
/* Mark the end of a group */
*num_groups = *num_groups + 1;
boundary_add_seg (boundary, -1, -1, -1, -1, 0);
gimp_boundary_add_seg (boundary, -1, -1, -1, -1, 0);
}
g_free (segs_ptrs_by_xy1);
g_free (segs_ptrs_by_xy2);
return boundary_free (boundary, FALSE);
return gimp_boundary_free (boundary, FALSE);
}
/**
* boundary_simplify:
* gimp_boundary_simplify:
* @sorted_segs: sorted input segs
* @num_groups: number of groups in the sorted segs
* @num_segs: number of returned segs.
*
* This function takes an array of #BoundSeg's which has been sorted
* with boundary_sort() and reduces the number of segments while
* This function takes an array of #GimpBoundSeg's which has been sorted
* with gimp_boundary_sort() and reduces the number of segments while
* preserving the general shape as close as possible.
*
* Return value: the simplified segs.
**/
BoundSeg *
boundary_simplify (BoundSeg *sorted_segs,
gint num_groups,
gint *num_segs)
GimpBoundSeg *
gimp_boundary_simplify (GimpBoundSeg *sorted_segs,
gint num_groups,
gint *num_segs)
{
GArray *new_bounds;
gint i, seg;
@ -311,7 +311,7 @@ boundary_simplify (BoundSeg *sorted_segs,
(sorted_segs != NULL && num_groups > 0), NULL);
g_return_val_if_fail (num_segs != NULL, NULL);
new_bounds = g_array_new (FALSE, FALSE, sizeof (BoundSeg));
new_bounds = g_array_new (FALSE, FALSE, sizeof (GimpBoundSeg));
seg = 0;
@ -332,7 +332,7 @@ boundary_simplify (BoundSeg *sorted_segs,
if (n_points > 0)
{
GArray *tmp_points;
BoundSeg tmp_seg;
GimpBoundSeg tmp_seg;
gint j;
tmp_points = g_array_new (FALSE, FALSE, sizeof (gint));
@ -359,14 +359,14 @@ boundary_simplify (BoundSeg *sorted_segs,
*num_segs = new_bounds->len;
return (BoundSeg *) g_array_free (new_bounds, FALSE);
return (GimpBoundSeg *) g_array_free (new_bounds, FALSE);
}
void
boundary_offset (BoundSeg *segs,
gint num_segs,
gint off_x,
gint off_y)
gimp_boundary_offset (GimpBoundSeg *segs,
gint num_segs,
gint off_x,
gint off_y)
{
gint i;
@ -389,10 +389,10 @@ boundary_offset (BoundSeg *segs,
/* private functions */
static Boundary *
boundary_new (PixelRegion *PR)
static GimpBoundary *
gimp_boundary_new (PixelRegion *PR)
{
Boundary *boundary = g_slice_new0 (Boundary);
GimpBoundary *boundary = g_slice_new0 (GimpBoundary);
if (PR)
{
@ -419,11 +419,11 @@ boundary_new (PixelRegion *PR)
return boundary;
}
static BoundSeg *
boundary_free (Boundary *boundary,
gboolean free_segs)
static GimpBoundSeg *
gimp_boundary_free (GimpBoundary *boundary,
gboolean free_segs)
{
BoundSeg *segs = NULL;
GimpBoundSeg *segs = NULL;
if (free_segs)
g_free (boundary->segs);
@ -435,24 +435,24 @@ boundary_free (Boundary *boundary,
g_free (boundary->empty_segs_c);
g_free (boundary->empty_segs_l);
g_slice_free (Boundary, boundary);
g_slice_free (GimpBoundary, boundary);
return segs;
}
static void
boundary_add_seg (Boundary *boundary,
gint x1,
gint y1,
gint x2,
gint y2,
gboolean open)
gimp_boundary_add_seg (GimpBoundary *boundary,
gint x1,
gint y1,
gint x2,
gint y2,
gboolean open)
{
if (boundary->num_segs >= boundary->max_segs)
{
boundary->max_segs += MAX_SEGS_INC;
boundary->segs = g_renew (BoundSeg, boundary->segs, boundary->max_segs);
boundary->segs = g_renew (GimpBoundSeg, boundary->segs, boundary->max_segs);
}
boundary->segs[boundary->num_segs].x1 = x1;
@ -465,17 +465,17 @@ boundary_add_seg (Boundary *boundary,
}
static void
find_empty_segs (PixelRegion *maskPR,
gint scanline,
gint empty_segs[],
gint max_empty,
gint *num_empty,
BoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2,
guchar threshold)
find_empty_segs (PixelRegion *maskPR,
gint scanline,
gint empty_segs[],
gint max_empty,
gint *num_empty,
GimpBoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2,
guchar threshold)
{
const guchar *data = NULL;
Tile *tile = NULL;
@ -497,7 +497,7 @@ find_empty_segs (PixelRegion *maskPR,
return;
}
if (type == BOUNDARY_WITHIN_BOUNDS)
if (type == GIMP_BOUNDARY_WITHIN_BOUNDS)
{
if (scanline < y1 || scanline >= y2)
{
@ -509,7 +509,7 @@ find_empty_segs (PixelRegion *maskPR,
start = x1;
end = x2;
}
else if (type == BOUNDARY_IGNORE_BOUNDS)
else if (type == GIMP_BOUNDARY_IGNORE_BOUNDS)
{
start = maskPR->x;
end = maskPR->x + maskPR->w;
@ -551,7 +551,7 @@ find_empty_segs (PixelRegion *maskPR,
endx = MIN (end, endx);
}
if (type == BOUNDARY_IGNORE_BOUNDS && (endx > x1 || x < x2))
if (type == GIMP_BOUNDARY_IGNORE_BOUNDS && (endx > x1 || x < x2))
{
for (; x < endx; x++)
{
@ -610,19 +610,19 @@ find_empty_segs (PixelRegion *maskPR,
}
static void
process_horiz_seg (Boundary *boundary,
gint x1,
gint y1,
gint x2,
gint y2,
gboolean open)
process_horiz_seg (GimpBoundary *boundary,
gint x1,
gint y1,
gint x2,
gint y2,
gboolean open)
{
/* This procedure accounts for any vertical segments that must be
drawn to close in the horizontal segments. */
if (boundary->vert_segs[x1] >= 0)
{
boundary_add_seg (boundary, x1, boundary->vert_segs[x1], x1, y1, !open);
gimp_boundary_add_seg (boundary, x1, boundary->vert_segs[x1], x1, y1, !open);
boundary->vert_segs[x1] = -1;
}
else
@ -630,23 +630,23 @@ process_horiz_seg (Boundary *boundary,
if (boundary->vert_segs[x2] >= 0)
{
boundary_add_seg (boundary, x2, boundary->vert_segs[x2], x2, y2, open);
gimp_boundary_add_seg (boundary, x2, boundary->vert_segs[x2], x2, y2, open);
boundary->vert_segs[x2] = -1;
}
else
boundary->vert_segs[x2] = y2;
boundary_add_seg (boundary, x1, y1, x2, y2, open);
gimp_boundary_add_seg (boundary, x1, y1, x2, y2, open);
}
static void
make_horiz_segs (Boundary *boundary,
gint start,
gint end,
gint scanline,
gint empty[],
gint num_empty,
gint top)
make_horiz_segs (GimpBoundary *boundary,
gint start,
gint end,
gint scanline,
gint empty[],
gint num_empty,
gint top)
{
gint empty_index;
gint e_s, e_e; /* empty segment start and end values */
@ -671,36 +671,36 @@ make_horiz_segs (Boundary *boundary,
}
}
static Boundary *
generate_boundary (PixelRegion *PR,
BoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2,
guchar threshold)
static GimpBoundary *
generate_boundary (PixelRegion *PR,
GimpBoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2,
guchar threshold)
{
Boundary *boundary;
gint scanline;
gint i;
gint start, end;
gint *tmp_segs;
GimpBoundary *boundary;
gint scanline;
gint i;
gint start, end;
gint *tmp_segs;
gint num_empty_n = 0;
gint num_empty_c = 0;
gint num_empty_l = 0;
gint num_empty_n = 0;
gint num_empty_c = 0;
gint num_empty_l = 0;
boundary = boundary_new (PR);
boundary = gimp_boundary_new (PR);
start = 0;
end = 0;
if (type == BOUNDARY_WITHIN_BOUNDS)
if (type == GIMP_BOUNDARY_WITHIN_BOUNDS)
{
start = y1;
end = y2;
}
else if (type == BOUNDARY_IGNORE_BOUNDS)
else if (type == GIMP_BOUNDARY_IGNORE_BOUNDS)
{
start = PR->y;
end = PR->y + PR->h;
@ -787,11 +787,11 @@ cmp_xy (const gint ax,
* (x1, y1) pairs are equal.
*/
static gint
cmp_segptr_xy1_addr (const BoundSeg **seg_ptr_a,
const BoundSeg **seg_ptr_b)
cmp_segptr_xy1_addr (const GimpBoundSeg **seg_ptr_a,
const GimpBoundSeg **seg_ptr_b)
{
const BoundSeg *seg_a = *seg_ptr_a;
const BoundSeg *seg_b = *seg_ptr_b;
const GimpBoundSeg *seg_a = *seg_ptr_a;
const GimpBoundSeg *seg_b = *seg_ptr_b;
gint result = cmp_xy (seg_a->x1, seg_a->y1, seg_b->x1, seg_b->y1);
@ -811,11 +811,11 @@ cmp_segptr_xy1_addr (const BoundSeg **seg_ptr_a,
* (x2, y2) pairs are equal.
*/
static gint
cmp_segptr_xy2_addr (const BoundSeg **seg_ptr_a,
const BoundSeg **seg_ptr_b)
cmp_segptr_xy2_addr (const GimpBoundSeg **seg_ptr_a,
const GimpBoundSeg **seg_ptr_b)
{
const BoundSeg *seg_a = *seg_ptr_a;
const BoundSeg *seg_b = *seg_ptr_b;
const GimpBoundSeg *seg_a = *seg_ptr_a;
const GimpBoundSeg *seg_b = *seg_ptr_b;
gint result = cmp_xy (seg_a->x2, seg_a->y2, seg_b->x2, seg_b->y2);
@ -835,9 +835,10 @@ cmp_segptr_xy2_addr (const BoundSeg **seg_ptr_a,
* Compares (x1, y1) pairs in specified segments.
*/
static gint
cmp_segptr_xy1 (const BoundSeg **seg_ptr_a, const BoundSeg **seg_ptr_b)
cmp_segptr_xy1 (const GimpBoundSeg **seg_ptr_a,
const GimpBoundSeg **seg_ptr_b)
{
const BoundSeg *seg_a = *seg_ptr_a, *seg_b = *seg_ptr_b;
const GimpBoundSeg *seg_a = *seg_ptr_a, *seg_b = *seg_ptr_b;
return cmp_xy (seg_a->x1, seg_a->y1, seg_b->x1, seg_b->y1);
}
@ -846,26 +847,26 @@ cmp_segptr_xy1 (const BoundSeg **seg_ptr_a, const BoundSeg **seg_ptr_b)
* Compares (x2, y2) pairs in specified segments.
*/
static gint
cmp_segptr_xy2 (const BoundSeg **seg_ptr_a,
const BoundSeg **seg_ptr_b)
cmp_segptr_xy2 (const GimpBoundSeg **seg_ptr_a,
const GimpBoundSeg **seg_ptr_b)
{
const BoundSeg *seg_a = *seg_ptr_a;
const BoundSeg *seg_b = *seg_ptr_b;
const GimpBoundSeg *seg_a = *seg_ptr_a;
const GimpBoundSeg *seg_b = *seg_ptr_b;
return cmp_xy (seg_a->x2, seg_a->y2, seg_b->x2, seg_b->y2);
}
static const BoundSeg *
find_segment (const BoundSeg **segs_by_xy1,
const BoundSeg **segs_by_xy2,
gint num_segs,
gint x,
gint y)
static const GimpBoundSeg *
find_segment (const GimpBoundSeg **segs_by_xy1,
const GimpBoundSeg **segs_by_xy2,
gint num_segs,
gint x,
gint y)
{
const BoundSeg *segptr_xy1;
const BoundSeg *segptr_xy2;
BoundSeg search_seg;
const GimpBoundSeg *segptr_xy1;
const GimpBoundSeg *segptr_xy2;
GimpBoundSeg search_seg;
search_seg.x1 = search_seg.x2 = x;
search_seg.y1 = search_seg.y2 = y;
@ -887,16 +888,16 @@ find_segment (const BoundSeg **segs_by_xy1,
}
static const BoundSeg *
find_segment_with_func (const BoundSeg **segs,
gint num_segs,
const BoundSeg *search_seg,
GCompareFunc cmp_func)
static const GimpBoundSeg *
find_segment_with_func (const GimpBoundSeg **segs,
gint num_segs,
const GimpBoundSeg *search_seg,
GCompareFunc cmp_func)
{
const BoundSeg **seg;
const BoundSeg *found_seg = NULL;
const GimpBoundSeg **seg;
const GimpBoundSeg *found_seg = NULL;
seg = bsearch (&search_seg, segs, num_segs, sizeof (BoundSeg *), cmp_func);
seg = bsearch (&search_seg, segs, num_segs, sizeof (GimpBoundSeg *), cmp_func);
if (seg != NULL)
{
@ -922,10 +923,10 @@ find_segment_with_func (const BoundSeg **segs,
/* simplifying utility functions */
static void
simplify_subdivide (const BoundSeg *segs,
gint start_idx,
gint end_idx,
GArray **ret_points)
simplify_subdivide (const GimpBoundSeg *segs,
gint start_idx,
gint end_idx,
GArray **ret_points)
{
gint maxdist_idx;
gint maxdist;

View File

@ -15,22 +15,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __BOUNDARY_H__
#define __BOUNDARY_H__
#ifndef __GIMP_BOUNDARY_H__
#define __GIMP_BOUNDARY_H__
/* half intensity for mask */
#define BOUNDARY_HALF_WAY 127
#define GIMP_BOUNDARY_HALF_WAY 127
typedef enum
{
BOUNDARY_WITHIN_BOUNDS,
BOUNDARY_IGNORE_BOUNDS
} BoundaryType;
GIMP_BOUNDARY_WITHIN_BOUNDS,
GIMP_BOUNDARY_IGNORE_BOUNDS
} GimpBoundaryType;
struct _BoundSeg
struct _GimpBoundSeg
{
gint x1;
gint y1;
@ -41,26 +41,26 @@ struct _BoundSeg
};
BoundSeg * boundary_find (PixelRegion *maskPR,
BoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2,
guchar threshold,
gint *num_segs);
BoundSeg * boundary_sort (const BoundSeg *segs,
gint num_segs,
gint *num_groups);
BoundSeg * boundary_simplify (BoundSeg *sorted_segs,
gint num_groups,
gint *num_segs);
GimpBoundSeg * gimp_boundary_find (PixelRegion *maskPR,
GimpBoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2,
guchar threshold,
gint *num_segs);
GimpBoundSeg * gimp_boundary_sort (const GimpBoundSeg *segs,
gint num_segs,
gint *num_groups);
GimpBoundSeg * gimp_boundary_simplify (GimpBoundSeg *sorted_segs,
gint num_groups,
gint *num_segs);
/* offsets in-place */
void boundary_offset (BoundSeg *segs,
gint num_segs,
gint off_x,
gint off_y);
void gimp_boundary_offset (GimpBoundSeg *segs,
gint num_segs,
gint off_x,
gint off_y);
#endif /* __BOUNDARY_H__ */
#endif /* __GIMP_BOUNDARY_H__ */

View File

@ -45,25 +45,25 @@ gimp_brush_transform_boundary_exact (GimpBrush *brush,
if (mask)
{
PixelRegion maskPR;
BoundSeg *bound_segs;
gint n_bound_segs;
PixelRegion maskPR;
GimpBoundSeg *bound_segs;
gint n_bound_segs;
pixel_region_init_temp_buf (&maskPR, (TempBuf *) mask,
0, 0, mask->width, mask->height);
bound_segs = boundary_find (&maskPR, BOUNDARY_WITHIN_BOUNDS,
0, 0, maskPR.w, maskPR.h,
0,
&n_bound_segs);
bound_segs = gimp_boundary_find (&maskPR, GIMP_BOUNDARY_WITHIN_BOUNDS,
0, 0, maskPR.w, maskPR.h,
0,
&n_bound_segs);
if (bound_segs)
{
BoundSeg *stroke_segs;
gint n_stroke_groups;
GimpBoundSeg *stroke_segs;
gint n_stroke_groups;
stroke_segs = boundary_sort (bound_segs, n_bound_segs,
&n_stroke_groups);
stroke_segs = gimp_boundary_sort (bound_segs, n_bound_segs,
&n_stroke_groups);
g_free (bound_segs);

View File

@ -138,90 +138,90 @@ static void gimp_channel_invalidate_boundary (GimpDrawable *drawable);
static void gimp_channel_get_active_components (const GimpDrawable *drawable,
gboolean *active);
static void gimp_channel_apply_region (GimpDrawable *drawable,
PixelRegion *src2PR,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
static void gimp_channel_apply_region (GimpDrawable *drawable,
PixelRegion *src2PR,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
GimpLayerModeEffects mode,
TileManager *src1_tiles,
PixelRegion *destPR,
gint x,
gint y);
static void gimp_channel_replace_region (GimpDrawable *drawable,
PixelRegion *src2PR,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
PixelRegion *maskPR,
gint x,
gint y);
static void gimp_channel_set_tiles (GimpDrawable *drawable,
gboolean push_undo,
const gchar *undo_desc,
TileManager *tiles,
GimpImageType type,
gint offset_x,
gint offset_y);
static GeglNode * gimp_channel_get_node (GimpItem *item);
static void gimp_channel_swap_pixels (GimpDrawable *drawable,
TileManager *tiles,
gboolean sparse,
gint x,
gint y,
gint width,
gint height);
TileManager *src1_tiles,
PixelRegion *destPR,
gint x,
gint y);
static void gimp_channel_replace_region (GimpDrawable *drawable,
PixelRegion *src2PR,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
PixelRegion *maskPR,
gint x,
gint y);
static void gimp_channel_set_tiles (GimpDrawable *drawable,
gboolean push_undo,
const gchar *undo_desc,
TileManager *tiles,
GimpImageType type,
gint offset_x,
gint offset_y);
static GeglNode * gimp_channel_get_node (GimpItem *item);
static void gimp_channel_swap_pixels (GimpDrawable *drawable,
TileManager *tiles,
gboolean sparse,
gint x,
gint y,
gint width,
gint height);
static gint gimp_channel_get_opacity_at (GimpPickable *pickable,
gint x,
gint y);
static gint gimp_channel_get_opacity_at (GimpPickable *pickable,
gint x,
gint y);
static gboolean gimp_channel_real_boundary (GimpChannel *channel,
const BoundSeg **segs_in,
const BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
static gboolean gimp_channel_real_bounds (GimpChannel *channel,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
static gboolean gimp_channel_real_is_empty (GimpChannel *channel);
static void gimp_channel_real_feather (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
gboolean push_undo);
static void gimp_channel_real_sharpen (GimpChannel *channel,
gboolean push_undo);
static void gimp_channel_real_clear (GimpChannel *channel,
const gchar *undo_desc,
gboolean push_undo);
static void gimp_channel_real_all (GimpChannel *channel,
gboolean push_undo);
static void gimp_channel_real_invert (GimpChannel *channel,
gboolean push_undo);
static void gimp_channel_real_border (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean feather,
gboolean edge_lock,
gboolean push_undo);
static void gimp_channel_real_grow (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean push_undo);
static void gimp_channel_real_shrink (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean edge_lock,
gboolean push_undo);
static gboolean gimp_channel_real_boundary (GimpChannel *channel,
const GimpBoundSeg **segs_in,
const GimpBoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
static gboolean gimp_channel_real_bounds (GimpChannel *channel,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
static gboolean gimp_channel_real_is_empty (GimpChannel *channel);
static void gimp_channel_real_feather (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
gboolean push_undo);
static void gimp_channel_real_sharpen (GimpChannel *channel,
gboolean push_undo);
static void gimp_channel_real_clear (GimpChannel *channel,
const gchar *undo_desc,
gboolean push_undo);
static void gimp_channel_real_all (GimpChannel *channel,
gboolean push_undo);
static void gimp_channel_real_invert (GimpChannel *channel,
gboolean push_undo);
static void gimp_channel_real_border (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean feather,
gboolean edge_lock,
gboolean push_undo);
static void gimp_channel_real_grow (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean push_undo);
static void gimp_channel_real_shrink (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean edge_lock,
gboolean push_undo);
static void gimp_channel_validate_tile (TileManager *tm,
Tile *tile);
static void gimp_channel_validate_tile (TileManager *tm,
Tile *tile);
G_DEFINE_TYPE_WITH_CODE (GimpChannel, gimp_channel, GIMP_TYPE_DRAWABLE,
@ -372,8 +372,8 @@ gimp_channel_get_memsize (GimpObject *object,
{
GimpChannel *channel = GIMP_CHANNEL (object);
*gui_size += channel->num_segs_in * sizeof (BoundSeg);
*gui_size += channel->num_segs_out * sizeof (BoundSeg);
*gui_size += channel->num_segs_in * sizeof (GimpBoundSeg);
*gui_size += channel->num_segs_out * sizeof (GimpBoundSeg);
return GIMP_OBJECT_CLASS (parent_class)->get_memsize (object, gui_size);
}
@ -721,13 +721,13 @@ gimp_channel_stroke (GimpItem *item,
GimpProgress *progress,
GError **error)
{
GimpChannel *channel = GIMP_CHANNEL (item);
const BoundSeg *segs_in;
const BoundSeg *segs_out;
gint n_segs_in;
gint n_segs_out;
gboolean retval = FALSE;
gint offset_x, offset_y;
GimpChannel *channel = GIMP_CHANNEL (item);
const GimpBoundSeg *segs_in;
const GimpBoundSeg *segs_out;
gint n_segs_in;
gint n_segs_out;
gboolean retval = FALSE;
gint offset_x, offset_y;
if (! gimp_channel_boundary (channel, &segs_in, &segs_out,
&n_segs_in, &n_segs_out,
@ -1000,15 +1000,15 @@ gimp_channel_get_opacity_at (GimpPickable *pickable,
}
static gboolean
gimp_channel_real_boundary (GimpChannel *channel,
const BoundSeg **segs_in,
const BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2)
gimp_channel_real_boundary (GimpChannel *channel,
const GimpBoundSeg **segs_in,
const GimpBoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2)
{
gint x3, y3, x4, y4;
PixelRegion bPR;
@ -1025,10 +1025,10 @@ gimp_channel_real_boundary (GimpChannel *channel,
gimp_drawable_get_tiles (GIMP_DRAWABLE (channel)),
x3, y3, x4 - x3, y4 - y3, FALSE);
channel->segs_out = boundary_find (&bPR, BOUNDARY_IGNORE_BOUNDS,
x1, y1, x2, y2,
BOUNDARY_HALF_WAY,
&channel->num_segs_out);
channel->segs_out = gimp_boundary_find (&bPR, GIMP_BOUNDARY_IGNORE_BOUNDS,
x1, y1, x2, y2,
GIMP_BOUNDARY_HALF_WAY,
&channel->num_segs_out);
x1 = MAX (x1, x3);
y1 = MAX (y1, y3);
x2 = MIN (x2, x4);
@ -1042,10 +1042,10 @@ gimp_channel_real_boundary (GimpChannel *channel,
gimp_item_get_width (GIMP_ITEM (channel)),
gimp_item_get_height (GIMP_ITEM (channel)), FALSE);
channel->segs_in = boundary_find (&bPR, BOUNDARY_WITHIN_BOUNDS,
x1, y1, x2, y2,
BOUNDARY_HALF_WAY,
&channel->num_segs_in);
channel->segs_in = gimp_boundary_find (&bPR, GIMP_BOUNDARY_WITHIN_BOUNDS,
x1, y1, x2, y2,
GIMP_BOUNDARY_HALF_WAY,
&channel->num_segs_in);
}
else
{
@ -1929,15 +1929,15 @@ gimp_channel_new_mask (GimpImage *image,
}
gboolean
gimp_channel_boundary (GimpChannel *channel,
const BoundSeg **segs_in,
const BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2)
gimp_channel_boundary (GimpChannel *channel,
const GimpBoundSeg **segs_in,
const GimpBoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2)
{
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
g_return_val_if_fail (segs_in != NULL, FALSE);

View File

@ -45,8 +45,8 @@ struct _GimpChannel
/* Selection mask variables */
gboolean boundary_known; /* is the current boundary valid */
BoundSeg *segs_in; /* outline of selected region */
BoundSeg *segs_out; /* outline of selected region */
GimpBoundSeg *segs_in; /* outline of selected region */
GimpBoundSeg *segs_out; /* outline of selected region */
gint num_segs_in; /* number of lines in boundary */
gint num_segs_out; /* number of lines in boundary */
gboolean empty; /* is the region empty? */
@ -60,53 +60,53 @@ struct _GimpChannelClass
GimpDrawableClass parent_class;
/* signals */
void (* color_changed) (GimpChannel *channel);
void (* color_changed) (GimpChannel *channel);
/* virtual functions */
gboolean (* boundary) (GimpChannel *channel,
const BoundSeg **segs_in,
const BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
gboolean (* bounds) (GimpChannel *channel,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gboolean (* is_empty) (GimpChannel *channel);
gboolean (* boundary) (GimpChannel *channel,
const GimpBoundSeg **segs_in,
const GimpBoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
gboolean (* bounds) (GimpChannel *channel,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gboolean (* is_empty) (GimpChannel *channel);
void (* feather) (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
gboolean push_undo);
void (* sharpen) (GimpChannel *channel,
gboolean push_undo);
void (* clear) (GimpChannel *channel,
const gchar *undo_desc,
gboolean push_undo);
void (* all) (GimpChannel *channel,
gboolean push_undo);
void (* invert) (GimpChannel *channel,
gboolean push_undo);
void (* border) (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean feather,
gboolean edge_lock,
gboolean push_undo);
void (* grow) (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean push_undo);
void (* shrink) (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean edge_lock,
gboolean push_undo);
void (* feather) (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
gboolean push_undo);
void (* sharpen) (GimpChannel *channel,
gboolean push_undo);
void (* clear) (GimpChannel *channel,
const gchar *undo_desc,
gboolean push_undo);
void (* all) (GimpChannel *channel,
gboolean push_undo);
void (* invert) (GimpChannel *channel,
gboolean push_undo);
void (* border) (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean feather,
gboolean edge_lock,
gboolean push_undo);
void (* grow) (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean push_undo);
void (* shrink) (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean edge_lock,
gboolean push_undo);
const gchar *feather_desc;
const gchar *sharpen_desc;
@ -161,56 +161,56 @@ void gimp_channel_push_undo (GimpChannel *mask,
/* selection mask functions */
GimpChannel * gimp_channel_new_mask (GimpImage *image,
gint width,
gint height);
GimpChannel * gimp_channel_new_mask (GimpImage *image,
gint width,
gint height);
gboolean gimp_channel_boundary (GimpChannel *mask,
const BoundSeg **segs_in,
const BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
gboolean gimp_channel_bounds (GimpChannel *mask,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gboolean gimp_channel_is_empty (GimpChannel *mask);
gboolean gimp_channel_boundary (GimpChannel *mask,
const GimpBoundSeg **segs_in,
const GimpBoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
gboolean gimp_channel_bounds (GimpChannel *mask,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gboolean gimp_channel_is_empty (GimpChannel *mask);
void gimp_channel_feather (GimpChannel *mask,
gdouble radius_x,
gdouble radius_y,
gboolean push_undo);
void gimp_channel_sharpen (GimpChannel *mask,
gboolean push_undo);
void gimp_channel_feather (GimpChannel *mask,
gdouble radius_x,
gdouble radius_y,
gboolean push_undo);
void gimp_channel_sharpen (GimpChannel *mask,
gboolean push_undo);
void gimp_channel_clear (GimpChannel *mask,
const gchar *undo_desc,
gboolean push_undo);
void gimp_channel_all (GimpChannel *mask,
gboolean push_undo);
void gimp_channel_invert (GimpChannel *mask,
gboolean push_undo);
void gimp_channel_clear (GimpChannel *mask,
const gchar *undo_desc,
gboolean push_undo);
void gimp_channel_all (GimpChannel *mask,
gboolean push_undo);
void gimp_channel_invert (GimpChannel *mask,
gboolean push_undo);
void gimp_channel_border (GimpChannel *mask,
gint radius_x,
gint radius_y,
gboolean feather,
gboolean edge_lock,
gboolean push_undo);
void gimp_channel_grow (GimpChannel *mask,
gint radius_x,
gint radius_y,
gboolean push_undo);
void gimp_channel_shrink (GimpChannel *mask,
gint radius_x,
gint radius_y,
gboolean edge_lock,
gboolean push_undo);
void gimp_channel_border (GimpChannel *mask,
gint radius_x,
gint radius_y,
gboolean feather,
gboolean edge_lock,
gboolean push_undo);
void gimp_channel_grow (GimpChannel *mask,
gint radius_x,
gint radius_y,
gboolean push_undo);
void gimp_channel_shrink (GimpChannel *mask,
gint radius_x,
gint radius_y,
gboolean edge_lock,
gboolean push_undo);
#endif /* __GIMP_CHANNEL_H__ */

View File

@ -56,32 +56,32 @@
/* local function prototypes */
static GimpScanConvert * gimp_drawable_render_boundary (GimpDrawable *drawable,
const BoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y);
static GimpScanConvert * gimp_drawable_render_vectors (GimpDrawable *drawable,
GimpVectors *vectors,
gboolean do_stroke,
GError **error);
static void gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
GimpFillOptions *options,
GimpScanConvert *scan_convert,
gboolean do_stroke,
gboolean push_undo);
static GimpScanConvert * gimp_drawable_render_boundary (GimpDrawable *drawable,
const GimpBoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y);
static GimpScanConvert * gimp_drawable_render_vectors (GimpDrawable *drawable,
GimpVectors *vectors,
gboolean do_stroke,
GError **error);
static void gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
GimpFillOptions *options,
GimpScanConvert *scan_convert,
gboolean do_stroke,
gboolean push_undo);
/* public functions */
void
gimp_drawable_fill_boundary (GimpDrawable *drawable,
GimpFillOptions *options,
const BoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y,
gboolean push_undo)
gimp_drawable_fill_boundary (GimpDrawable *drawable,
GimpFillOptions *options,
const GimpBoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y,
gboolean push_undo)
{
GimpScanConvert *scan_convert;
@ -106,13 +106,13 @@ gimp_drawable_fill_boundary (GimpDrawable *drawable,
}
void
gimp_drawable_stroke_boundary (GimpDrawable *drawable,
GimpStrokeOptions *options,
const BoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y,
gboolean push_undo)
gimp_drawable_stroke_boundary (GimpDrawable *drawable,
GimpStrokeOptions *options,
const GimpBoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y,
gboolean push_undo)
{
GimpScanConvert *scan_convert;
@ -206,18 +206,19 @@ gimp_drawable_stroke_vectors (GimpDrawable *drawable,
/* private functions */
static GimpScanConvert *
gimp_drawable_render_boundary (GimpDrawable *drawable,
const BoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y)
gimp_drawable_render_boundary (GimpDrawable *drawable,
const GimpBoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y)
{
if (bound_segs)
{
BoundSeg *stroke_segs;
gint n_stroke_segs;
GimpBoundSeg *stroke_segs;
gint n_stroke_segs;
stroke_segs = boundary_sort (bound_segs, n_bound_segs, &n_stroke_segs);
stroke_segs = gimp_boundary_sort (bound_segs, n_bound_segs,
&n_stroke_segs);
if (stroke_segs)
{

View File

@ -24,14 +24,14 @@
void gimp_drawable_fill_boundary (GimpDrawable *drawable,
GimpFillOptions *options,
const BoundSeg *bound_segs,
const GimpBoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y,
gboolean push_undo);
void gimp_drawable_stroke_boundary (GimpDrawable *drawable,
GimpStrokeOptions *options,
const BoundSeg *bound_segs,
const GimpBoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y,

View File

@ -186,7 +186,7 @@ floating_sel_activate_drawable (GimpLayer *layer)
}
}
const BoundSeg *
const GimpBoundSeg *
floating_sel_boundary (GimpLayer *layer,
gint *n_segs)
{
@ -215,10 +215,10 @@ floating_sel_boundary (GimpLayer *layer,
pixel_region_init (&bPR,
gimp_drawable_get_tiles (GIMP_DRAWABLE (layer)),
0, 0, width, height, FALSE);
layer->fs.segs = boundary_find (&bPR, BOUNDARY_WITHIN_BOUNDS,
0, 0, width, height,
BOUNDARY_HALF_WAY,
&layer->fs.num_segs);
layer->fs.segs = gimp_boundary_find (&bPR, GIMP_BOUNDARY_WITHIN_BOUNDS,
0, 0, width, height,
GIMP_BOUNDARY_HALF_WAY,
&layer->fs.num_segs);
/* offset the segments */
for (i = 0; i < layer->fs.num_segs; i++)
@ -232,7 +232,7 @@ floating_sel_boundary (GimpLayer *layer,
else
{
layer->fs.num_segs = 4;
layer->fs.segs = g_new0 (BoundSeg, 4);
layer->fs.segs = g_new0 (GimpBoundSeg, 4);
/* top */
layer->fs.segs[0].x1 = off_x;

View File

@ -19,15 +19,15 @@
#define __GIMP_LAYER_FLOATING_SEL_H__
void floating_sel_attach (GimpLayer *layer,
GimpDrawable *drawable);
void floating_sel_anchor (GimpLayer *layer);
gboolean floating_sel_to_layer (GimpLayer *layer,
GError **error);
void floating_sel_activate_drawable (GimpLayer *layer);
const BoundSeg * floating_sel_boundary (GimpLayer *layer,
gint *n_segs);
void floating_sel_invalidate (GimpLayer *layer);
void floating_sel_attach (GimpLayer *layer,
GimpDrawable *drawable);
void floating_sel_anchor (GimpLayer *layer);
gboolean floating_sel_to_layer (GimpLayer *layer,
GError **error);
void floating_sel_activate_drawable (GimpLayer *layer);
const GimpBoundSeg * floating_sel_boundary (GimpLayer *layer,
gint *n_segs);
void floating_sel_invalidate (GimpLayer *layer);
#endif /* __GIMP_LAYER_FLOATING_SEL_H__ */

View File

@ -492,7 +492,7 @@ gimp_layer_get_memsize (GimpObject *object,
memsize += gimp_object_get_memsize (GIMP_OBJECT (layer->mask), gui_size);
*gui_size += layer->fs.num_segs * sizeof (BoundSeg);
*gui_size += layer->fs.num_segs * sizeof (GimpBoundSeg);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);

View File

@ -52,7 +52,7 @@ struct _GimpLayer
{
GimpDrawable *drawable; /* floating sel is attached to */
gboolean boundary_known; /* is the current boundary valid */
BoundSeg *segs; /* boundary of floating sel */
GimpBoundSeg *segs; /* boundary of floating sel */
gint num_segs; /* number of segs in boundary */
} fs;
};

View File

@ -45,87 +45,87 @@
#include "gimp-intl.h"
static gboolean gimp_selection_is_attached (const GimpItem *item);
static GimpItemTree * gimp_selection_get_tree (GimpItem *item);
static void gimp_selection_translate (GimpItem *item,
gint offset_x,
gint offset_y,
gboolean push_undo);
static void gimp_selection_scale (GimpItem *item,
gint new_width,
gint new_height,
gint new_offset_x,
gint new_offset_y,
static gboolean gimp_selection_is_attached (const GimpItem *item);
static GimpItemTree * gimp_selection_get_tree (GimpItem *item);
static void gimp_selection_translate (GimpItem *item,
gint offset_x,
gint offset_y,
gboolean push_undo);
static void gimp_selection_scale (GimpItem *item,
gint new_width,
gint new_height,
gint new_offset_x,
gint new_offset_y,
GimpInterpolationType interp_type,
GimpProgress *progress);
static void gimp_selection_resize (GimpItem *item,
GimpContext *context,
gint new_width,
gint new_height,
gint offset_x,
gint offset_y);
static void gimp_selection_flip (GimpItem *item,
GimpContext *context,
GimpOrientationType flip_type,
gdouble axis,
gboolean clip_result);
static void gimp_selection_rotate (GimpItem *item,
GimpContext *context,
GimpRotationType rotation_type,
gdouble center_x,
gdouble center_y,
gboolean clip_result);
static gboolean gimp_selection_stroke (GimpItem *item,
GimpDrawable *drawable,
GimpStrokeOptions *stroke_options,
gboolean push_undo,
GimpProgress *progress,
GError **error);
static void gimp_selection_invalidate_boundary (GimpDrawable *drawable);
GimpProgress *progress);
static void gimp_selection_resize (GimpItem *item,
GimpContext *context,
gint new_width,
gint new_height,
gint offset_x,
gint offset_y);
static void gimp_selection_flip (GimpItem *item,
GimpContext *context,
GimpOrientationType flip_type,
gdouble axis,
gboolean clip_result);
static void gimp_selection_rotate (GimpItem *item,
GimpContext *context,
GimpRotationType rotation_type,
gdouble center_x,
gdouble center_y,
gboolean clip_result);
static gboolean gimp_selection_stroke (GimpItem *item,
GimpDrawable *drawable,
GimpStrokeOptions *stroke_options,
gboolean push_undo,
GimpProgress *progress,
GError **error);
static void gimp_selection_invalidate_boundary (GimpDrawable *drawable);
static gboolean gimp_selection_boundary (GimpChannel *channel,
const BoundSeg **segs_in,
const BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
static gboolean gimp_selection_bounds (GimpChannel *channel,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
static gboolean gimp_selection_is_empty (GimpChannel *channel);
static void gimp_selection_feather (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
gboolean push_undo);
static void gimp_selection_sharpen (GimpChannel *channel,
gboolean push_undo);
static void gimp_selection_clear (GimpChannel *channel,
const gchar *undo_desc,
gboolean push_undo);
static void gimp_selection_all (GimpChannel *channel,
gboolean push_undo);
static void gimp_selection_invert (GimpChannel *channel,
gboolean push_undo);
static void gimp_selection_border (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean feather,
gboolean edge_lock,
gboolean push_undo);
static void gimp_selection_grow (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean push_undo);
static void gimp_selection_shrink (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean edge_lock,
gboolean push_undo);
static gboolean gimp_selection_boundary (GimpChannel *channel,
const GimpBoundSeg **segs_in,
const GimpBoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint x1,
gint y1,
gint x2,
gint y2);
static gboolean gimp_selection_bounds (GimpChannel *channel,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
static gboolean gimp_selection_is_empty (GimpChannel *channel);
static void gimp_selection_feather (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
gboolean push_undo);
static void gimp_selection_sharpen (GimpChannel *channel,
gboolean push_undo);
static void gimp_selection_clear (GimpChannel *channel,
const gchar *undo_desc,
gboolean push_undo);
static void gimp_selection_all (GimpChannel *channel,
gboolean push_undo);
static void gimp_selection_invert (GimpChannel *channel,
gboolean push_undo);
static void gimp_selection_border (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean feather,
gboolean edge_lock,
gboolean push_undo);
static void gimp_selection_grow (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean push_undo);
static void gimp_selection_shrink (GimpChannel *channel,
gint radius_x,
gint radius_y,
gboolean edge_lock,
gboolean push_undo);
G_DEFINE_TYPE (GimpSelection, gimp_selection, GIMP_TYPE_CHANNEL)
@ -270,12 +270,12 @@ gimp_selection_stroke (GimpItem *item,
GimpProgress *progress,
GError **error)
{
GimpSelection *selection = GIMP_SELECTION (item);
const BoundSeg *dummy_in;
const BoundSeg *dummy_out;
gint num_dummy_in;
gint num_dummy_out;
gboolean retval;
GimpSelection *selection = GIMP_SELECTION (item);
const GimpBoundSeg *dummy_in;
const GimpBoundSeg *dummy_out;
gint num_dummy_in;
gint num_dummy_out;
gboolean retval;
if (! gimp_channel_boundary (GIMP_CHANNEL (selection),
&dummy_in, &dummy_out,
@ -326,15 +326,15 @@ gimp_selection_invalidate_boundary (GimpDrawable *drawable)
}
static gboolean
gimp_selection_boundary (GimpChannel *channel,
const BoundSeg **segs_in,
const BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint unused1,
gint unused2,
gint unused3,
gint unused4)
gimp_selection_boundary (GimpChannel *channel,
const GimpBoundSeg **segs_in,
const GimpBoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out,
gint unused1,
gint unused2,
gint unused3,
gint unused4)
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (channel));
GimpDrawable *drawable;

View File

@ -52,11 +52,11 @@ typedef struct _GimpCanvasBoundaryPrivate GimpCanvasBoundaryPrivate;
struct _GimpCanvasBoundaryPrivate
{
BoundSeg *segs;
gint n_segs;
GimpMatrix3 *transform;
gdouble offset_x;
gdouble offset_y;
GimpBoundSeg *segs;
gint n_segs;
GimpMatrix3 *transform;
gdouble offset_x;
gdouble offset_y;
};
#define GET_PRIVATE(boundary) \
@ -343,12 +343,12 @@ gimp_canvas_boundary_get_extents (GimpCanvasItem *item,
}
GimpCanvasItem *
gimp_canvas_boundary_new (GimpDisplayShell *shell,
const BoundSeg *segs,
gint n_segs,
GimpMatrix3 *transform,
gdouble offset_x,
gdouble offset_y)
gimp_canvas_boundary_new (GimpDisplayShell *shell,
const GimpBoundSeg *segs,
gint n_segs,
GimpMatrix3 *transform,
gdouble offset_x,
gdouble offset_y)
{
GimpCanvasItem *item;
GimpCanvasBoundaryPrivate *private;
@ -364,7 +364,7 @@ gimp_canvas_boundary_new (GimpDisplayShell *shell,
private = GET_PRIVATE (item);
/* puke */
private->segs = g_memdup (segs, n_segs * sizeof (BoundSeg));
private->segs = g_memdup (segs, n_segs * sizeof (GimpBoundSeg));
private->n_segs = n_segs;
return item;

View File

@ -49,12 +49,12 @@ struct _GimpCanvasBoundaryClass
GType gimp_canvas_boundary_get_type (void) G_GNUC_CONST;
GimpCanvasItem * gimp_canvas_boundary_new (GimpDisplayShell *shell,
const BoundSeg *segs,
gint n_segs,
GimpMatrix3 *transform,
gdouble offset_x,
gdouble offset_y);
GimpCanvasItem * gimp_canvas_boundary_new (GimpDisplayShell *shell,
const GimpBoundSeg *segs,
gint n_segs,
GimpMatrix3 *transform,
gdouble offset_x,
gdouble offset_y);
#endif /* __GIMP_CANVAS_BOUNDARY_H__ */

View File

@ -61,23 +61,23 @@ struct _Selection
/* local function prototypes */
static void selection_start (Selection *selection);
static void selection_stop (Selection *selection);
static void selection_start (Selection *selection);
static void selection_stop (Selection *selection);
static void selection_draw (Selection *selection);
static void selection_undraw (Selection *selection);
static void selection_draw (Selection *selection);
static void selection_undraw (Selection *selection);
static void selection_render_mask (Selection *selection);
static void selection_render_mask (Selection *selection);
static void selection_transform_segs (Selection *selection,
const BoundSeg *src_segs,
GimpSegment *dest_segs,
gint n_segs);
static void selection_generate_segs (Selection *selection);
static void selection_free_segs (Selection *selection);
static void selection_transform_segs (Selection *selection,
const GimpBoundSeg *src_segs,
GimpSegment *dest_segs,
gint n_segs);
static void selection_generate_segs (Selection *selection);
static void selection_free_segs (Selection *selection);
static gboolean selection_start_timeout (Selection *selection);
static gboolean selection_timeout (Selection *selection);
static gboolean selection_start_timeout (Selection *selection);
static gboolean selection_timeout (Selection *selection);
static gboolean selection_window_state_event (GtkWidget *shell,
GdkEventWindowState *event,
@ -305,10 +305,10 @@ selection_render_mask (Selection *selection)
}
static void
selection_transform_segs (Selection *selection,
const BoundSeg *src_segs,
GimpSegment *dest_segs,
gint n_segs)
selection_transform_segs (Selection *selection,
const GimpBoundSeg *src_segs,
GimpSegment *dest_segs,
gint n_segs)
{
const gint xclamp = selection->shell->disp_width + 1;
const gint yclamp = selection->shell->disp_height + 1;
@ -351,9 +351,9 @@ selection_transform_segs (Selection *selection,
static void
selection_generate_segs (Selection *selection)
{
GimpImage *image = gimp_display_get_image (selection->shell->display);
const BoundSeg *segs_in;
const BoundSeg *segs_out;
GimpImage *image = gimp_display_get_image (selection->shell->display);
const GimpBoundSeg *segs_in;
const GimpBoundSeg *segs_out;
/* Ask the image for the boundary of its selected region...
* Then transform that information into a new buffer of GimpSegments

View File

@ -234,7 +234,7 @@ gimp_display_shell_untransform_xy_f (const GimpDisplayShell *shell,
**/
void
gimp_display_shell_transform_segments (const GimpDisplayShell *shell,
const BoundSeg *src_segs,
const GimpBoundSeg *src_segs,
GimpSegment *dest_segs,
gint n_segs,
gdouble offset_x,

View File

@ -50,7 +50,7 @@ void gimp_display_shell_untransform_xy_f (const GimpDisplayShell *shell,
gdouble *ny);
void gimp_display_shell_transform_segments (const GimpDisplayShell *shell,
const BoundSeg *src_segs,
const GimpBoundSeg *src_segs,
GimpSegment *dest_segs,
gint n_segs,
gdouble offset_x,

View File

@ -96,26 +96,26 @@ gimp_paint_core_stroke (GimpPaintCore *core,
}
gboolean
gimp_paint_core_stroke_boundary (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
gboolean emulate_dynamics,
const BoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y,
gboolean push_undo,
GError **error)
gimp_paint_core_stroke_boundary (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
gboolean emulate_dynamics,
const GimpBoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y,
gboolean push_undo,
GError **error)
{
BoundSeg *stroke_segs;
gint n_stroke_segs;
gint off_x;
gint off_y;
GimpCoords *coords;
gboolean initialized = FALSE;
gint n_coords;
gint seg;
gint s;
GimpBoundSeg *stroke_segs;
gint n_stroke_segs;
gint off_x;
gint off_y;
GimpCoords *coords;
gboolean initialized = FALSE;
gint n_coords;
gint seg;
gint s;
g_return_val_if_fail (GIMP_IS_PAINT_CORE (core), FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
@ -124,7 +124,8 @@ gimp_paint_core_stroke_boundary (GimpPaintCore *core,
g_return_val_if_fail (bound_segs != NULL && n_bound_segs > 0, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
stroke_segs = boundary_sort (bound_segs, n_bound_segs, &n_stroke_segs);
stroke_segs = gimp_boundary_sort (bound_segs, n_bound_segs,
&n_stroke_segs);
if (n_stroke_segs == 0)
return TRUE;

View File

@ -19,30 +19,30 @@
#define __GIMP_PAINT_CORE_STROKE_H__
gboolean gimp_paint_core_stroke (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
GimpCoords *strokes,
gint n_strokes,
gboolean push_undo,
GError **error);
gboolean gimp_paint_core_stroke_boundary (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
gboolean emulate_dynamics,
const BoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y,
gboolean push_undo,
GError **error);
gboolean gimp_paint_core_stroke_vectors (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
gboolean emulate_dynamics,
GimpVectors *vectors,
gboolean push_undo,
GError **error);
gboolean gimp_paint_core_stroke (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
GimpCoords *strokes,
gint n_strokes,
gboolean push_undo,
GError **error);
gboolean gimp_paint_core_stroke_boundary (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
gboolean emulate_dynamics,
const GimpBoundSeg *bound_segs,
gint n_bound_segs,
gint offset_x,
gint offset_y,
gboolean push_undo,
GError **error);
gboolean gimp_paint_core_stroke_vectors (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
gboolean emulate_dynamics,
GimpVectors *vectors,
gboolean push_undo,
GError **error);
#endif /* __GIMP_PAINT_CORE_STROKE_H__ */

View File

@ -860,12 +860,12 @@ gimp_draw_tool_add_pen (GimpDrawTool *draw_tool,
* indicate the end of connected segment sequences (groups) .
*/
GimpCanvasItem *
gimp_draw_tool_add_boundary (GimpDrawTool *draw_tool,
const BoundSeg *bound_segs,
gint n_bound_segs,
GimpMatrix3 *transform,
gdouble offset_x,
gdouble offset_y)
gimp_draw_tool_add_boundary (GimpDrawTool *draw_tool,
const GimpBoundSeg *bound_segs,
gint n_bound_segs,
GimpMatrix3 *transform,
gdouble offset_x,
gdouble offset_y)
{
GimpCanvasItem *item;

View File

@ -199,7 +199,7 @@ GimpCanvasItem * gimp_draw_tool_add_pen (GimpDrawTool *draw_too
gint width);
GimpCanvasItem * gimp_draw_tool_add_boundary (GimpDrawTool *draw_tool,
const BoundSeg *bound_segs,
const GimpBoundSeg *bound_segs,
gint n_bound_segs,
GimpMatrix3 *transform,
gdouble offset_x,

View File

@ -76,8 +76,8 @@ struct _GimpEditSelectionTool
gint x, y; /* Current x and y coords */
gint num_segs_in; /* Num seg in selection boundary */
gint num_segs_out; /* Num seg in selection boundary */
BoundSeg *segs_in; /* Pointer to the channel sel. segs */
BoundSeg *segs_out; /* Pointer to the channel sel. segs */
GimpBoundSeg *segs_in; /* Pointer to the channel sel. segs */
GimpBoundSeg *segs_out; /* Pointer to the channel sel. segs */
gint x1, y1; /* Bounding box of selection mask */
gint x2, y2;
@ -193,8 +193,8 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
GimpItem *active_item;
GimpChannel *channel;
gint off_x, off_y;
const BoundSeg *segs_in;
const BoundSeg *segs_out;
const GimpBoundSeg *segs_in;
const GimpBoundSeg *segs_out;
const gchar *undo_desc;
edit_select = g_object_new (GIMP_TYPE_EDIT_SELECTION_TOOL,
@ -282,10 +282,10 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
0, 0, 0, 0);
edit_select->segs_in = g_memdup (segs_in,
edit_select->num_segs_in * sizeof (BoundSeg));
edit_select->num_segs_in * sizeof (GimpBoundSeg));
edit_select->segs_out = g_memdup (segs_out,
edit_select->num_segs_out * sizeof (BoundSeg));
edit_select->num_segs_out * sizeof (GimpBoundSeg));
if (edit_select->edit_mode == GIMP_TRANSLATE_MODE_VECTORS)
{

View File

@ -758,7 +758,7 @@ gimp_rectangle_select_tool_execute (GimpRectangleTool *rectangle,
/* if the click was inside the marching ants */
if (gimp_pickable_get_opacity_at (GIMP_PICKABLE (selection),
pressx, pressy) > BOUNDARY_HALF_WAY)
pressx, pressy) > GIMP_BOUNDARY_HALF_WAY)
{
gint x1, y1, x2, y2;

View File

@ -71,9 +71,9 @@ static void gimp_region_select_tool_cursor_update (GimpTool *too
static void gimp_region_select_tool_draw (GimpDrawTool *draw_tool);
static BoundSeg * gimp_region_select_tool_calculate (GimpRegionSelectTool *region_sel,
GimpDisplay *display,
gint *n_segs);
static GimpBoundSeg * gimp_region_select_tool_calculate (GimpRegionSelectTool *region_sel,
GimpDisplay *display,
gint *n_segs);
G_DEFINE_TYPE (GimpRegionSelectTool, gimp_region_select_tool,
@ -339,13 +339,13 @@ gimp_region_select_tool_draw (GimpDrawTool *draw_tool)
}
}
static BoundSeg *
static GimpBoundSeg *
gimp_region_select_tool_calculate (GimpRegionSelectTool *region_sel,
GimpDisplay *display,
gint *n_segs)
{
GimpDisplayShell *shell = gimp_display_get_shell (display);
BoundSeg *segs;
GimpBoundSeg *segs;
PixelRegion maskPR;
gimp_display_shell_set_override_cursor (shell, GDK_WATCH);
@ -375,12 +375,12 @@ gimp_region_select_tool_calculate (GimpRegionSelectTool *region_sel,
gimp_item_get_height (GIMP_ITEM (region_sel->region_mask)),
FALSE);
segs = boundary_find (&maskPR, BOUNDARY_WITHIN_BOUNDS,
0, 0,
gimp_item_get_width (GIMP_ITEM (region_sel->region_mask)),
gimp_item_get_height (GIMP_ITEM (region_sel->region_mask)),
BOUNDARY_HALF_WAY,
n_segs);
segs = gimp_boundary_find (&maskPR, GIMP_BOUNDARY_WITHIN_BOUNDS,
0, 0,
gimp_item_get_width (GIMP_ITEM (region_sel->region_mask)),
gimp_item_get_height (GIMP_ITEM (region_sel->region_mask)),
GIMP_BOUNDARY_HALF_WAY,
n_segs);
gimp_display_shell_unset_override_cursor (shell);

View File

@ -45,7 +45,7 @@ struct _GimpRegionSelectTool
gdouble saved_threshold;
GimpChannel *region_mask;
BoundSeg *segs;
GimpBoundSeg *segs;
gint n_segs;
};

View File

@ -835,21 +835,21 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
if (options->type == GIMP_TRANSFORM_TYPE_SELECTION)
{
GimpMatrix3 matrix = tr_tool->transform;
const BoundSeg *orig_in;
const BoundSeg *orig_out;
BoundSeg *segs_in;
BoundSeg *segs_out;
gint num_segs_in;
gint num_segs_out;
GimpMatrix3 matrix = tr_tool->transform;
const GimpBoundSeg *orig_in;
const GimpBoundSeg *orig_out;
GimpBoundSeg *segs_in;
GimpBoundSeg *segs_out;
gint num_segs_in;
gint num_segs_out;
gimp_channel_boundary (gimp_image_get_mask (image),
&orig_in, &orig_out,
&num_segs_in, &num_segs_out,
0, 0, 0, 0);
segs_in = g_memdup (orig_in, num_segs_in * sizeof (BoundSeg));
segs_out = g_memdup (orig_out, num_segs_out * sizeof (BoundSeg));
segs_in = g_memdup (orig_in, num_segs_in * sizeof (GimpBoundSeg));
segs_out = g_memdup (orig_out, num_segs_out * sizeof (GimpBoundSeg));
if (segs_in)
{