8000 Don't unpremultiply alpha for `Mask` calculation by tomcur · Pull Request #987 · linebender/vello · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Don't unpremultiply alpha for Mask calculation #987

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

Merged
merged 2 commits into from
May 8, 2025
Merged

Conversation

tomcur
Copy link
Member
@tomcur tomcur commented May 8, 2025

We were multiplying by alpha directly after again.

We were multiplying by alpha directly after again.
@LaurenzV
Copy link
Contributor
LaurenzV commented May 8, 2025

Hmm but the specification says:

The calculations are performed on non-premultiplied color values.

But I guess it makes sense that since you can just extract the /255 they cancel each other out, but then I'm wondering why they have that sentence in the spec.

@tomcur tomcur added this pull request to the merge queue May 8, 2025
Copy link
Member Author
@tomcur tomcur left a comment

Choose a reason for hiding this comment

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

The calculations are performed on non-premultiplied color values.

But I guess it makes sense that since you can just extract the /255 they cancel each other out, but then I'm wondering why they have that sentence in the spec.

For the calculations in that section generally it matters, and the luminance-to-alpha as calculated in that section only takes luminance into account, ignoring alpha, which does require the color to be non-premultiplied.

However, to use that value for calculating a mask, you multiply that value by the original alpha again (Masking Module Level 1 § 7.10.1). In this case that works out to be the same as doing the entire thing with the premultiplied color we already had.

Merged via the queue into main with commit f3f7621 May 8, 2025
17 checks passed
@tomcur tomcur deleted the push-zqlwrvxunqqm branch May 8, 2025 19:38
tomcur added a commit that referenced this pull request May 8, 2025
github-merge-queue bot pushed a commit that referenced this pull request May 8, 2025
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.

2 participants
0