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

Potential weight calculation issue #95

Open
hannes-vernooij opened this issue Dec 15, 2024 · 2 comments
Open

Potential weight calculation issue #95

hannes-vernooij opened this issue Dec 15, 2024 · 2 comments

Comments

@hannes-vernooij
Copy link
Contributor

Before I create a PR to fix this potential issue I want to double check if this is intended.
In dirtyalpha.rs the alpha is subtracted from 256, this will result in values outside of the 0..=255 range when the alpha is zero. Shouldn't this be 255 instead?

@kornelski
Copy link
Owner

It's a weight, not a value. The weight can be anything, because the values are multiplied and divided by the weights, so it cancels out.

Weight 0 is used as a special case for skipping completely transparent pixels, so other alpha values intentionally get non-0 values.

@hannes-vernooij
Copy link
Contributor Author

hannes-vernooij commented Dec 18, 2024

It might be useful to clarify this in your code by adding a comment describing this behavior.

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

2 participants