Skip to content

image/color: Palette ignores alpha channel #9902

@magical

Description

@magical

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions