The EngAlphaBlend function provides bit-block transfer capabilities with alpha blending.
BOOL
EngAlphaBlend(
IN SURFOBJ *psoDest,
IN SURFOBJ *psoSrc,
IN CLIPOBJ *pco,
IN XLATEOBJ *pxlo,
IN RECTL *prclDest,
IN RECTL *prclSrc,
IN BLENDOBJ *pBlendObj
);
If the source surface is palette managed, its colors are represented by indices into a lookup table of RGB color values. In this case, GDI can query the XLATEOBJ structure for a translate vector to quickly translate any source index into a color index for the destination.
The situation is more complicated when, for example, the source is RGB but the destination is palette-managed. In this case, the closest match to each source RGB value must be found in the destination palette. GDI calls the XLATEOBJ_iXlate service routine to perform this matching operation.
The rectangle is lower-right exclusive; that is, its lower and right edges are not a part of the blend.
The specified rectangle can overhang the destination surface; GDI performs the proper clipping when it does.
EngAlphaBlend must never be called with an empty destination rectangle.
The rectangle is lower-right exclusive; that is, its lower and right edges are not a part of the blend.
The source rectangle must never exceed the bounds of the source surface, and thus never overhang the source surface.
EngAlphaBlend must never be called with an empty source rectangle.
The mapping is defined by prclSrc and prclDest. The points specified in prclDest and prclSrc lie on integer coordinates, which correspond to pixel centers. A rectangle defined by two such points is considered to be a geometric rectangle with two vertices whose coordinates are the given points, but with 0.5 subtracted from each coordinate. (POINTL structures are shorthand notation for specifying these fractional coordinate vertices.)
BlendOp defines the blend operation to be performed. Currently this value must be AC_SRC_OVER, which means that the source bitmap is placed over the destination bitmap based on the alpha values of the source pixels. There are three possible cases that this blend operation should handle. These are described in the Comments section of this reference page.
BlendFlags is reserved and is currently set to zero.
SourceConstantAlpha defines the constant blend factor to apply to the entire source surface. This value is in the range of [0,255], where 0 is completely transparent and 255 is completely opaque.
AlphaFormat defines whether the surface is assumed to have an alpha channel. This member can optionally be set to the following value:
EngAlphaBlend returns TRUE upon success. If an error occurs, it returns FALSE and reports an error code.
Declared in winddi.h. Include winddi.h.
A bit-block transfer with alpha blending is supported between the following surfaces:
The driver should never call EngAlphaBlend with overlapping source and destination rectangles on the same surface.
The three possible cases for the AC_SRC_OVER blend function are:
Dst.Red = Round(((Src.Red * SourceConstantAlpha) +
((255 – SourceConstantAlpha) * Dst.Red)) / 255);
Dst.Green = Round(((Src.Green * SourceConstantAlpha) +
((255 – SourceConstantAlpha) * Dst.Green)) / 255);
Dst.Blue = Round(((Src.Blue * SourceConstantAlpha) +
((255 – SourceConstantAlpha) * Dst.Blue)) / 255);
/* Do the next computation only if the destination bitmap
has an alpha channel. */
Dst.Alpha = Round(((Src.Alpha * SourceConstantAlpha) +
((255 – SourceConstantAlpha) * Dst.Alpha)) / 255);
Dst.Red = Src.Red +
Round(((255 – Src.Alpha) * Dst.Red) / 255);
Dst.Green = Src.Green +
Round(((255 – Src.Alpha) * Dst.Green) / 255);
Dst.Blue = Src.Blue +
Round(((255 – Src.Alpha) * Dst.Blue) / 255);
/* Do the next computation only if the destination bitmap
has an alpha channel. */
Dst.Alpha = Src.Alpha +
Round(((255 – Src.Alpha) * Dst.Alpha) / 255);
Temp.Red = Round((Src.Red * SourceConstantAlpha) / 255);
Temp.Green = Round((Src.Green * SourceConstantAlpha) / 255);
Temp.Blue = Round((Src.Blue * SourceConstantAlpha) / 255);
/* The next computation must be done even if the
destination bitmap does not have an alpha channel. */
Temp.Alpha = Round((Src.Alpha * SourceConstantAlpha) / 255);
/* Note that the following equations use the just-computed
Temp.Alpha value: */
Dst.Red = Temp.Red +
Round(((255 – Temp.Alpha) * Dst.Red) / 255);
Dst.Green = Temp.Green +
Round(((255 – Temp.Alpha) * Dst.Green) / 255);
Dst.Blue = Temp.Blue +
Round(((255 – Temp.Alpha) * Dst.Blue) / 255);
/* Do the next computation only if the destination bitmap
has an alpha channel. */
Dst.Alpha = Temp.Alpha +
Round(((255 – Temp.Alpha) * Dst.Alpha) / 255);
The driver should call EngAlphaBlend if it has hooked DrvAlphaBlend and it is called to do something that it does not support.
DrvAlphaBlend, DrvBitBlt, DrvPlgBlt, DrvStretchBlt, DrvStretchBltROP, DrvTransparentBlt, EngAssociateSurface, EngBitBlt, EngPlgBlt, EngStretchBlt, EngStretchBltROP, EngTransparentBlt