PaletteGetNearestColorIndex Method

Gets the index of a Palette entry that is the nearest color to the specified Color32 instance.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.2.0
C#
public int GetNearestColorIndex(
	Color32 c
)

Parameters

c  Color32
The color for which the nearest palette entry index should be returned.

Return Value

Int32
The index of a Palette entry that is the nearest color to the specified Color32 instance.

Remarks

If the Palette does not contain the specified color, then the result may depend on the arguments passed to the constructor.

If c has transparency, then the result may depend on BackColor and AlphaThreshold values.

The result can be customized by passing a non- delegate to one of the Palette constructors.

  Note

For more details see the Remarks section of the Palette class.

See Also