mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-05 02:09:37 +00:00
core: Copy filters for new single-layer images
Resolves #12198. When dragging a layer to the toolbox to create a new image, we weren't copying over the filters. This is because that action still uses gimp_image_new_from_drawable () rather than the multi-layer capable gimp_image_new_from_drawables () function. For now, we'll fix the immediate problem by implementing the filter copy code in this function. Long term, we should port that code to use gimp_image_new_from_drawables () instead.
This commit is contained in:
parent
b05c32e6ea
commit
d87c728f0d
1 changed files with 31 additions and 0 deletions
|
@ -202,6 +202,7 @@ gimp_image_new_from_drawable (Gimp *gimp,
|
||||||
gdouble xres;
|
gdouble xres;
|
||||||
gdouble yres;
|
gdouble yres;
|
||||||
GimpColorProfile *profile;
|
GimpColorProfile *profile;
|
||||||
|
GimpContainer *filters;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||||
|
@ -252,6 +253,36 @@ gimp_image_new_from_drawable (Gimp *gimp,
|
||||||
if (gimp_layer_can_lock_alpha (new_layer))
|
if (gimp_layer_can_lock_alpha (new_layer))
|
||||||
gimp_layer_set_lock_alpha (new_layer, FALSE, FALSE);
|
gimp_layer_set_lock_alpha (new_layer, FALSE, FALSE);
|
||||||
|
|
||||||
|
filters = gimp_drawable_get_filters (GIMP_DRAWABLE (drawable));
|
||||||
|
if (gimp_container_get_n_children (filters) > 0)
|
||||||
|
{
|
||||||
|
GList *filter_list;
|
||||||
|
|
||||||
|
for (filter_list = GIMP_LIST (filters)->queue->tail;
|
||||||
|
filter_list;
|
||||||
|
filter_list = g_list_previous (filter_list))
|
||||||
|
{
|
||||||
|
if (GIMP_IS_DRAWABLE_FILTER (filter_list->data))
|
||||||
|
{
|
||||||
|
GimpDrawableFilter *old_filter = filter_list->data;
|
||||||
|
GimpDrawableFilter *filter;
|
||||||
|
|
||||||
|
filter =
|
||||||
|
gimp_drawable_filter_duplicate (GIMP_DRAWABLE (new_layer),
|
||||||
|
old_filter);
|
||||||
|
|
||||||
|
if (filter != NULL)
|
||||||
|
{
|
||||||
|
gimp_drawable_filter_apply (filter, NULL);
|
||||||
|
gimp_drawable_filter_commit (filter, TRUE, NULL, FALSE);
|
||||||
|
|
||||||
|
gimp_drawable_filter_layer_mask_freeze (filter);
|
||||||
|
g_object_unref (filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gimp_image_add_layer (new_image, new_layer, NULL, 0, TRUE);
|
gimp_image_add_layer (new_image, new_layer, NULL, 0, TRUE);
|
||||||
|
|
||||||
gimp_image_undo_enable (new_image);
|
gimp_image_undo_enable (new_image);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue