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

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

Open
DHowett-MSFT opened this issue Feb 8, 2017 · 0 comments

Comments

@DHowett-MSFT
Copy link

DHowett-MSFT commented Feb 8, 2017

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants