FreeImage.SwapColors Method

FreeImage.NET

FreeImageSwapColors Method
Swaps two specified colors on a 1-, 4- or 8-bit palletized or a 16-, 24- or 32-bit high color image.

Namespace: FreeImageAPI
Assembly: FreeImageNET (in FreeImageNET.dll) Version: 3.17.0.4 (3.17.0)
Syntax
C#
public static uint SwapColors(
	FIBITMAP dib,
	ref RGBQUAD color_a,
	ref RGBQUAD color_b,
	bool ignore_alpha
)

Parameters

dib
Type: FreeImageAPIFIBITMAP
Handle to a FreeImage bitmap.
color_a
Type: FreeImageAPIRGBQUAD
One of the two colors to be swapped.
color_b
Type: FreeImageAPIRGBQUAD
The other of the two colors to be swapped.
ignore_alpha
Type: SystemBoolean
If true, 32-bit images and colors are treated as 24-bit.

Return Value

Type: UInt32
The total number of pixels changed.
Remarks
This function swaps the two specified colors color_a and color_b on a palletized or high color image. For high color images, the actual image data will be modified whereas, for palletized images only the palette will be changed.

Note, that this behaviour is different from what SwapPaletteIndices(FIBITMAP, Byte, Byte) does, which modifies the actual image data on palletized images.

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

return ApplyColorMapping(dib, color_a, color_b, 1, ignore_alpha, true);

See Also