Alpha Compositing Edge Halos: Premultiplied vs Straight Alpha, Porter-Duff Operators and Gamma-Correct Blending (2D)
The same experiment in 2D: a flat pixel microscope with the monitor and three tray frames (your pipeline, the reference, the error x4), a cross-section through the texel row that shows stored alpha, the colour hidden in the transparent texels, the filtered alpha and the brightness of both pipelines, and the Porter-Duff diagram with its result alpha and factors.
Magnify the antialiased edge of a sprite and see why a dark or bright fringe appears around it. A transparent texel still carries a colour; straight-alpha bilinear filtering mixes it into the edge pixels by t(1-t)(alpha_A - alpha_B)(C_B - C_A), while premultiplied filtering weights every colour by its own alpha and has no halo. Three physical pixel trays on a bench show your pipeline, the reference and the error as raised ridges and trenches, while a monitor shows the whole sprite and the Porter-Duff diagram (over, in, out, atop, xor, plus). Choose the matte colour, filter, sRGB-number or linear-light blending, magnification, edge softness and layer opacity; nineteen numerical checks cover the sRGB curve, the halo closed form, gamma by supersampling, Monte Carlo Porter-Duff coverage and 8-bit premultiplied precision.
The same experiment in 2D: a flat pixel microscope with the monitor and three tray frames (your pipeline, the reference, the error x4), a cross-section through the texel row that shows stored alpha, the colour hidden in the transparent texels, the filtered alpha and the brightness of both pipelines, and the Porter-Duff diagram with its result alpha and factors.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install