Commit 2c62644f authored by Michael Natterer's avatar Michael Natterer 😴

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

parent 9323c2f2
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
This diff is collapsed.
......@@ -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__ */
......@@ -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);
......
......@@ -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);
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 void gimp_channel_validate_tile (TileManager *tm,
Tile *tile);
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 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);
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);
......
......@@ -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);
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);
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);
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);
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);
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_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);
GimpChannel * gimp_channel_new_mask (GimpImage *image,
gint width,
gint height);
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_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);
#endif /* __GIMP_CHANNEL_H__ */
......@@ -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