Commit ee3846cc authored by Michael Natterer's avatar Michael Natterer 😴
Browse files

app: make the gimp_drawable_fill*() API symmetric to gimp_edit_fill*()

parent 08503835
......@@ -161,9 +161,9 @@ channels_new_last_vals_cmd_callback (GtkAction *action,
new_channel = gimp_channel_new (image, width, height,
channel_name, &color);
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel),
action_data_get_context (data),
GIMP_FILL_TRANSPARENT);
gimp_drawable_fill (GIMP_DRAWABLE (new_channel),
action_data_get_context (data),
GIMP_FILL_TRANSPARENT);
gimp_image_add_channel (image, new_channel,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
......@@ -358,9 +358,9 @@ channels_new_channel_response (GtkWidget *widget,
channel_name,
&channel_color);
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel),
options->context,
GIMP_FILL_TRANSPARENT);
gimp_drawable_fill (GIMP_DRAWABLE (new_channel),
options->context,
GIMP_FILL_TRANSPARENT);
}
gimp_image_add_channel (options->image, new_channel,
......
......@@ -326,9 +326,9 @@ layers_new_last_vals_cmd_callback (GtkAction *action,
layer_name,
opacity, mode);
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_layer),
action_data_get_context (data),
layer_fill_type);
gimp_drawable_fill (GIMP_DRAWABLE (new_layer),
action_data_get_context (data),
layer_fill_type);
gimp_item_translate (GIMP_ITEM (new_layer), off_x, off_y, FALSE);
gimp_image_add_layer (image, new_layer,
......@@ -1035,9 +1035,9 @@ layers_new_layer_response (GtkWidget *widget,
if (layer)
{
gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer),
dialog->context,
layer_fill_type);
gimp_drawable_fill (GIMP_DRAWABLE (layer),
dialog->context,
layer_fill_type);
gimp_image_add_layer (dialog->image, layer,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
......
......@@ -1490,15 +1490,39 @@ gimp_drawable_push_undo (GimpDrawable *drawable,
}
void
gimp_drawable_fill (GimpDrawable *drawable,
const GimpRGB *color,
const GimpPattern *pattern)
gimp_drawable_fill (GimpDrawable *drawable,
GimpContext *context,
GimpFillType fill_type)
{
GimpRGB color;
GimpPattern *pattern;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
if (! gimp_get_fill_params (context, fill_type, &color, &pattern, NULL))
return;
gimp_drawable_fill_full (drawable, &color, pattern);
}
void
gimp_drawable_fill_full (GimpDrawable *drawable,
const GimpRGB *color,
const GimpPattern *pattern)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (color != NULL || pattern != NULL);
g_return_if_fail (color != NULL);
g_return_if_fail (pattern == NULL || GIMP_IS_PATTERN (pattern));
if (color)
if (pattern)
{
GeglBuffer *src_buffer = gimp_pattern_create_buffer (pattern);
gegl_buffer_set_pattern (gimp_drawable_get_buffer (drawable),
NULL, src_buffer, 0, 0);
g_object_unref (src_buffer);
}
else
{
GimpRGB c = *color;
GeglColor *col;
......@@ -1511,14 +1535,6 @@ gimp_drawable_fill (GimpDrawable *drawable,
NULL, col);
g_object_unref (col);
}
else
{
GeglBuffer *src_buffer = gimp_pattern_create_buffer (pattern);
gegl_buffer_set_pattern (gimp_drawable_get_buffer (drawable),
NULL, src_buffer, 0, 0);
g_object_unref (src_buffer);
}
gimp_drawable_update (drawable,
0, 0,
......@@ -1526,22 +1542,6 @@ gimp_drawable_fill (GimpDrawable *drawable,
gimp_item_get_height (GIMP_ITEM (drawable)));
}
void
gimp_drawable_fill_by_type (GimpDrawable *drawable,
GimpContext *context,
GimpFillType fill_type)
{
GimpRGB color;
GimpPattern *pattern;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
if (! gimp_get_fill_params (context, fill_type, &color, &pattern, NULL))
return;
gimp_drawable_fill (drawable, pattern ? NULL : &color, pattern);
}
const Babl *
gimp_drawable_get_format (const GimpDrawable *drawable)
{
......
......@@ -194,11 +194,11 @@ void gimp_drawable_push_undo (GimpDrawable *drawable,
gint height);
void gimp_drawable_fill (GimpDrawable *drawable,
const GimpRGB *color,
const GimpPattern *pattern);
void gimp_drawable_fill_by_type (GimpDrawable *drawable,
GimpContext *context,
GimpFillType fill_type);
void gimp_drawable_fill_full (GimpDrawable *drawable,
const GimpRGB *color,
const GimpPattern *pattern);
const Babl * gimp_drawable_get_format (const GimpDrawable *drawable);
const Babl * gimp_drawable_get_format_with_alpha
......
......@@ -136,8 +136,8 @@ gimp_image_new_from_template (Gimp *gimp,
_("Background"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer),
context, gimp_template_get_fill_type (template));
gimp_drawable_fill (GIMP_DRAWABLE (layer),
context, gimp_template_get_fill_type (template));
gimp_image_add_layer (image, layer, NULL, 0, FALSE);
......
......@@ -712,7 +712,9 @@ drawable_fill_invoker (GimpProcedure *procedure,
if (gimp_pdb_item_is_modifyable (GIMP_ITEM (drawable),
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
gimp_drawable_fill_by_type (drawable, context, (GimpFillType) fill_type);
{
gimp_drawable_fill (drawable, context, (GimpFillType) fill_type);
}
else
success = FALSE;
}
......
......@@ -124,7 +124,9 @@ HELP
if (gimp_pdb_item_is_modifyable (GIMP_ITEM (drawable),
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
gimp_drawable_fill_by_type (drawable, context, (GimpFillType) fill_type);
{
gimp_drawable_fill (drawable, context, (GimpFillType) fill_type);
}
else
success = FALSE;
}
......
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