The DrvGradientFill function shades the specified primitives.
BOOL
DrvGradientFill(
IN SURFOBJ *psoDest,
IN CLIPOBJ *pco,
IN XLATEOBJ *pxlo,
IN TRIVERTEX *pVertex,
IN ULONG nVertex,
IN PVOID pMesh,
IN ULONG nMesh,
IN RECTL *prclExtents,
IN POINTL *pptlDitherOrg,
IN ULONG ulMode
);
When rectangles are being drawn, pMesh points to an array of GRADIENT_RECT structures, each of which specifies two TRIVERTEX elements that define a rectangle. The TRIVERTEX elements can represent any diagonally-opposed pair of rectangle vertices. Rectangle drawing is lower-right exclusive. Both TRIVERTEX and GRADIENT_RECT are defined in the Platform SDK documentation.
When triangles are being drawn, pMesh points to an array of GRADIENT_TRIANGLE structures, each of which specifies the three TRIVERTEX elements that define a triangle. Triangle drawing is lower-right exclusive. GRADIENT_TRIANGLE is defined in the Platform SDK documentation.
The gradient fill calculations for each mode are documented in the Comments section.
DrvGradientFill returns TRUE upon success. Otherwise, it returns FALSE and reports an error by calling EngSetLastError.
Declared in winddi.h. Include winddi.h.
DrvGradientFill can be optionally implemented in graphics drivers. GDI never calls this function for palletized surfaces.
The driver hooks DrvGradientFill by setting the HOOK_GRADIENTFILL flag when it calls EngAssociateSurface or EngModifySurface. If the driver has hooked DrvGradientFill and is called to perform an operation that it does not support, the driver should have GDI handle the operation by punting the data in a call to EngGradientFill.
GDI will not call DrvGradientFill for 8bpp destination surfaces.
The formulas for computing the color value at each pixel of the primitive depend on ulMode as follows:
RedP = (RedV1 * a1 + RedV2 * a2 + RedV3 * a3) / (a1+a2+a3) GreenP = (GreenV1 * a1 + GreenV2 * a2 + GreenV3 * a3) / (a1+a2+a3) BlueP = (BlueV1 * a1 + BlueV2 * a2 + BlueV3 * a3) / (a1+a2+a3)
RedP = (RedV2 * (Px - V1x) + RedV1 * (V2x - Px)) / (V2x-V1x) GreenP = (GreenV2 * (Px - V1x) + GreenV1 * (V2x - Px)) / (V2x-V1x) BlueP = (BlueV2 * (Px - V1x) + BlueV1 * (V2x - Px)) / (V2x-V1x)
RedP = (RedV2 * (Py-V1y) + RedV1 * (V2y - Py)) / (V2y-V1y) GreenP = (GreenV2 * (Py-V1y) + GreenV1 * (V2y - Py)) / (V2y-V1y) BlueP = (BlueV2 * (Py-V1y) + BlueV1 * (V2y - Py)) / (V2y-V1y)
The total error accumulated over all three color channels must not be more than eight (8). For more information about permissible error, see Special Effects in Display Drivers.
The driver should ignore the alpha value of the vertices, leaving the alpha channel unchanged for surfaces that support alpha blending.