Thema: Delphi Aero color

Einzelnen Beitrag anzeigen

Namenloser

Registriert seit: 7. Jun 2006
Ort: Karlsruhe
3.724 Beiträge
 
FreePascal / Lazarus
 
#2

AW: Aero color

  Alt 17. Jul 2012, 18:52
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% opaque blue would be ARGB(0.2, 0.0, 0.0, 0.2). 100% opaque black would be (1.0, 0.0, 0.0, 0.0) and so on...

Thus, if you do not take this into account, your colors will appear too dark if A<1.0.

Fortunately, converting premultiplied alpha back to “normal” colors (although, after reading the above blog post, you will understand that premultiplied alpha actually makes much more sense ) is as simple as dividing each component by A. The only catch is that you will naturally get an error if A=0 because the color is undetermined in that case.
  Mit Zitat antworten Zitat