Windows Mobile 6.5
A version of this page is also available for

This method allows an application to fill a surface with a given pixel color in a given rectangle. Do not use this method to clear the swap chain. You can accomplish this task more effectively by calling the IDirect3DMobileDevice::Clear method instead. Also, the IDirect3DMobileDevice::ColorFill method does not allow the application to fill the depth buffer.

HRESULT ColorFill(
  IDirect3DMobileSurface* pSurface,
  CONST RECT* pRect,


[in] A pointer to an IDirect3DMobileSurface interface representing the surface that will be contain the rectangle. Setting this parameter to NULL fills the entire surface. This surface must be a render target or a render target texture.


[in] A pointer to a RECT structure that defines the rectangular region.


[in] A D3DMCOLOR value that defines the color to fill the rectangle with.

If the method succeeds, the return value is D3DM_OK (see D3DM Values).

If the method fails, the return value can be D3DERR_INVALIDCALL (see D3DMERR Values).

LibraryD3dm.lib, D3dmguid.lib
Windows Embedded CEWindows CE 5.0 and later
Windows MobileWindows Mobile Version 5.0 and later