Skip to main content
Red
Tan

TdxAlphaColors.CalculateNearestColor(TdxAlphaColor[],TdxAlphaColor) Method

Picks a color from the provided limited set of colors that is most visually similar to the specified sample.

Declaration

class function CalculateNearestColor(const AColorsToChooseFrom: array of TdxAlphaColor; AValue: TdxAlphaColor): TdxAlphaColor; static;

Parameters

Name Type
AColorsToChooseFrom TdxAlphaColor
AValue TdxAlphaColor

Returns

Type
TdxAlphaColor

Remarks

This function obtains a color having the closest visual resemblance to the color passed as the AValue parameter, from an array of TdxAlphaColor values passed as the AColorsToChooseFrom parameter. The CalculateNearestColor function uses the HSB representation of an RGB color model to find the most similar color from the limited set. This function is particularly useful if you need to convert TrueColor pixel data to a required limited palette.

See Also