gimpboundary.h 2.49 KB
Newer Older
1
/* GIMP - The GNU Image Manipulation Program
Elliot Lee's avatar
Elliot Lee committed
2 3
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
4
 * This program is free software: you can redistribute it and/or modify
Elliot Lee's avatar
Elliot Lee committed
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
Elliot Lee's avatar
Elliot Lee committed
7 8 9 10 11 12 13 14
 * (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
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
Elliot Lee's avatar
Elliot Lee committed
16
 */
17

18 19
#ifndef  __GIMP_BOUNDARY_H__
#define  __GIMP_BOUNDARY_H__
Elliot Lee's avatar
Elliot Lee committed
20 21


22
/* half intensity for mask */
23
#define GIMP_BOUNDARY_HALF_WAY 0.5
24 25


26 27
typedef enum
{
28 29 30
  GIMP_BOUNDARY_WITHIN_BOUNDS,
  GIMP_BOUNDARY_IGNORE_BOUNDS
} GimpBoundaryType;
31 32


33
struct _GimpBoundSeg
Elliot Lee's avatar
Elliot Lee committed
34
{
Sven Neumann's avatar
Sven Neumann committed
35 36 37 38 39 40
  gint   x1;
  gint   y1;
  gint   x2;
  gint   y2;
  guint  open    : 1;
  guint  visited : 1;
Elliot Lee's avatar
Elliot Lee committed
41 42 43
};


44 45
GimpBoundSeg * gimp_boundary_find      (GeglBuffer          *buffer,
                                        const GeglRectangle *region,
46
                                        const Babl          *format,
47 48 49 50 51
                                        GimpBoundaryType     type,
                                        gint                 x1,
                                        gint                 y1,
                                        gint                 x2,
                                        gint                 y2,
52
                                        gfloat               threshold,
53 54 55 56 57 58 59
                                        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);
60

61
/* offsets in-place */
62 63 64 65
void       gimp_boundary_offset        (GimpBoundSeg        *segs,
                                        gint                 num_segs,
                                        gint                 off_x,
                                        gint                 off_y);
66

Elliot Lee's avatar
Elliot Lee committed
67

68
#endif  /*  __GIMP_BOUNDARY_H__  */