-
Notifications
You must be signed in to change notification settings - Fork 181
Support a special "Luminance mask" layer type #1183
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
Conversation
Would it make sense to generalise this new method to allow alpha masks too? I suspect that might be quite convenient for implementing https://developer.mozilla.org/en-US/docs/Web/CSS/mask-image... |
I suppose so; it's not entirely clear to me whether that is already covered by an existing blend mode. But this operation has been discussed as blocking for Graphite, whereas alpha masks have not been. Either way, that should be a separate PR to this (but before 0.6.0, probably). |
1903894
to
2a6e445
Compare
if end_clip.blend == LUMINANCE_MASK_LAYER { | ||
// TODO: Does this case apply more generally? | ||
// See https://github.com/linebender/vello/issues/1061 | ||
// TODO: How do we handle anti-aliased edges here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably they're accounted for in the multiplication of rgba[i]
and area[i]
above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of; area[i]
indicates "how much the blending should apply to this pixel".
However, we're instead using it as an alpha mask over the foreground. For Porter-Duff Over, this is equivalent. However, for the "destructive" blend modes, that doesn't give anywhere near the same results.
In the extreme case, consider the case where area[i]
is zero; that is the cause of #1061.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. That seems unrelated to this PR and shouldn't block landing IMO. Let's try to resolve that separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an aside, that issue is interesting because I don't think we anticipated that someone would push/pop an empty layer simply for the side effects of the blend operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahah:
Note: Shape is defined by the mathematical description of the shape. A particular point is either inside the shape or it is not. There are no gradations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't do a deep dive on the math but the pipeline changes LGTM and everything else seems reasonable with a few nits.
cd611c4
to
09eea7d
Compare
Supersedes #1121
cc @Keavon does this address your need/use case?
cc @mTvare6, as this impacts your PRs