| GIMP Application Reference Manual | ||||
|---|---|---|---|---|
#define BOUNDARY_HALF_WAY enum BoundaryType; 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);
typedef struct {
gint x1;
gint y1;
gint x2;
gint y2;
guint open : 1;
guint visited : 1;
} BoundSeg;
BoundSeg* boundary_find (PixelRegion *maskPR, BoundaryType type, gint x1, gint y1, gint x2, gint y2, guchar threshold, gint *num_segs);
This function returns an array of BoundSeg's which describe all
outlines along pixel value threahold, optionally within specified
bounds instead of the whole region.
The maskPR paramater can be any PixelRegion. If the region has
more than 1 bytes/pixel, the last byte of each pixel is used to
determine the boundary outline.
|
any PixelRegion |
|
type of bounds |
|
left side of bounds |
|
top side of bounds |
|
right side of bounds |
|
botton side of bounds |
|
pixel value of boundary line |
|
number of returned BoundSeg's |
Returns : |
the boundary array. |
BoundSeg* boundary_sort (const BoundSeg *segs, gint num_segs, gint *num_groups);
This function takes an array of BoundSeg's as returned by
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.
|
unsorted input segs. |
|
number of input segs |
|
number of groups in the sorted segs |
Returns : |
the sorted segs |
BoundSeg* boundary_simplify (BoundSeg *sorted_segs, gint num_groups, gint *num_segs);
This function takes an array of BoundSeg's which has been sorted
with boundary_sort() and reduces the number of segments while
preserving the general shape as close as possible.
|
sorted input segs |
|
number of groups in the sorted segs |
|
number of returned segs. |
Returns : |
the simplified segs. |