Blend Modes

  • 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