Applies palette index mapping for one or several indices on a 1-, 4- or 8-bit palletized image.

Namespace:  FreeImageAPI
Assembly:  FreeImageNET (in FreeImageNET.dll)

Syntax

C#
public static uint ApplyPaletteIndexMapping(
	FIBITMAP dib,
	byte[] srcindices,
	byte[] dstindices,
	uint count,
	bool swap
)
Visual Basic (Declaration)
Public Shared Function ApplyPaletteIndexMapping ( _
	dib As FIBITMAP, _
	srcindices As Byte(), _
	dstindices As Byte(), _
	count As UInteger, _
	swap As Boolean _
) As UInteger
Visual C++
public:
static unsigned int ApplyPaletteIndexMapping(
	FIBITMAP dib, 
	array<unsigned char>^ srcindices, 
	array<unsigned char>^ dstindices, 
	unsigned int count, 
	bool swap
)

Parameters

dib
Type: FreeImageAPI..::.FIBITMAP
Handle to a FreeImage bitmap.
srcindices
Type: array< System..::.Byte >[]()[]
Array of palette indices to be used as the mapping source.
dstindices
Type: array< System..::.Byte >[]()[]
Array of palette indices to be used as the mapping destination.
count
Type: System..::.UInt32
The number of palette indices to be mapped. This is the size of both srcindices and dstindices
swap
Type: System..::.Boolean
If true, source and destination palette indices are swapped, that is, each destination index is also mapped to the corresponding source index.

Return Value

The total number of pixels changed.

Remarks

This function maps up to count palette indices specified in srcindices to these specified in dstindices. Thereby, index srcindices[N], if present in the image, will be replaced by index dstindices[N]. If swap is true, additionally all indices specified in dstindices are also mapped to these specified in srcindices.

The function returns the number of pixels changed or zero, if no pixels were changed. Both arrays srcindices and dstindices are assumed not to hold less than count indices.

Note, that this behaviour is different from what ApplyColorMapping(FIBITMAP, array<RGBQUAD>[]()[], array<RGBQUAD>[]()[], UInt32, Boolean, Boolean) does, which modifies the actual image data on palletized images.

Version Information

FreeImage.NET

Supported in: 3.11.0, 3.12.0, 3.13.0, 3.13.1

See Also