Orama-Interactive/Pixelorama

Color picker in Top color mode selects fully transparent pixel from top layer

Closed this issue · 1 comments

Pixelorama version:
v0.11.3-stable

OS/device including version:
Linux Ubuntu 22.04

Issue description:
Currently, if you paint with transparent pixels (using a color whose alpha = 0), it will store transparent pixels on the layer, which are different from having no pixels at all (e.g. on a new layer or after erasure).

When using Color Picker in Pick mode: Top Color and a top layer contains transparent pixels over other layers containing some color C, when clicking on a transparent pixel, the transparent color will be selected.

While it is correct in theory (if a pixel on top layer has alpha = 1 it should be selected, so if alpha = 0 why not do the same?), it may be confusing for the user who uses fully transparent pixels like placeholders for erased pixels (a typical example is using Bucket + transparent color to fill an area with transparent pixels - instead, for true non-pixels you need to Magic Wand the area then Delete - but both seem to do the same), so I opened it as a bug.

I suggest to simply ignore fully transparent pixels when using Color Picker with Top Color pick mode.

If you really want to keep the current behavior for people who need it, you could also add an option.

Alternatively, there could be an option to always erase pixels and never store "fully transparent pixels".

If it's not considered a bug and you need a feature request to actually add options and alternative behaviors, see this discussion instead: #998

Steps to reproduce:

  1. Create new document
  2. Create a second layer
  3. Fill bottom layer with some opaque color, e.g. blue, with Bucket Fill (B)
  4. Select top layer
  5. Fill bottom layer with some fully transparent color, e.g. red with alpha = 0, with Bucket Fill (B)
  6. Click on document to fill transparent pixels everywhere
  7. Select Color pick, make sure that Pick mode is Top Color and pick color anywhere in document

Expected: pick opaque blue
Actual: pick transparent color (red hue)

Thanks for reporting! The issue should be fixed now for both 1.0 (963819a) and 0.11.4 (fb95806)

Also, just a slight technical correction, there is no "having no pixels at all". Even the default transparency pixels, like ones that exist on new layers or on erasure, are still stored as fully transparent pixels, but they are black, meaning that all of the color channels (RGBA) are set to 0. The issue was that the color picker was checking for pixels that are equal to (0, 0, 0, 0), thus fully transparent pixels that are non-black were being included, resulting in the bug you reported. This has now changed and the color picker just checks if the alpha is set to 0, ignoring the RGB channels, which should fix the issue.