Windows CE .NET

This function filters mipmap levels of a texture.

HRESULT D3DXFilterTexture(
  UINT SrcLevel,
  DWORD MipFilter


[in] Pointer to an IDirect3DTexture8 interface, representing the texture object to filter.
[out] Pointer to a PALETTEENTRY structure, representing a 256-color palette to fill in, or NULL for nonpalletized formats. If a palette is not specified, the default Microsoft® Direct3D® palette (an all opaque white palette) is provided. See Remarks.
[in] The level whose image is used to generate the subsequent levels. Specifying D3DX_DEFAULT for this parameter is equivalent to specifying 0.
[in] A combination of one or more flags controlling how the mipmap is filtered. Specifying D3DX_DEFAULT for this parameter is the equivalent of specifying D3DX_FILTER_BOX | D3DX_FILTER_DITHER.

Each valid filter must contain exactly one of the following flags.

Flag Description
D3DX_FILTER_BOX Each pixel is computed by averaging a 2×2(×2) box of pixels from the source image. This filter works only when the dimensions of the destination are half those of the source, as is the case with mipmaps.
D3DX_FILTER_LINEAR Each destination pixel is computed by sampling the four nearest pixels from the source image. This filter works best when the scale on both axes is less than two.
D3DX_FILTER_NONE No scaling or filtering will take place. Pixels outside the bounds of the source image are assumed to be transparent black.
D3DX_FILTER_POINT Each destination pixel is computed by sampling the nearest pixel from the source image.
D3DX_FILTER_TRIANGLE Every pixel in the source image contributes equally to the destination image. This is the slowest of the filters.

In addition, you can use the OR operator to specify zero or more of the following optional flags with a valid filter.

D3DX_FILTER_MIRROR Specifying this flag is the same as specifying the D3DX_FILTER_MIRROR_U, D3DX_FILTER_MIRROR_V, and D3DX_FILTER_MIRROR_W flags.
D3DX_FILTER_MIRROR_U Pixels off the edge of the texture on the u-axis should be mirrored, not wrapped.
D3DX_FILTER_MIRROR_V Pixels off the edge of the texture on the v-axis should be mirrored, not wrapped.
D3DX_FILTER_MIRROR_W Pixels off the edge of the texture on the w-axis should be mirrored, not wrapped.
D3DX_FILTER_DITHER This flag indicates that the resulting image be dithered using a 4x4 ordered dither algorithm.

Return Values

If the function succeeds, the return value is D3D_OK.

If the function fails, the return value can be one of the following values.



A box-filter is recursively applied to each texture level to generate the next texture level.

Writing to a non-level-zero surface of the texture will not cause the dirty rectangle to be updated. If D3DXFilterTexture is called and the surface was not already dirty (this is unlikely under normal usage scenarios), the application needs to explicitly call IDirect3DTexture8::AddDirtyRect on the texture.

Textures created in the default pool (D3DPOOL_DEFAULT) cannot be used with D3DXFilterTexture because a lock operation is needed on the object. Note that locks are prohibited on textures in the default pool.

For details on PALETTEENTRY, see the Microsoft® Platform Software Development Kit (SDK). Note that as of Microsoft DirectX® 8.0, the peFlags member of the PALLETTEENTRY structure does not function as documented in the Windows SDK. The peFlags member is now the alpha channel for 8-bit palletized formats.


OS Versions: Windows CE .NET 4.0 and later.
Header: D3dx8tex.h.
Link Library: D3dx8.lib.

See Also

IDirect3DTexture8 | IDirect3DTexture8::AddDirtyRect | PALETTEENTRY

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.