FreeImage.SwapPaletteIndices Method

FreeImage.NET

FreeImageSwapPaletteIndices Method
Swaps two specified palette indices on a 1-, 4- or 8-bit palletized image.

Namespace: FreeImageAPI
Assembly: FreeImageNET (in FreeImageNET.dll) Version: 3.17.0.4 (3.17.0)
Syntax
C#
public static uint SwapPaletteIndices(
	FIBITMAP dib,
	ref byte index_a,
	ref byte index_b
)

Parameters

dib
Type: FreeImageAPIFIBITMAP
Handle to a FreeImage bitmap.
index_a
Type: SystemByte
One of the two palette indices to be swapped.
index_b
Type: SystemByte
The other of the two palette indices to be swapped.

Return Value

Type: UInt32
The total number of pixels changed.
Remarks
This function swaps the two specified palette indices index_a and index_b on a palletized image. Therefore, not the palette, but the actual image data will be modified.

Note, that this behaviour is different from what SwapColors(FIBITMAP, RGBQUAD, RGBQUAD, Boolean) does on palletized images, which only swaps the colors in the palette.

This is just a thin wrapper for ApplyColorMapping(FIBITMAP, RGBQUAD, RGBQUAD, UInt32, Boolean, Boolean) and resolves to:

return ApplyPaletteIndexMapping(dib, index_a, index_b, 1, true);

See Also