Table of Contents
DirectXTex |
---|
The DirectXTex library makes use of the Windows Imaging Component (WIC) which includes a number of built-in codecs for BMP, JPEG, PNG, etc. On Windows Subsystem for Linux, however, WIC is not present so only the DDS, HDR, and TGA file formats are supported by the library.
Using CMake there is an option to opt-in to using the Open Source libjpeg (ENABLE_LIBJPEG_SUPPORT
) and/or libpng (ENABLE_LIBPNG_SUPPORT
) libraries to provide support for these file formats on Windows Subsystem for Linux.
The CMake option to use these libraries is also supported on Windows, but this is not recommended for both security servicing and code size reasons. They are supported on Windows for testing purposes.
libjpeg
The files Auxiliary/DirectXTexJPEG.h
and DirectXTexJPEG.cpp
implement the following wrapper functions for libjpeg (ijg-libjpeg or libjpeg-turbo).
Using vcpkg
With the vcpkg C++ Package Manager, you can opt in to the png
feature to include this functionality for Linux:
vcpkg install directxtex[png]
License
The libjpeg-turbo library is licensed under BSD-3-Clause, while ijg-libjpeg has a custom license.
Functions
HRESULT GetMetadataFromJPEGFile(const wchar_t* szFile, TexMetadata& metadata);
HRESULT LoadFromJPEGFile(const wchar_t* szFile, TexMetadata* metadata, ScratchImage& image);
HRESULT SaveToJPEGFile(const Image& image, const wchar_t* szFile);
libpng
The files Auxiliary/DirectXTexPNG.h
and DirectXTexPNG.cpp
implement the following wrapper functions for libpng.
Using vcpkg
With the vcpkg C++ Package Manager, you can opt in to the jpeg
feature to include this functionality for Linux:
vcpkg install directxtex[jpeg]
License
The libpng library is licensed under a custom license known as the PNG Reference Library License.
Functions
HRESULT GetMetadataFromPNGFile(const wchar_t* szFile, TexMetadata& metadata);
HRESULT LoadFromPNGFile(const wchar_t* szFile, TexMetadata* metadata, ScratchImage& image);
HRESULT SaveToPNGFile(const Image& image, const wchar_t* szFile);
References
Credit
Thanks to Park DongHa for their contribution of these functions to the library.
For Use
- Universal Windows Platform apps
- Windows desktop apps
- Windows 11
- Windows 10
- Windows 8.1
- Windows 7 Service Pack 1
- Xbox One
- Xbox Series X|S
- Windows Subsystem for Linux
Architecture
- x86
- x64
- ARM64
For Development
- 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
Related Projects
DirectX Tool Kit for DirectX 11
DirectX Tool Kit for DirectX 12
Tools
See also
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 opencode@microsoft.com with any additional questions or comments.