Skip to content

Fix halos around strokes in "Inherit Alpha" layers with transparency

Overview

When a layer is applied in inherit alpha mode, then the blending should happen only via source alpha value. Destination alpha should not be mixed into it, because it will create halos around the shapes. Conceptually, it works as if the backdrop alpha value were zero.

BUG: https://bugs.kde.org/show_bug.cgi?id=424797

Prebuilt Packages

Test Plan

Test case 1

  1. Create an image with two layers
  2. Paint something on the first layer
  3. Activate "Inherit Alpha" on the second layer, set the opacity of this layer to 50%
  4. Try to paint on the second layer
  5. Compare the behavior to the official build of Krita (https://krita.org/en/download/krita-desktop/).

In the official 4.3.0 builds: there should be bright halos around the background strokes In this patch: there should be no halos around the background strokes

You can also try some other features, e.g. "Color Overlay" layer style. But take into account that the patch only changes "Normal" blending mode.

Here is a prepared testing file: https://bugs.kde.org/attachment.cgi?id=130486

Krita 4.3.0 (incorrect blending)

inherit_alpha_old

This patch (correct blending)

inherit_alpha_new

Test case 2

  1. Create an empty layer, paint something on it
  2. Activate "Lock Alpha" on this layer
  3. Set brush opacity to 50%
  4. Try to paint with any brush that works in BuildUp mode. Or with any ColorSmudge brush.

The brushes should work "in expected way". I personally couldn't see any difference, but it should be there :)

Questions to Painters

  1. The patch changes the behavior of "Normal" blending mode in "Inherit Alpha" mode. Is this change acceptable?
  2. May it cause harm to any existing files that painters own?
  3. Should we implement any backward compatibility mode? (It can only technically be a global switch with Krita restart)
  4. The patch may theoretically change how brushes in BuildUp mode (or ColorSmudge engine) work in "Locked Alpha" mode. Can you reproduce any changes in existing presets?
Edited by Dmitry Kazakov

Merge request reports