core: Add alpha channel for certain transforms

In 756fed0c, we removed code that automatically added an
alpha channel for transformed layers, as it relied on the user
setting interpolation to anything other than NONE.

This patch attempts to restore this behavior with a different
check. If gimp_matrix_is_simple () returns FALSE, it means that
the transformation requires some form of interpolation, and thus
requires an alpha channel. Flipping and translating do not trigger
a change in the alpha channel, but rotation, shearing, and perspective
transforms do (even if the tool's interpolation is set to NONE).
This commit is contained in:
Alx Sa 2025-05-27 05:57:47 +00:00
parent 4ba74177ea
commit 4e1967bf70

View file

@ -1745,6 +1745,10 @@ gimp_layer_real_transform (GimpLayer *layer,
GimpTransformResize clip_result, GimpTransformResize clip_result,
GimpProgress *progress) GimpProgress *progress)
{ {
if (! gimp_matrix3_is_simple (matrix) &&
! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
gimp_layer_add_alpha (GIMP_LAYER (layer));
GIMP_ITEM_CLASS (parent_class)->transform (GIMP_ITEM (layer), GIMP_ITEM_CLASS (parent_class)->transform (GIMP_ITEM (layer),
context, matrix, direction, context, matrix, direction,
interpolation_type, interpolation_type,