/* Given two surfaces of equal size with the same rendering, one onto a *blackbackgroundandtheotherontowhite,recoversalphavaluesfrom *thedifferenceandsetsthealphavaluesontheblacksurface. *ThesurfacesmusthaveformatRGB24orARGB32. *Returnstrueonsuccess.
*/ staticbool RecoverAlpha(gfxImageSurface* blackSurface, const gfxImageSurface* whiteSurface);
/* This does the same as the previous function, but uses SIMD *optimizations.Usuallythisshouldnotbecalleddirectly.
*/ template <class Arch> staticbool RecoverAlphaGeneric(gfxImageSurface* blackSurface, const gfxImageSurface* whiteSurface);
/* |diff| here is larger when the source image pixel is more transparent.Ifbothrenderingsarefromthesamesourceimage compositedwithOVER,thenthecolorvaluesonwhitewillalwaysbe greaterthanthoseonblack,so|diff|wouldnotoverflow.However, overflowmayhappen,forexample,whenapluginplaysavideoand theimageisrapidlychanging.Ifthereisoverflow,thenbehaveas ifwelimittothedifferenceto >=0,whichwillmaketherenderingopaque.(Withoutthisoverflow
will make the rendering transparent.) */
uint32_t diff = (white & GREEN_MASK) - (black & GREEN_MASK); /* |diff| is 0xFFFFxx00 on overflow and 0x0000xx00 otherwise, so use
this to limit the transparency. */
uint32_t limit = diff & ALPHA_MASK; /* The alpha bits of the result */
uint32_t alpha = (ALPHA_MASK - (diff << 16)) | limit;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.