tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

difference-transparent-ref.yaml (1104B)


      1 ---
      2 root:
      3  items:
      4        - type: rect
      5          bounds: [0, 0, 100, 100]
      6 
      7          # First blend black rect with green in place
      8          #  Cs = (1 - αb) x Cs + αb x B(Cb, Cs)
      9          #  B(Cb, Cs) = | Cb - Cs | = (0, 0, 0)
     10          #  0.5 * (0, 255, 0) + 0.5 * (0, 0, 0) = (0, 127.5, 0)
     11          #
     12          #  Now, composite the resulting color with src-over; the alpha is the original alpha for the top layer
     13          #  while the color is the blending result
     14          #  co = αs x Fa x Cs + αb x Fb x Cb  - this is premultiplied 
     15          #  αo = αs + αb x (1 – αs) 
     16          #  Source over:     Fa = 1; Fb = 1 – αs 
     17          # co = 0.5 * 1 * (0, 127.5, 0) + 0.5 * 0.5 * (0, 255, 0) = (0, 63.5, 0) + 0.25 * (0, 255, 0) = (0, 127.5, 0)
     18          # ao = 0.5 + 0.5 * 0.5 = 0.75
     19          #  Co = co/ao = (0, 127.5, 0) / 0.75
     20          #
     21          #  Now alpha composite on white background
     22          # co = 0.75 * 1 * (0, 127.5, 0) / 0.75 + 1 * 0.25 * (255, 255, 255) = (0, 127.5, 0) + (63.75, 63.75, 63.75) = (63.75, 159, 63.75) = (64, 191, 64) 
     23          color: [64, 191, 64]