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

image/color: Palette ignores alpha channel #9902

Closed
magical opened this issue Feb 17, 2015 · 0 comments
Closed

image/color: Palette ignores alpha channel #9902

magical opened this issue Feb 17, 2015 · 0 comments
Milestone

Comments

@magical
Copy link
Contributor

magical commented Feb 17, 2015

Palette.Index, and by extension image.Paletted.Set, cannot distinguish between image.Black and image.Transparent (and in general, any fully-transparent color or partially-transparent black) because it ignores the alpha channel of the colors when searching for the closet match.

This makes it impossible to draw a black pixel onto an image.Paletted whose palette contains color.Transparent, even if it also contains color.Black (or the other way around, depending on the order of the colors in the palette).

See this example program: http://play.golang.org/p/29G2978Px7

In general, it seems like p.Convert(c) should equal c, for every color.Palette p and color.Color c in p.

@rsc rsc added this to the Go1.5Maybe milestone Apr 10, 2015
@mikioh mikioh modified the milestones: Go1.5, Go1.5Maybe May 27, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants