mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Investigated as part of https://github.com/flutter/flutter/issues/127232. This took some time to work out, but: * The amount of blending applied to the source color needs to be weighted by the destination alpha, which is pretty sensible behavior. This is in addition to applying source-over behavior with the resulting blended color. * All of the blend functions assume that the color is already premultiplied, so remove the unpremultiply/premultiply surrounding the blend call. All of the blend modes now visually match up with the [Flutter docs](https://api.flutter.dev/flutter/dart-ui/BlendMode.html), except for ColorBurn and Saturation, which appear to have a slight miscalculation going on with the red channel.