1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-30 08:00:06 +00:00

Created Using JPEG PNG OSS (markdown)

Chuck Walbourn 2024-01-19 10:56:30 -08:00
parent 47d3eea23a
commit cf829cae8c

31
Using-JPEG-PNG-OSS.md Normal file

@ -0,0 +1,31 @@
The *DirectXTex* library makes use of the Windows Imaging Component (WIC) which includes a number of built-in codes 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](http://www.ijg.org/) or [libjpeg-turbo](https://github.com/libjpeg-turbo/libjpeg-turbo)).
## Using vcpkg
**UNDER DEVELOPMENT**
## 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);
```