| top layer |  | |
| bottom layer |  | |
| |
| normal |  | D=(L*aL+S*(1-aL)*aS) / (aL+(1-aL)*aS), aD=(aL+(1-aL)*aS) |
| |
| add |  | D=L+S, apply alpha as "normal" mode |
| subtract |  | D=L-S, apply alpha as "normal" mode |
| multiply |  | D=L*S, apply alpha as "normal" mode |
| divide |  | D=L/S, apply alpha as "normal" mode |
| modulo |  | D=L%S, apply alpha as "normal" mode |
| invsubtract |  | D=S-L, apply alpha as "normal" mode |
| invdivide |  | D=S/L, apply alpha as "normal" mode |
| invmodulo |  | D=S%L, apply alpha as "normal" mode |
| difference |  | D=abs(L-S), apply alpha as "normal" mode |
| max |  | D=max(L,S), apply alpha as "normal" mode |
| min |  | D=min(L,S), apply alpha as "normal" mode |
| bitwise_and |  | D=L&S, apply alpha as "normal" mode |
| bitwise_or |  | D=L|S, apply alpha as "normal" mode |
| bitwise_xor |  | D=L^S, apply alpha as "normal" mode |
| |
| replace |  | D=(L*aL+S*(1-aL)*aS) / (aL+(1-aL)*aS), aD=aS |
| red |  | Dr=(Lr*aLr+Sr*(1-aLr)*aSr) / (aLr+(1-aLr)*aSr), Dgb=Sgb, aD=aS |
| green |  | Dg=(Lg*aLg+Sg*(1-aLg)*aSg) / (aLg+(1-aLg)*aSg), Drb=Srb, aD=aS |
| blue |  | Db=(Lb*aLb+Sb*(1-aLb)*aSb) / (aLb+(1-aLb)*aSb), Drg=Srg, aD=aS |
| |
| replace_hsv |  | Dhsv=(Lhsv*aLrgb+Shsv*(1-aLrgb)*aSrgb) / (aLrgb+(1-aLrgb)*aSrgb), aD=aS |
| hue |  | Dh=(Lh*aLr+Sh*(1-aLr)*aSr) / (aLr+(1-aLr)*aSr), Dsv=Lsv, aD=aS |
| saturation |  | Ds=(Ls*aLg+Ss*(1-aLg)*aSg) / (aLg+(1-aLg)*aSg), Dhv=Lhv, aD=aS |
| value |  | Dv=(Lv*aLb+Sv*(1-aLb)*aSb) / (aLb+(1-aLb)*aSb), Dhs=Lhs, aD=aS |
| color |  | Dhs=(Lhs*aLrg+Shs*(1-aLrg)*aSrg) / (aLrg+(1-aLrg)*aSrg), Dv=Lv, aD=aS |
| |
| darken |  | Dv=min(Lv,Sv), Dhs=Lhs, aD=aS |
| lighten |  | Dv=max(Lv,Sv), Dhs=Lhs, aD=aS |
| saturate |  | Ds=max(Ls,Ss), Dhv=Lhv, aD=aS |
| desaturate |  | Ds=min(Ls,Ss), Dhv=Lhv, aD=aS |
| |
| dissolve |  | i=random 0 or 1, D=i?L:S, aD=i+aS |
| behind |  | D=(S*aS+L*(1-aS)*aL) / (aS+(1-aS)*aL), aD=(aS+(1-aS)*aL); simply swap S and L |
| erase |  | D=S, aD=aS*(1-aL) |
| |
| screen |  | 1-(1-S)*(1-L), apply alpha as "normal" |
| overlay |  | (1-(1-a)*(1-b)-a*b)*a+a*b, apply alpha as "normal" |
| burn_alpha |  | aD=aL+aS, D=L+S; experimental, may change or be removed |
| |
| equal |  | each channel D=max if L==S, 0 otherwise, apply with alpha |
| not_equal |  | each channel D=max if L!=S, 0 otherwise, apply with alpha |
| less |  | each channel D=max if L<S, 0 otherwise, apply with alpha |
| more |  | each channel D=max if L>S, 0 otherwise, apply with alpha |
| less_or_equal |  | each channel D=max if L<=S, 0 otherwise, apply with alpha |
| more_or_equal |  | each channel D=max if L>=S, 0 otherwise, apply with alpha |
| |
| logic_equal |  | logic: D=white and opaque if L==S, black and transparent otherwise |
| logic_not_equal |  | logic: D=white and opaque if any L!=S, black and transparent otherwise |
| logic_strict_less |  | logic: D=white and opaque if all L<S, black and transparent otherwise |
| logic_strict_more |  | logic: D=white and opaque if all L>S, black and transparent otherwise |
| logic_strict_less_equal |  | logic: D=white and opaque if all L<=L, black and transparent otherwise |
| logic_strict_more_equal |  | logic: D=white and opaque if all L>=L, black and transparent otherwise |