Skip to content

Conversation

kazzmir
Copy link

@kazzmir kazzmir commented Mar 17, 2025

fixes #92

Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this.

Upon looking I see that there is another issue, in that the RGBA in Go is pre-multipled alpha, but the values we need are not - could you perhaps swap in their maths for getting the right values instead?

https://cs.opensource.google/go/go/+/refs/tags/go1.24.2:src/image/color/color.go;l=60

Your solution will work when the Alpha value is strictly higher than all other colour channels, but for a semi-transparent white (for example) it would create an invalid colour.

@andydotxyz
Copy link
Member

Thanks for the update, but can you address this point regarding the (non-)pre-multiplied alpha?
The Go image package is a way to see how it is handled by others:

Your solution will work when the Alpha value is strictly higher than all other colour channels, but for a semi-transparent white (for example) it would create an invalid colour.

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.

unix: argb pixel conversion is incorrect
2 participants