Interface IColorPalette
The color palette interface.
public interface IColorPalette
Properties
Argb32Entries
Gets an array of 32-bit ARGB structures.
int[] Argb32Entries { get; }
Property Value
- int[]
The 32-bit ARGB entries.
Entries
Gets an array of Color structures.
Color[] Entries { get; }
Property Value
- Color[]
The entries.
EntriesCount
Gets the entries count.
int EntriesCount { get; }
Property Value
- int
The entries count.
IsCompactPalette
Gets a value indicating whether compact palette is used.
bool IsCompactPalette { get; }
Property Value
- bool
true
if compact palette is used; otherwise,false
.
Remarks
Compact palette means that image will contain only the specified palette entries if possible or in other words the image will be more compact and occupy less space; otherwise there will be 2^BitsPerPixel entries and image will reserve more space for all possible palette entries. Setting this value to true and changing palette entries may cause performance penalty since data movement may occur so use it carefully.
Methods
GetArgb32Color(int)
Gets the 32-bit ARGB palette color by index.
int GetArgb32Color(int index)
Parameters
index
intThe 32-bit ARGB palette color index.
Returns
- int
The color palette entry specified by the
index
.
Exceptions
- ArgumentOutOfRangeException
if color palette
index
specified is out of the palette entries range.
GetColor(int)
Gets the palette color by index.
Color GetColor(int index)
Parameters
index
intThe palette color index.
Returns
- Color
The color palette entry specified by the
index
.
Exceptions
- ArgumentOutOfRangeException
if color palette
index
specified is out of the palette entries range.
GetNearestColorIndex(Color)
Gets the index of the nearest color.
int GetNearestColorIndex(Color color)
Parameters
color
ColorThe color.
Returns
- int
The index of the nearest color.
GetNearestColorIndex(int)
Gets the index of the nearest 32-bit ARGB color.
int GetNearestColorIndex(int argb32Color)
Parameters
argb32Color
intThe 32-bit ARGB color.
Returns
- int
The index of the nearest color.