Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
This repository was archived by the owner on May 28, 2025. It is now read-only.

Support luminance-based 8bpp Gray buffers instead of Alpha-based 8bpp Gray buffers #1934

@DHowett-MSFT

Description

@DHowett-MSFT

Right now, CoreGraphics uses an 8bpp alpha-only image format when a caller requests a shared 8bpp gray buffer.
While this works for many applications, it isn't correct as it discards luminance data in favor of alpha.

By example, if a consumer draws a uniform black region at 100% alpha (0, 0, 0, 255), we will take the 255 from the alpha channel as the gray value, and 255 is perfectly white.

A uniformly dark yellow (128, 128, 0) region rendered at 25% alpha (128, 128, 0, 64 or, premultiplied, 32, 32, 0, 64) will be 25% gray (64, from the alpha channel) when it should be closer to black at 11% gray (30, from a naïve luminance calculation .2126 * Rpremul + .7152 * Gpremul assuming a 1.0 gamma).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions