2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1997-11-25 06:05:25 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1997-11-25 06:05:25 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-28 10:01:16 +08:00
|
|
|
|
2012-03-19 22:04:20 +08:00
|
|
|
#ifndef __GIMP_BOUNDARY_H__
|
|
|
|
#define __GIMP_BOUNDARY_H__
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
2003-07-10 19:59:38 +08:00
|
|
|
/* half intensity for mask */
|
2012-04-22 02:10:45 +08:00
|
|
|
#define GIMP_BOUNDARY_HALF_WAY 0.5
|
2003-07-10 19:59:38 +08:00
|
|
|
|
|
|
|
|
2000-12-28 10:01:16 +08:00
|
|
|
typedef enum
|
|
|
|
{
|
2012-03-19 22:04:20 +08:00
|
|
|
GIMP_BOUNDARY_WITHIN_BOUNDS,
|
|
|
|
GIMP_BOUNDARY_IGNORE_BOUNDS
|
|
|
|
} GimpBoundaryType;
|
2000-12-28 10:01:16 +08:00
|
|
|
|
|
|
|
|
2012-03-19 22:04:20 +08:00
|
|
|
struct _GimpBoundSeg
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-07-06 19:13:26 +08:00
|
|
|
gint x1;
|
|
|
|
gint y1;
|
|
|
|
gint x2;
|
|
|
|
gint y2;
|
|
|
|
guint open : 1;
|
|
|
|
guint visited : 1;
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-03-21 02:55:23 +08:00
|
|
|
GimpBoundSeg * gimp_boundary_find (GeglBuffer *buffer,
|
|
|
|
const GeglRectangle *region,
|
2012-04-22 02:10:45 +08:00
|
|
|
const Babl *format,
|
2012-03-21 02:55:23 +08:00
|
|
|
GimpBoundaryType type,
|
|
|
|
gint x1,
|
|
|
|
gint y1,
|
|
|
|
gint x2,
|
|
|
|
gint y2,
|
2012-04-22 02:10:45 +08:00
|
|
|
gfloat threshold,
|
2012-03-21 02:55:23 +08:00
|
|
|
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);
|
2003-10-01 08:02:48 +08:00
|
|
|
|
2010-09-23 16:47:59 +08:00
|
|
|
/* offsets in-place */
|
2012-03-21 02:55:23 +08:00
|
|
|
void gimp_boundary_offset (GimpBoundSeg *segs,
|
|
|
|
gint num_segs,
|
|
|
|
gint off_x,
|
|
|
|
gint off_y);
|
2010-09-23 16:47:59 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2012-03-19 22:04:20 +08:00
|
|
|
#endif /* __GIMP_BOUNDARY_H__ */
|