Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blendMode(REPLACE): the new color alpha is in fact utilized #871

Open
KrabCode opened this issue Dec 15, 2023 · 1 comment
Open

blendMode(REPLACE): the new color alpha is in fact utilized #871

KrabCode opened this issue Dec 15, 2023 · 1 comment

Comments

@KrabCode
Copy link

Issue description

The reference on blendMode() says:

REPLACE - the pixels entirely replace the others and don't utilize alpha (transparency) values

This is confusing to me, it feels like I cannot set alpha to 0 with it because the new alpha values would not be utilized according to the reference (?), but in fact I can set alpha to 0 with it. This is the desired REPLACE behavior in my opinion, it's only the reference that is confusing me. I can understand the original pixel alpha not being utilized when completely replaced, but the reference makes it seem the new alpha will not be used either.

This behavior is demonstrated here with fill(0,0) and stroke(0,0) on a foreground canvas to reveal an underlying image:
https://gist.github.com/KrabCode/0335de613bbef231e7ec95ac6b60bf8f

URL(s) of affected page(s)

https://processing.org/reference/blendMode_.html

Proposed fix

REPLACE - the pixels entirely replace the others and don't utilize alpha (transparency) values of the original

@KrabCode
Copy link
Author

On second thought, alpha is used as a percentage of the new color that should overwrite the old one (as the original's alpha is always 100% for the purposes of blending), so maybe a clearer way to put it would be:

REPLACE - the new pixels entirely replace the old ones, including the new alpha (transparency)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant