mirror of https://github.com/GNOME/gimp.git
app: change gimp_edit_fill() to take a GimpFillOptions
instead of a long list of parameters. Get rid of gimp_edit_fill_full().
This commit is contained in:
parent
00932b57af
commit
e1e77f88fa
|
@ -32,6 +32,7 @@
|
|||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpfilloptions.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplayer-new.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
@ -498,15 +499,19 @@ edit_fill_cmd_callback (GtkAction *action,
|
|||
GimpImage *image;
|
||||
GimpDrawable *drawable;
|
||||
GimpFillType fill_type;
|
||||
GimpFillOptions *options;
|
||||
GError *error = NULL;
|
||||
return_if_no_drawable (image, drawable, data);
|
||||
|
||||
fill_type = (GimpFillType) value;
|
||||
|
||||
if (gimp_edit_fill (image, drawable, action_data_get_context (data),
|
||||
fill_type, GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE,
|
||||
&error))
|
||||
options = gimp_fill_options_new (action_data_get_gimp (data));
|
||||
|
||||
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
|
||||
|
@ -515,6 +520,8 @@ edit_fill_cmd_callback (GtkAction *action,
|
|||
error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
g_object_unref (options);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "gimpbuffer.h"
|
||||
#include "gimpchannel.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimpfilloptions.h"
|
||||
#include "gimpdrawableundo.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gimpimage-undo.h"
|
||||
|
@ -399,99 +400,62 @@ gimp_edit_clear (GimpImage *image,
|
|||
GimpDrawable *drawable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpRGB background;
|
||||
GimpLayerModeEffects paint_mode;
|
||||
GimpFillOptions *options;
|
||||
gboolean success;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
|
||||
|
||||
gimp_context_get_background (context, &background);
|
||||
options = gimp_fill_options_new (context->gimp);
|
||||
|
||||
if (gimp_drawable_has_alpha (drawable))
|
||||
paint_mode = GIMP_ERASE_MODE;
|
||||
gimp_fill_options_set_by_fill_type (options, context,
|
||||
GIMP_FILL_TRANSPARENT, NULL);
|
||||
else
|
||||
paint_mode = GIMP_NORMAL_MODE;
|
||||
gimp_fill_options_set_by_fill_type (options, context,
|
||||
GIMP_FILL_BACKGROUND, NULL);
|
||||
|
||||
return gimp_edit_fill_full (image, drawable,
|
||||
&background, NULL,
|
||||
GIMP_OPACITY_OPAQUE, paint_mode,
|
||||
success = gimp_edit_fill (image, drawable, options,
|
||||
C_("undo-type", "Clear"));
|
||||
|
||||
g_object_unref (options);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_edit_fill (GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
GimpContext *context,
|
||||
GimpFillType fill_type,
|
||||
gdouble opacity,
|
||||
GimpLayerModeEffects paint_mode,
|
||||
GError **error)
|
||||
{
|
||||
GimpRGB color;
|
||||
GimpPattern *pattern;
|
||||
const gchar *undo_desc = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
if (! gimp_get_fill_params (context, fill_type, &color, &pattern, error))
|
||||
return FALSE;
|
||||
|
||||
switch (fill_type)
|
||||
{
|
||||
case GIMP_FILL_FOREGROUND:
|
||||
undo_desc = C_("undo-type", "Fill with Foreground Color");
|
||||
break;
|
||||
|
||||
case GIMP_FILL_BACKGROUND:
|
||||
undo_desc = C_("undo-type", "Fill with Background Color");
|
||||
break;
|
||||
|
||||
case GIMP_FILL_WHITE:
|
||||
undo_desc = C_("undo-type", "Fill with White");
|
||||
break;
|
||||
|
||||
case GIMP_FILL_TRANSPARENT:
|
||||
undo_desc = C_("undo-type", "Fill with Transparency");
|
||||
break;
|
||||
|
||||
case GIMP_FILL_PATTERN:
|
||||
undo_desc = C_("undo-type", "Fill with Pattern");
|
||||
break;
|
||||
}
|
||||
|
||||
return gimp_edit_fill_full (image, drawable,
|
||||
&color, pattern,
|
||||
opacity, paint_mode,
|
||||
undo_desc);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_edit_fill_full (GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
const GimpRGB *color,
|
||||
GimpPattern *pattern,
|
||||
gdouble opacity,
|
||||
GimpLayerModeEffects paint_mode,
|
||||
GimpFillOptions *options,
|
||||
const gchar *undo_desc)
|
||||
{
|
||||
GeglBuffer *dest_buffer;
|
||||
GimpPattern *pattern = NULL;
|
||||
GimpRGB color;
|
||||
const Babl *format;
|
||||
gint x, y, width, height;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
|
||||
g_return_val_if_fail (color != NULL || pattern != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_FILL_OPTIONS (options), FALSE);
|
||||
|
||||
if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
return TRUE; /* nothing to do, but the fill succeeded */
|
||||
|
||||
switch (gimp_fill_options_get_style (options))
|
||||
{
|
||||
case GIMP_FILL_STYLE_SOLID:
|
||||
gimp_context_get_foreground (GIMP_CONTEXT (options), &color);
|
||||
break;
|
||||
|
||||
case GIMP_FILL_STYLE_PATTERN:
|
||||
pattern = gimp_context_get_pattern (GIMP_CONTEXT (options));
|
||||
break;
|
||||
}
|
||||
|
||||
if (pattern &&
|
||||
babl_format_has_alpha (gimp_temp_buf_get_format (pattern->mask)) &&
|
||||
! gimp_drawable_has_alpha (drawable))
|
||||
|
@ -515,16 +479,20 @@ gimp_edit_fill_full (GimpImage *image,
|
|||
}
|
||||
else
|
||||
{
|
||||
GeglColor *gegl_color = gimp_gegl_color_new (color);
|
||||
GeglColor *gegl_color = gimp_gegl_color_new (&color);
|
||||
|
||||
gegl_buffer_set_color (dest_buffer, NULL, gegl_color);
|
||||
g_object_unref (gegl_color);
|
||||
}
|
||||
|
||||
if (! undo_desc)
|
||||
undo_desc = gimp_fill_options_get_undo_desc (options);
|
||||
|
||||
gimp_drawable_apply_buffer (drawable, dest_buffer,
|
||||
GEGL_RECTANGLE (0, 0, width, height),
|
||||
TRUE, undo_desc,
|
||||
opacity, paint_mode,
|
||||
gimp_context_get_opacity (GIMP_CONTEXT (options)),
|
||||
gimp_context_get_paint_mode (GIMP_CONTEXT (options)),
|
||||
NULL, x, y);
|
||||
|
||||
g_object_unref (dest_buffer);
|
||||
|
|
|
@ -59,18 +59,7 @@ gboolean gimp_edit_clear (GimpImage *image,
|
|||
GimpContext *context);
|
||||
gboolean gimp_edit_fill (GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
GimpContext *context,
|
||||
GimpFillType fill_type,
|
||||
gdouble opacity,
|
||||
GimpLayerModeEffects paint_mode,
|
||||
GError **error);
|
||||
|
||||
gboolean gimp_edit_fill_full (GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
const GimpRGB *color,
|
||||
GimpPattern *pattern,
|
||||
gdouble opacity,
|
||||
GimpLayerModeEffects paint_mode,
|
||||
GimpFillOptions *options,
|
||||
const gchar *undo_desc);
|
||||
|
||||
gboolean gimp_edit_fade (GimpImage *image,
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpfilloptions.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-merge.h"
|
||||
#include "core/gimpimage-new.h"
|
||||
|
@ -382,12 +383,24 @@ gimp_display_shell_dnd_fill (GimpDisplayShell *shell,
|
|||
}
|
||||
else
|
||||
{
|
||||
gimp_edit_fill_full (image, drawable,
|
||||
color, pattern,
|
||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE,
|
||||
GimpFillOptions *options = gimp_fill_options_new (image->gimp);
|
||||
|
||||
if (color)
|
||||
{
|
||||
gimp_context_set_foreground (GIMP_CONTEXT (options), color);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_fill_options_set_style (options, GIMP_FILL_STYLE_PATTERN);
|
||||
gimp_context_set_pattern (GIMP_CONTEXT (options), pattern);
|
||||
}
|
||||
|
||||
gimp_edit_fill (image, drawable, options,
|
||||
pattern ?
|
||||
C_("undo-type", "Drop pattern to layer") :
|
||||
C_("undo-type", "Drop color to layer"));
|
||||
|
||||
g_object_unref (options);
|
||||
}
|
||||
|
||||
gimp_display_shell_dnd_flush (shell, image);
|
||||
|
|
|
@ -554,11 +554,15 @@ edit_fill_invoker (GimpProcedure *procedure,
|
|||
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
|
||||
{
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GimpFillOptions *options = gimp_fill_options_new (gimp);
|
||||
|
||||
success = gimp_edit_fill (image, drawable, context,
|
||||
(GimpFillType) fill_type,
|
||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE,
|
||||
error);
|
||||
success = gimp_fill_options_set_by_fill_type (options, context,
|
||||
fill_type, error);
|
||||
|
||||
if (success)
|
||||
success = gimp_edit_fill (image, drawable, options, NULL);
|
||||
|
||||
g_object_unref (options);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -602,11 +606,31 @@ edit_bucket_fill_invoker (GimpProcedure *procedure,
|
|||
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
|
||||
{
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GimpFillType fill_type;
|
||||
|
||||
if (paint_mode == GIMP_OVERLAY_MODE)
|
||||
paint_mode = GIMP_SOFTLIGHT_MODE;
|
||||
|
||||
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
|
||||
{
|
||||
GimpFillOptions *options = gimp_fill_options_new (gimp);
|
||||
|
||||
success = gimp_fill_options_set_by_fill_mode (options, context,
|
||||
fill_mode, error);
|
||||
|
||||
if (success)
|
||||
{
|
||||
gimp_context_set_opacity (GIMP_CONTEXT (options), opacity / 100.0);
|
||||
gimp_context_set_paint_mode (GIMP_CONTEXT (options), paint_mode);
|
||||
|
||||
success = gimp_edit_fill (image, drawable, options, NULL);
|
||||
}
|
||||
|
||||
g_object_unref (options);
|
||||
}
|
||||
else
|
||||
{
|
||||
GimpFillType fill_type;
|
||||
|
||||
switch (fill_mode)
|
||||
{
|
||||
default:
|
||||
|
@ -623,14 +647,6 @@ edit_bucket_fill_invoker (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
|
||||
{
|
||||
success = gimp_edit_fill (image, drawable, context, fill_type,
|
||||
opacity / 100.0, paint_mode,
|
||||
error);
|
||||
}
|
||||
else
|
||||
{
|
||||
success = gimp_drawable_bucket_fill (drawable, context, fill_type,
|
||||
paint_mode, opacity / 100.0,
|
||||
FALSE /* don't fill transparent */,
|
||||
|
@ -688,11 +704,31 @@ edit_bucket_fill_full_invoker (GimpProcedure *procedure,
|
|||
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
|
||||
{
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GimpFillType fill_type;
|
||||
|
||||
if (paint_mode == GIMP_OVERLAY_MODE)
|
||||
paint_mode = GIMP_SOFTLIGHT_MODE;
|
||||
|
||||
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
|
||||
{
|
||||
GimpFillOptions *options = gimp_fill_options_new (gimp);
|
||||
|
||||
success = gimp_fill_options_set_by_fill_mode (options, context,
|
||||
fill_mode, error);
|
||||
|
||||
if (success)
|
||||
{
|
||||
gimp_context_set_opacity (GIMP_CONTEXT (options), opacity / 100.0);
|
||||
gimp_context_set_paint_mode (GIMP_CONTEXT (options), paint_mode);
|
||||
|
||||
success = gimp_edit_fill (image, drawable, options, NULL);
|
||||
}
|
||||
|
||||
g_object_unref (options);
|
||||
}
|
||||
else
|
||||
{
|
||||
GimpFillType fill_type;
|
||||
|
||||
switch (fill_mode)
|
||||
{
|
||||
default:
|
||||
|
@ -709,14 +745,6 @@ edit_bucket_fill_full_invoker (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
|
||||
{
|
||||
success = gimp_edit_fill (image, drawable, context, fill_type,
|
||||
opacity / 100.0, paint_mode,
|
||||
error);
|
||||
}
|
||||
else
|
||||
{
|
||||
success = gimp_drawable_bucket_fill (drawable, context, fill_type,
|
||||
paint_mode, opacity / 100.0,
|
||||
fill_transparent,
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "core/gimp-edit.h"
|
||||
#include "core/gimpdrawable-bucket-fill.h"
|
||||
#include "core/gimperror.h"
|
||||
#include "core/gimpfilloptions.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpitem.h"
|
||||
#include "core/gimppickable.h"
|
||||
|
@ -173,11 +174,37 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
|
|||
{
|
||||
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
|
||||
GimpContext *context = GIMP_CONTEXT (options);
|
||||
GimpFillType fill_type;
|
||||
gint x, y;
|
||||
gboolean success;
|
||||
GError *error = NULL;
|
||||
|
||||
if (options->fill_selection)
|
||||
{
|
||||
GimpFillOptions *fill_options = gimp_fill_options_new (image->gimp);
|
||||
|
||||
success = gimp_fill_options_set_by_fill_mode (fill_options, context,
|
||||
options->fill_mode,
|
||||
&error);
|
||||
|
||||
if (success)
|
||||
{
|
||||
gimp_context_set_opacity (GIMP_CONTEXT (fill_options),
|
||||
gimp_context_get_opacity (context));
|
||||
gimp_context_set_paint_mode (GIMP_CONTEXT (fill_options),
|
||||
gimp_context_get_paint_mode (context));
|
||||
|
||||
success = gimp_edit_fill (image, drawable, fill_options, NULL);
|
||||
}
|
||||
|
||||
g_object_unref (fill_options);
|
||||
}
|
||||
else
|
||||
{
|
||||
GimpFillType fill_type;
|
||||
gint x, y;
|
||||
|
||||
x = coords->x;
|
||||
y = coords->y;
|
||||
|
||||
switch (options->fill_mode)
|
||||
{
|
||||
default:
|
||||
|
@ -192,9 +219,6 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
|
|||
break;
|
||||
}
|
||||
|
||||
x = coords->x;
|
||||
y = coords->y;
|
||||
|
||||
if (! options->sample_merged)
|
||||
{
|
||||
gint off_x, off_y;
|
||||
|
@ -205,15 +229,6 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
|
|||
y -= off_y;
|
||||
}
|
||||
|
||||
if (options->fill_selection)
|
||||
{
|
||||
success = gimp_edit_fill (image, drawable, context, fill_type,
|
||||
gimp_context_get_opacity (context),
|
||||
gimp_context_get_paint_mode (context),
|
||||
&error);
|
||||
}
|
||||
else
|
||||
{
|
||||
success = gimp_drawable_bucket_fill (drawable, context, fill_type,
|
||||
gimp_context_get_paint_mode (context),
|
||||
gimp_context_get_opacity (context),
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "core/gimp-edit.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpfilloptions.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-undo.h"
|
||||
#include "core/gimppattern.h"
|
||||
|
@ -235,13 +236,20 @@ gimp_drawable_tree_view_drop_viewable (GimpContainerTreeView *view,
|
|||
{
|
||||
if (dest_viewable && GIMP_IS_PATTERN (src_viewable))
|
||||
{
|
||||
gimp_edit_fill_full (gimp_item_get_image (GIMP_ITEM (dest_viewable)),
|
||||
GIMP_DRAWABLE (dest_viewable),
|
||||
NULL, GIMP_PATTERN (src_viewable),
|
||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE,
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (dest_viewable));
|
||||
GimpFillOptions *options = gimp_fill_options_new (image->gimp);
|
||||
|
||||
gimp_fill_options_set_style (options, GIMP_FILL_STYLE_PATTERN);
|
||||
gimp_context_set_pattern (GIMP_CONTEXT (options),
|
||||
GIMP_PATTERN (src_viewable));
|
||||
|
||||
gimp_edit_fill (image, GIMP_DRAWABLE (dest_viewable),
|
||||
options,
|
||||
C_("undo-type", "Drop pattern to layer"));
|
||||
|
||||
gimp_image_flush (gimp_item_get_image (GIMP_ITEM (dest_viewable)));
|
||||
g_object_unref (options);
|
||||
|
||||
gimp_image_flush (image);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -259,13 +267,18 @@ gimp_drawable_tree_view_drop_color (GimpContainerTreeView *view,
|
|||
{
|
||||
if (dest_viewable)
|
||||
{
|
||||
gimp_edit_fill_full (gimp_item_get_image (GIMP_ITEM (dest_viewable)),
|
||||
GIMP_DRAWABLE (dest_viewable),
|
||||
color, NULL,
|
||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE,
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (dest_viewable));
|
||||
GimpFillOptions *options = gimp_fill_options_new (image->gimp);
|
||||
|
||||
gimp_context_set_foreground (GIMP_CONTEXT (options), color);
|
||||
|
||||
gimp_edit_fill (image, GIMP_DRAWABLE (dest_viewable),
|
||||
options,
|
||||
C_("undo-type", "Drop color to layer"));
|
||||
|
||||
gimp_image_flush (gimp_item_get_image (GIMP_ITEM (dest_viewable)));
|
||||
g_object_unref (options);
|
||||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -315,20 +328,34 @@ gimp_drawable_tree_view_new_dropped (GimpItemTreeView *view,
|
|||
{
|
||||
GimpItem *item;
|
||||
|
||||
gimp_image_undo_group_start (gimp_item_tree_view_get_image (view), GIMP_UNDO_GROUP_EDIT_PASTE,
|
||||
gimp_image_undo_group_start (gimp_item_tree_view_get_image (view),
|
||||
GIMP_UNDO_GROUP_EDIT_PASTE,
|
||||
_("New Layer"));
|
||||
|
||||
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->new_item (gimp_item_tree_view_get_image (view));
|
||||
|
||||
if (item)
|
||||
{
|
||||
gimp_edit_fill_full (gimp_item_get_image (item),
|
||||
GIMP_DRAWABLE (item),
|
||||
color, pattern,
|
||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE,
|
||||
GimpImage *image = gimp_item_get_image (item);
|
||||
GimpFillOptions *options = gimp_fill_options_new (image->gimp);
|
||||
|
||||
if (color)
|
||||
{
|
||||
gimp_context_set_foreground (GIMP_CONTEXT (options), color);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_fill_options_set_style (options, GIMP_FILL_STYLE_PATTERN);
|
||||
gimp_context_set_pattern (GIMP_CONTEXT (options), pattern);
|
||||
}
|
||||
|
||||
gimp_edit_fill (image, GIMP_DRAWABLE (item),
|
||||
options,
|
||||
pattern ?
|
||||
C_("undo-type", "Drop pattern to layer") :
|
||||
C_("undo-type", "Drop color to layer"));
|
||||
|
||||
g_object_unref (options);
|
||||
}
|
||||
|
||||
gimp_image_undo_group_end (gimp_item_tree_view_get_image (view));
|
||||
|
|
|
@ -566,11 +566,15 @@ HELP
|
|||
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
|
||||
{
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GimpFillOptions *options = gimp_fill_options_new (gimp);
|
||||
|
||||
success = gimp_edit_fill (image, drawable, context,
|
||||
(GimpFillType) fill_type,
|
||||
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE,
|
||||
error);
|
||||
success = gimp_fill_options_set_by_fill_type (options, context,
|
||||
fill_type, error);
|
||||
|
||||
if (success)
|
||||
success = gimp_edit_fill (image, drawable, options, NULL);
|
||||
|
||||
g_object_unref (options);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -638,11 +642,31 @@ HELP
|
|||
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
|
||||
{
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GimpFillType fill_type;
|
||||
|
||||
if (paint_mode == GIMP_OVERLAY_MODE)
|
||||
paint_mode = GIMP_SOFTLIGHT_MODE;
|
||||
|
||||
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
|
||||
{
|
||||
GimpFillOptions *options = gimp_fill_options_new (gimp);
|
||||
|
||||
success = gimp_fill_options_set_by_fill_mode (options, context,
|
||||
fill_mode, error);
|
||||
|
||||
if (success)
|
||||
{
|
||||
gimp_context_set_opacity (GIMP_CONTEXT (options), opacity / 100.0);
|
||||
gimp_context_set_paint_mode (GIMP_CONTEXT (options), paint_mode);
|
||||
|
||||
success = gimp_edit_fill (image, drawable, options, NULL);
|
||||
}
|
||||
|
||||
g_object_unref (options);
|
||||
}
|
||||
else
|
||||
{
|
||||
GimpFillType fill_type;
|
||||
|
||||
switch (fill_mode)
|
||||
{
|
||||
default:
|
||||
|
@ -659,14 +683,6 @@ HELP
|
|||
break;
|
||||
}
|
||||
|
||||
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
|
||||
{
|
||||
success = gimp_edit_fill (image, drawable, context, fill_type,
|
||||
opacity / 100.0, paint_mode,
|
||||
error);
|
||||
}
|
||||
else
|
||||
{
|
||||
success = gimp_drawable_bucket_fill (drawable, context, fill_type,
|
||||
paint_mode, opacity / 100.0,
|
||||
FALSE /* don't fill transparent */,
|
||||
|
@ -752,11 +768,31 @@ HELP
|
|||
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
|
||||
{
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GimpFillType fill_type;
|
||||
|
||||
if (paint_mode == GIMP_OVERLAY_MODE)
|
||||
paint_mode = GIMP_SOFTLIGHT_MODE;
|
||||
|
||||
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
|
||||
{
|
||||
GimpFillOptions *options = gimp_fill_options_new (gimp);
|
||||
|
||||
success = gimp_fill_options_set_by_fill_mode (options, context,
|
||||
fill_mode, error);
|
||||
|
||||
if (success)
|
||||
{
|
||||
gimp_context_set_opacity (GIMP_CONTEXT (options), opacity / 100.0);
|
||||
gimp_context_set_paint_mode (GIMP_CONTEXT (options), paint_mode);
|
||||
|
||||
success = gimp_edit_fill (image, drawable, options, NULL);
|
||||
}
|
||||
|
||||
g_object_unref (options);
|
||||
}
|
||||
else
|
||||
{
|
||||
GimpFillType fill_type;
|
||||
|
||||
switch (fill_mode)
|
||||
{
|
||||
default:
|
||||
|
@ -773,14 +809,6 @@ HELP
|
|||
break;
|
||||
}
|
||||
|
||||
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
|
||||
{
|
||||
success = gimp_edit_fill (image, drawable, context, fill_type,
|
||||
opacity / 100.0, paint_mode,
|
||||
error);
|
||||
}
|
||||
else
|
||||
{
|
||||
success = gimp_drawable_bucket_fill (drawable, context, fill_type,
|
||||
paint_mode, opacity / 100.0,
|
||||
fill_transparent,
|
||||
|
|
Loading…
Reference in New Issue