-
Notifications
You must be signed in to change notification settings - Fork 453
Convert
Convert an image or set of images from one pixel format to another.
HRESULT Convert(
const Image& srcImage,
DXGI_FORMAT format, DWORD filter,
float threshold, ScratchImage& image );
HRESULT Convert(
const Image* srcImages, size_t nimages,
const TexMetadata& metadata,
DXGI_FORMAT format, DWORD filter,
float threshold, ScratchImage& result );
format: Target format for conversion.
filter: See Filter Flags
threshold: Alpha threshold used for converting to single bit alpha channels (0 to 1 range). Typically use is to pass TEX_THRESHOLD_DEFAULT
(0.5).
ScratchImage srcImage;
...
ScratchImage destImage;
hr = Convert( srcImage.GetImages(), srcImage.GetImageCount(),
srcImage.GetMetadata(),
DXGI_FORMAT_R8G8B8A8_UNORM, TEX_FILTER_DEFAULT, TEX_THRESHOLD_DEFAULT,
destImage );
if ( FAILED(hr) )
...
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.
All content and source code for this package are subject to the terms of the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
- Universal Windows Platform apps
- Windows desktop apps
- Windows 11
- Windows 10
- Windows 8.1
- Xbox One
- Xbox Series X|S
- Windows Subsystem for Linux
- x86
- x64
- ARM64
- Visual Studio 2022
- Visual Studio 2019 (16.11)
- clang/LLVM v12 - v18
- GCC 10.5, 11.4, 12.3
- MinGW 12.2, 13.2
- CMake 3.20
DirectX Tool Kit for DirectX 11