FreeImage.NET Class Library Reference
FreeImageApplyColorMapping Method |
Applies color mapping for one or several 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 ApplyColorMapping( FIBITMAP dib, RGBQUAD[] srccolors, RGBQUAD[] dstcolors, uint count, bool ignore_alpha, bool swap )
Parameters
- dib
- Type: FreeImageAPIFIBITMAP
Handle to a FreeImage bitmap. - srccolors
- Type: FreeImageAPIRGBQUAD
Array of colors to be used as the mapping source. - dstcolors
- Type: FreeImageAPIRGBQUAD
Array of colors to be used as the mapping destination. - count
- Type: SystemUInt32
The number of colors to be mapped. This is the size of both srccolors and dstcolors. - ignore_alpha
- Type: SystemBoolean
If true, 32-bit images and colors are treated as 24-bit. - swap
- Type: SystemBoolean
If true, source and destination colors are swapped, that is, each destination color is also mapped to the corresponding source color.
Return Value
Type: UInt32The total number of pixels changed.
Remarks
This function maps up to count colors specified in
srccolors to these specified in dstcolors.
Thereby, color srccolors[N], if found in the image, will be replaced by color
dstcolors[N]. If swap is true, additionally all colors
specified in dstcolors are also mapped to these specified
in srccolors. For high color images, the actual image data will be
modified whereas, for palletized images only the palette will be changed.
The function returns the number of pixels changed or zero, if no pixels were changed.
Both arrays srccolors and dstcolors are assumed not to hold less than count colors.
For 16-bit images, all colors specified are transparently converted to their proper 16-bit representation (either in RGB555 or RGB565 format, which is determined by the image's red- green- and blue-mask).
Note, that this behaviour is different from what ApplyPaletteIndexMapping(FIBITMAP, Byte, Byte, UInt32, Boolean) does, which modifies the actual image data on palletized images.
See Also