Open walbourn opened 1 month ago
Trying to create new flag constants such as 'DDS_FLAGS_ALLOW_P8', 'TGA_FLAGS_ALLOW_P8', and 'WIC_FLAGS_ALLOW_P8'. These flags should be clearly defined in your library to indicate that the reder should allow for paletted formats.
Also, considering the addition of a codec for classic paletted formats like PCX seems like a great step as well. PCX would be suport various image formats.
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
andDXGI_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 toImage
).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
orDXGI_FORMAT_A8P8
.