microsoft / DirectXTK

The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++

Home Page:https://walbourn.github.io/directxtk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expose original image format in WICTextureLoader

SlidyBat opened this issue · comments

When loading, for example, a JPEG image it's format will be GUID_WICPixelFormat24bppRGB, but that gets converted to GUID_WICPixelFormat32bppRGBA by the loader (the extra alpha channel was added).

I'd like to be able to know whether the original image format had an alpha channel or not so I can automatically detect textures that are potentially translucent, but doesn't seem possible to do that at the moment.

WICTextureLoader is by design very simple. For more sophisticated loading needs, the DirectXTex library is a better choice. See this blog post for more details on why I have two different libraries here.

I explicitly address this scenario for DirectXTex in this pull request