D3DXFilterTexture
Filters mipmap levels of a texture.
HRESULT D3DXFilterTexture(
LPDIRECT3DTEXTURE8 pTexture,
CONST PALETTEENTRY* pPalette,
UINT SrcLevel,
DWORD MipFilter
);
Parameters
- pTexture
- [in] Pointer to an IDirect3DTexture8 interface, representing the texture object to filter.
- pPalette
- [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.
- SrcLevel
- [in] The level whose image is used to generate the subsequent levels. Specifying D3DX_DEFAULT for this parameter is equivalent to specifying 0.
- MipFilter
- [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.
- 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.
Remarks
A box-filter is recursively applied to each texture level to generate the next texture level.
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 Platform SDK. The peFlags member is now the alpha channel for 8-bit palletized formats.
Header: Declared in D3dx8tex.h.
Import Library: Use D3dx8.lib.