Description
Currently the DDS, TGA, and WIC readers always expand P8 and A8P8 format images to RGBA32. This is the primary workflow, and makes sense as the default behavior. Most of the operations/functions in the library do not support paletted data by design. Direct3D 11 and Direct3D 12 do not support palette texture formats, although in theory you could implement them with a programmable shader.
I could make use of the DXGI enumerations DXGI_FORMAT_P8
and DXGI_FORMAT_A8P8
which were added for video support to return the data in the original paletted form.
This would also require some way to retrieve the palette data as well (like adding a palette
member to Image
).
Requesting this behavior on read rather than the current behavior to always expand the data would require some specific behavior flag (DDS_FLAGS_ALLOW_P8
, TGA_FLAGS_ALLOW_P8
, WIC_FLAGS_ALLOW_P8
).
Writing would be indicated by giving an input image with DXGI_FORMAT_P8
or DXGI_FORMAT_A8P8
.
If there was some reason to support this palette workflow, then it would be worth considering adding a codec for the
PCX
which is a classic paletted format.
"palette workflow" would also imply the need for explicit functions to convert P8/A8P8 to RGBA32, and a function for converting RGBA32 to a P8/A8P8 image using something like "median cut" (see this article).