void gimp_channel_select_fuzzy (GimpChannel *channel, GimpDrawable *drawable, gboolean sample_merged, gint x, gint y, gfloat threshold, gboolean select_transparent, GimpSelectCriterion select_criterion, gboolean diagonal_neighbors, GimpChannelOps op, gboolean antialias, gboolean feather, gdouble feather_radius_x, gdouble feather_radius_y) { GimpPickable *pickable; GeglBuffer *add_on; gint add_on_x = 0; gint add_on_y = 0; g_return_if_fail (GIMP_IS_CHANNEL (channel)); g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel))); g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); if (sample_merged) pickable = GIMP_PICKABLE (gimp_item_get_image (GIMP_ITEM (drawable))); else pickable = GIMP_PICKABLE (drawable); add_on = gimp_pickable_contiguous_region_by_seed (pickable, antialias, threshold, select_transparent, select_criterion, diagonal_neighbors, x, y); if (! sample_merged) gimp_item_get_offset (GIMP_ITEM (drawable), &add_on_x, &add_on_y); gimp_channel_select_buffer (channel, C_("undo-type", "Fuzzy Select"), add_on, add_on_x, add_on_y, op, feather, feather_radius_x, feather_radius_y); g_object_unref (add_on); }
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_by_index (GimpChannel *channel, GimpDrawable *drawable, gint index, GimpChannelOps op, gboolean feather, gdouble feather_radius_x, gdouble feather_radius_y) { GeglBuffer *add_on; gint add_on_x = 0; gint add_on_y = 0; g_return_if_fail (GIMP_IS_CHANNEL (channel)); g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel))); g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); g_return_if_fail (gimp_drawable_is_indexed (drawable)); add_on = gegl_buffer_new (GEGL_RECTANGLE (0, 0, gimp_item_get_width (GIMP_ITEM (drawable)), gimp_item_get_height (GIMP_ITEM (drawable))), babl_format ("Y float")); gimp_gegl_index_to_mask (gimp_drawable_get_buffer (drawable), NULL, gimp_drawable_get_format_without_alpha (drawable), add_on, NULL, index); gimp_item_get_offset (GIMP_ITEM (drawable), &add_on_x, &add_on_y); gimp_channel_select_buffer (channel, C_("undo-type", "Select by Indexed Color"), add_on, add_on_x, add_on_y, op, feather, feather_radius_x, feather_radius_y); g_object_unref (add_on); }
static void gimp_foreground_select_tool_apply (GimpForegroundSelectTool *fg_select, GimpDisplay *display) { GimpTool *tool = GIMP_TOOL (fg_select); GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (fg_select); GimpImage *image = gimp_display_get_image (display); g_return_if_fail (fg_select->mask != NULL); gimp_channel_select_buffer (gimp_image_get_mask (image), C_("command", "Foreground Select"), fg_select->mask, 0, /* x offset */ 0, /* y offset */ options->operation, options->feather, options->feather_radius, options->feather_radius); gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display); gimp_image_flush (image); }