void gimp_edit_clear (GimpImage *image, GimpDrawable *drawable, GimpContext *context) { GimpFillOptions *options; g_return_if_fail (GIMP_IS_IMAGE (image)); g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable))); g_return_if_fail (GIMP_IS_CONTEXT (context)); options = gimp_fill_options_new (context->gimp); if (gimp_drawable_has_alpha (drawable)) gimp_fill_options_set_by_fill_type (options, context, GIMP_FILL_TRANSPARENT, NULL); else gimp_fill_options_set_by_fill_type (options, context, GIMP_FILL_BACKGROUND, NULL); gimp_edit_fill (image, drawable, options, C_("undo-type", "Clear")); g_object_unref (options); }
void edit_fill_cmd_callback (GtkAction *action, gint value, gpointer data) { GimpImage *image; GimpDrawable *drawable; GimpFillType fill_type; GimpFillOptions *options; GError *error = NULL; return_if_no_drawable (image, drawable, data); fill_type = (GimpFillType) value; options = gimp_fill_options_new (action_data_get_gimp (data), NULL, FALSE); if (gimp_fill_options_set_by_fill_type (options, action_data_get_context (data), fill_type, &error)) { gimp_edit_fill (image, drawable, options, NULL); gimp_image_flush (image); } else { gimp_message_literal (image->gimp, NULL, GIMP_MESSAGE_WARNING, error->message); g_clear_error (&error); } g_object_unref (options); }