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

Fix compositing multi source with alpha #1453

Merged
merged 1 commit into from
Jan 31, 2024
Merged

Fix compositing multi source with alpha #1453

merged 1 commit into from
Jan 31, 2024

Conversation

manthey
Copy link
Member

@manthey manthey commented Jan 31, 2024

Fix an issue with compositing sources in the multi source caused by alpha range. We composite tiles using pre-multiplied alpha values. When we have 8 bit images and apply an affine transform, we do this in float precision so that compositing does not lose precision prematurely. The function fullAlphaValue is used to determine the range of the alpha values we expect; for uint8 this is 255, for float it is 1. Since the values have been cast to float but NOT scaled, this ends up with the wrong values. Functionally, this was multiplying incomplete tiles by 255 and then taking the low 8 bits of the resultant integer cast, which looked like nonsense.

Fix an issue with compositing sources in the multi source caused by
alpha range.  We composite tiles using pre-multiplied alpha values.
When we have 8 bit images and apply an affine transform, we do this in
float precision so that compositing does not lose precision prematurely.
The function fullAlphaValue is used to determine the range of the alpha
values we expect; for uint8 this is 255, for float it is 1.  Since the
values have been cast to float but NOT scaled, this ends up with the
wrong values.  Functionally, this was multiplying incomplete tiles by
255 and then taking the low 8 bits of the resultant integer cast, which
looked like nonsense.
@manthey manthey merged commit c0cc10e into master Jan 31, 2024
16 checks passed
@manthey manthey deleted the multi-alpha branch January 31, 2024 20:08
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

Successfully merging this pull request may close these issues.

1 participant