🔸blend mode

SwiftUIviewdrawing ⟩ blend mode

  • source - view that comes with the blending effect.

  • destination - everything underneath that view.

source     : pixels being applied (blend modes)
destination: pixels already stored to the context

R : result of blend operation
S : source pixel values
Sa: source alpha
D : destination pixel values
Da: destination alpha

// blend modes:
R = S × Sa + D × (1 – Sa)      // normal
R = S × Da                     // source in
R = S × (1 – Da)               // source out
R = S × Da + D × (1 – Sa)      // source atop (?)
R = S × (1 – Da) + D           // destination over
R = D × Sa                     // destination in
R = D × (1 – Sa)               // destination out
R = S × Da + D × (1 – Sa)      // destination atop (?)

Last updated

Was this helpful?