FreeImage.ApplyPaletteIndexMapping Method

FreeImage.NET

FreeImageApplyPaletteIndexMapping Method
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) Version: 3.17.0.4 (3.17.0)
Syntax
C#
public static uint ApplyPaletteIndexMapping(
	FIBITMAP dib,
	byte[] srcindices,
	byte[] dstindices,
	uint count,
	bool swap
)

Parameters

dib
Type: FreeImageAPIFIBITMAP
Handle to a FreeImage bitmap.
srcindices
Type: SystemByte
Array of palette indices to be used as the mapping source.
dstindices
Type: SystemByte
Array of palette indices to be used as the mapping destination.
count
Type: SystemUInt32
The number of palette indices to be mapped. This is the size of both srcindices and dstindices
swap
Type: SystemBoolean
If true, source and destination palette indices are swapped, that is, each destination index is also mapped to the corresponding source index.

Return Value

Type: UInt32
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, RGBQUAD, RGBQUAD, UInt32, Boolean, Boolean) does, which modifies the actual image data on palletized images.

See Also