PintaProject / Pinta

Simple GTK# Paint Program
http://www.pinta-project.com/
MIT License
1.74k stars 267 forks source link

Bug fix: Handling of alpha pixels when committing selection #840

Closed logiclrd closed 2 weeks ago

logiclrd commented 1 month ago

When you finish a selection with pixels that aren't fully-opaque (whether due to layer opacity or the pixels' alpha channel), those pixels are blended with the target layer according to the opacity, but this is not the proper semantic for a selection. If you create a selection and then use Move Selection tool to relocate it, within that layer, the pixels' opacity should simply be translated along with the colour. This PR fixes selection moves so that when the selection is "dropped" onto the underlying layer, it simply replaces all of the pixels involved. It implements this by still blending the pixels the way it did before, but by clearing the underlying pixels so that there's nothing there for them to blend with. The new blend method ignores the layer opacity as well.

There is a separate bug in how the selection layer is previewed. Prior to finishing the selection, it will appear incorrectly blended with the underlying pixels. That is outside of the scope of this PR.

Before moving selection:

image

After moving selection, before finish selection:

image

After finishing selection:

image

This PR partially fixes #819.

logiclrd commented 1 month ago

Spurious build failure for build-macos, looks like.

logiclrd commented 3 weeks ago

Rebased.

cameronwhite commented 2 weeks ago

Looks good, thank you!