Commit 75c9a0dc authored by Michael Natterer's avatar Michael Natterer 😴

app: factor out gimp_channel_select_buffer() from select_channel()

parent 3cb27561
......@@ -326,20 +326,20 @@ gimp_channel_select_vectors (GimpChannel *channel,
/* select by GimpChannel functions */
void
gimp_channel_select_channel (GimpChannel *channel,
const gchar *undo_desc,
GimpChannel *add_on,
gint offset_x,
gint offset_y,
GimpChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
gimp_channel_select_buffer (GimpChannel *channel,
const gchar *undo_desc,
GeglBuffer *add_on,
gint offset_x,
gint offset_y,
GimpChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
g_return_if_fail (undo_desc != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (add_on));
g_return_if_fail (GEGL_IS_BUFFER (add_on));
gimp_channel_push_undo (channel, undo_desc);
......@@ -350,7 +350,6 @@ gimp_channel_select_channel (GimpChannel *channel,
if (feather || op == GIMP_CHANNEL_OP_INTERSECT)
{
GimpItem *item = GIMP_ITEM (channel);
GeglBuffer *add_on_buffer;
GeglBuffer *add_on2;
add_on2 = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
......@@ -358,9 +357,7 @@ gimp_channel_select_channel (GimpChannel *channel,
gimp_item_get_height (item)),
babl_format ("Y float"));
add_on_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (add_on));
gimp_gegl_mask_combine_buffer (add_on2, add_on_buffer,
gimp_gegl_mask_combine_buffer (add_on2, add_on,
GIMP_CHANNEL_OP_ADD,
offset_x, offset_y);
......@@ -374,10 +371,33 @@ gimp_channel_select_channel (GimpChannel *channel,
}
else
{
gimp_channel_combine_mask (channel, add_on, op, offset_x, offset_y);
gimp_channel_combine_buffer (channel, add_on, op, offset_x, offset_y);
}
}
void
gimp_channel_select_channel (GimpChannel *channel,
const gchar *undo_desc,
GimpChannel *add_on,
gint offset_x,
gint offset_y,
GimpChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
g_return_if_fail (undo_desc != NULL);
g_return_if_fail (GIMP_IS_CHANNEL (add_on));
gimp_channel_select_buffer (channel, undo_desc,
gimp_drawable_get_buffer (GIMP_DRAWABLE (add_on)),
offset_x, offset_y, op,
feather,
feather_radius_x, feather_radius_y);
}
void
gimp_channel_select_alpha (GimpChannel *channel,
GimpDrawable *drawable,
......
......@@ -88,6 +88,15 @@ void gimp_channel_select_vectors (GimpChannel *channel,
gdouble feather_radius_x,
gdouble feather_radius_y,
gboolean push_undo);
void gimp_channel_select_buffer (GimpChannel *channel,
const gchar *undo_desc,
GeglBuffer *add_on,
gint offset_x,
gint offset_y,
GimpChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
/* select by GimpChannel functions */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment