Forum: Win32/Win64 API (native code)
Delphi
by Namenloser,
18. Jul 2012
Why are you adding the original value?
Try this:
if A <> 0 then
begin
R := Clamp(255*R div A, 0, 255);
G := Clamp(255*G div A, 0, 255);
B := Clamp(255*B div A, 0, 255);
end;
Forum: Win32/Win64 API (native code)
Delphi
by Namenloser,
17. Jul 2012
I think the DWM uses the premultiplied alpha format internally (I found this blog post on premultiplied alpha quite enlightening). In short, premultiplied alpha basically means that each of the three components R, G and B is already multiplied by A. For example 50% opaque white, which we normally think of as ARGB(0.5, 1.0, 1.0, 1.0), would be ARGB(0.5, 0.5, 0.5, 0.5) in premultiplied alpha. 20%...