Look at SwapChannelsOfPalette for details.
function ImSwapChannelsOfPalette(Pal: PPalette32; Entries: LongInt; SrcChannel: LongInt; DstChannel: LongInt): Boolean; cdecl;
ImagingExport (at line 176)