Microsoft DirectX 9.0

IDirect3DDevice9::ColorFill Method

Allows an application to fill a rectangular area of a D3DPOOL_DEFAULT surface with a specified color.


HRESULT ColorFill(      

    IDirect3DSurface9 *pSurface,     CONST RECT *pRect,     D3DCOLOR color );


[in] Pointer to the surface to be filled.
[in] Pointer to the source rectangle. Using NULL means that the entire surface will be filled.
[in] Color used for filling.

Return Value

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value can be

D3DERR_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.


This method can only be applied to a render target, a render target texture surface, or an off-screen plain surface with a pool type of D3DPOOL_DEFAULT.

IDirect3DDevice9::ColorFill will work with all formats. However, when using a reference or software device, the only formats supported are D3DFMT_X1R5G5B5, D3DFMT_A1R5G5B5, D3DFMT_R5G6B5, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8, D3DFMT_YUY2, D3DFMT_G8R8_G8B8, D3DFMT_UYVY, D3DFMT_R8G8_B8G8, D3DFMT_R16F, D3DFMT_G16R16F, D3DFMT_A16B16G16R16F, D3DFMT_R32F, D3DFMT_G32R32F, and D3DFMT_A32B32G32R32F.

When using a Microsoft?DirectX?7.0 or DirectX 8.x driver, the only YUV formats supported are D3DFMT_UYVY and D3DFMT_YUY2.

See Also


© 2002 Microsoft Corporation. All rights reserved.