void select_all_cmd_callback (GtkAction *action, gpointer data) { GimpImage *image; return_if_no_image (image, data); gimp_channel_all (gimp_image_get_mask (image), TRUE); gimp_image_flush (image); }
void gimp_channel_select_alpha (GimpChannel *channel, GimpDrawable *drawable, GimpChannelOps op, gboolean feather, gdouble feather_radius_x, gdouble feather_radius_y) { GimpItem *item; GimpChannel *add_on; gint off_x, off_y; 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)); item = GIMP_ITEM (channel); if (gimp_drawable_has_alpha (drawable)) { add_on = gimp_channel_new_from_alpha (gimp_item_get_image (item), drawable, NULL, NULL); } else { /* no alpha is equivalent to completely opaque alpha, * so simply select the whole layer's extents. --mitch */ add_on = gimp_channel_new_mask (gimp_item_get_image (item), gimp_item_get_width (GIMP_ITEM (drawable)), gimp_item_get_height (GIMP_ITEM (drawable))); gimp_channel_all (add_on, FALSE); } gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y); gimp_channel_select_channel (channel, C_("undo-type", "Alpha to Selection"), add_on, off_x, off_y, op, feather, feather_radius_x, feather_radius_y); g_object_unref (add_on); }
static GimpValueArray * selection_all_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; GimpImage *image; image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp); if (success) { gimp_channel_all (gimp_image_get_mask (image), TRUE); } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }