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
Surprising behavior of srcOver BlendMode on image with alpha channel from decodeImageFromPixels() #116200
Comments
I find that I observe the expected behavior when pre-multiplying the color components of the image by the alpha channel. It is quite possible that this is a (undocumented?) requirement of If this is indeed the case, then I humbly suggest the following two resolutions:
Thank you. |
Reproducible using the sample provided above. Labeling for further insight from the team. flutter doctor -v
|
At the minimum, we should document the alpha pre-multiplication behavior. |
Steps to Reproduce
srcOver
BlendMode
.This behavior has been observed on an iOS device, macOS, and Chrome.
Expected results:
See image below. I expected to see the red square with alpha channel blend smoothly over the green. In fact, the image below is generated by the sample code by calculating the composition manually as per my understanding of the "over" Porter-Duff operation. In other words, I expected a composition along the lines of
color_out = color_src * alpha_src + color_dst * (1 - alpha_src)
.Actual results:
See image below. The composition looks as expected when over a white background. Over a black background, the alpha channel is not evident at all. And over a green background, the translucent areas become yellow. It behaves as if the composition being performed is
color_out = color_src + color_dst * (1 - alpha_src)
(i.e. source color not multiplied by source alpha).Code sample
Logs
(Initial part of log omitted due to GitHub limit of 65536 characters.)
The text was updated successfully, but these errors were encountered: