Convert an image or set of images from one pixel format to another.

HRESULT Convert( _In_ const Image& srcImage,
    _In_ DXGI_FORMAT format, _In_ DWORD filter,
    _In_ float threshold, _Out_ ScratchImage& image );

HRESULT Convert( _In_reads_(nimages) const Image* srcImages, _In_ size_t nimages,
    _In_ const TexMetadata& metadata,
    _In_ DXGI_FORMAT format, _In_ DWORD filter,
    _In_ float threshold, _Out_ ScratchImage& result );

Parameters

format: Target format for conversion.

filter: See Filter Flags

threshold: Alpha threshold used for converting to single bit alpha channels (0 to 1 range)

Example


ScratchImage srcImage;

...

ScratchImage destImage;
hr = Convert( srcImage.GetImages(), srcImage.GetImageCount(), srcImage.GetMetadata(),
    DXGI_FORMAT_R8G8B8A8_UNORM, TEX_FILTER_DEFAULT, 0.5f, destImage );
if ( FAILED(hr) )
    ...

Remarks

This function does not operate directly on block compressed images. See Decompress and Compress.

This function cannot operate directly on a planar format image. See ConvertToSinglePlane for a method for converting planar data to a format that is supported by this routine.

This function is implemented with both WIC and non-WIC code paths. The non-WIC paths is generally used when the standard WIC conversion behavior is unintuitive for textures or would modify the color space in unexpected ways.

Last edited Feb 14, 2014 at 9:47 PM by walbourn, version 5