mypaint icon indicating copy to clipboard operation
mypaint copied to clipboard

[Feature Request] Anti-Eraser painting mode

Open loentar opened this issue 10 years ago • 5 comments

This is the painting mode opposite to Eraser.

By the idea it should work exactly as Eraser, in exception it should increase alpha (till 1.0) instead of decrease.

loentar avatar Aug 13 '15 11:08 loentar

Please raise this as an issue against the brush engine, libmypaint, as well. You will need to provide us with an algorithm, or a pointer to somewhere that it's implemented already, and kindly link back to this request using mypaint/mypaint#407 type notation so that they can be looked at together. There will be UI work for MyPaint.

Leaving this request open as a UI request, but this needs support in the brush engine first.

achadwick avatar Aug 13 '15 11:08 achadwick

.. It's implemented in GIMP.. AFAIK it's literally what loentar says: Eraser subtracts from alpha, Anti-Erase adds to it. There is no effect on color. Implementation here

0ion9 avatar Aug 13 '15 12:08 0ion9

Not exactly as GIMP. GIMP just adds opacity, even if the area is totally transparent.

I'd like to increase opacity only if pixel's alpha > 0. If alpha = 0 don't change it.

Please see what I mean. The right half of image is after applying anti-eraser, solid rectangle brush with 50% opacity.

anti-eraser

The same image on checker pattern to see opacity. anti-eraser-checker

loentar avatar Aug 13 '15 13:08 loentar

Please report this at https://github.com/mypaint/libmypaint/issues as well.

achadwick avatar Aug 13 '15 13:08 achadwick

As long as MyPaint stores colors in pre-multiplied alpha, GIMP-style anti-eraser is not possible: the color information is multiplied by zero in places where the alpha is zero, so there is no way to recover it. But increasing the alpha as suggested should be possible as long as you don't overdo it. It could work by applying a gamma curve to the alpha channel (or anything else that doesn't amplify the alphas close to zero too much). The sharp edge in your "expected" image is probably not achievable without visible color noise and/or banding around the edges, especially after a save-load round-trip through 8bpc.

(Premultiplied alpha has the nice (IMHO) property that only visible information is stored, e.g. there is no hidden image behind every layer which could influence blending or smudging tools by bringing back colors that have long been erased.)

martinxyz avatar Aug 13 '15 16:08 martinxyz

Consolidated into #1219

AesaraB avatar Jan 17 '24 23:01 AesaraB