Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | <!-- |
michael@0 | 2 | Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 4 | --> |
michael@0 | 5 | <html> |
michael@0 | 6 | <style> |
michael@0 | 7 | .reftest { |
michael@0 | 8 | background-color: rgba(0, 255, 0, 0.5); |
michael@0 | 9 | } |
michael@0 | 10 | |
michael@0 | 11 | .child { |
michael@0 | 12 | width: 100px; |
michael@0 | 13 | height: 100px; |
michael@0 | 14 | opacity: 0.5; |
michael@0 | 15 | background-color: rgb(0, 127, 0); |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | .topleft { |
michael@0 | 19 | float:left; |
michael@0 | 20 | |
michael@0 | 21 | width: 100px; |
michael@0 | 22 | height: 100px; |
michael@0 | 23 | |
michael@0 | 24 | /*First blend black rect with green in place*/ |
michael@0 | 25 | /* Cs = (1 - αb) x Cs + αb x B(Cb, Cs)*/ |
michael@0 | 26 | /* B(Cb, Cs) = | Cb - Cs | = (0, 0, 0) */ |
michael@0 | 27 | /* 0.5 * (0, 255, 0) + 0.5 * (0, 0, 0) = (0, 127.5, 0)*/ |
michael@0 | 28 | |
michael@0 | 29 | /* Now, composite the resulting color with src-over; the alpha is the original alpha for the top layer |
michael@0 | 30 | while the color is the blending result*/ |
michael@0 | 31 | /* co = αs x Fa x Cs + αb x Fb x Cb - this is premultiplied */ |
michael@0 | 32 | /* αo = αs + αb x (1 – αs) */ |
michael@0 | 33 | /* Source over: Fa = 1; Fb = 1 – αs */ |
michael@0 | 34 | /*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)*/ |
michael@0 | 35 | /*ao = 0.5 + 0.5 * 0.5 = 0.75*/ |
michael@0 | 36 | /* Co = co/ao = (0, 127.5, 0) / 0.75*/ |
michael@0 | 37 | |
michael@0 | 38 | /* Now alpha composite on white background */ |
michael@0 | 39 | /*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) */ |
michael@0 | 40 | |
michael@0 | 41 | background-color: rgb(64, 191, 64); |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | .topright { |
michael@0 | 45 | float:left; |
michael@0 | 46 | width: 100px; |
michael@0 | 47 | height: 100px; |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | .bottom { |
michael@0 | 51 | width:200px; |
michael@0 | 52 | height: 100px; |
michael@0 | 53 | clear:both; |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | </style> |
michael@0 | 57 | |
michael@0 | 58 | <div class="topleft"></div> |
michael@0 | 59 | <div class="reftest topright"></div> |
michael@0 | 60 | <div class="reftest bottom"></div> |
michael@0 | 61 | |
michael@0 | 62 | </html> |