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