Mix two non-opaque colors with “hue” blend mode

后端 未结 2 1919
北海茫月
北海茫月 2021-02-07 06:34

I want to implement color blending as described in the W3C compositing and blending spec. (I\'m doing this in JavaScript but the language shouldn\'t really matter for solving my

2条回答
  •  囚心锁ツ
    2021-02-07 07:08

    Starting from here

    Hue blending creates a color with the hue of the source color and the saturation and luminosity of the backdrop color.

    I can come up with some formulas, but they might be rubbish, although they completely reproduce the original numbers posted:

    h: hSource + deltaH * (1 - aSrouce) * aBackdrop * 0.41666666 = 50; 63

    s: sBackdrop * 0.9 + deltaS * (1 - aBackdrop) * aSource * 0.20833333 = 45; 47.5

    l: lBackdrop * 0.957142857 + deltaL * (1 - aBackdrop) * aSource * 0.77 = 67; 63.3

    a: 1 - (1 - aSource)^2 matches always

提交回复
热议问题