PaletteGetEntry Method (GdPictureImaging)
Returns the color of a specific entry of the palette of a GdPicture image.
public Color PaletteGetEntry(
int ,
int
)
public function PaletteGetEntry(
: Integer;
: Integer
): Color;
public function PaletteGetEntry(
: int,
: int
) : Color;
public: Color PaletteGetEntry(
int ,
int
)
public:
Color PaletteGetEntry(
int ,
int
)
'Declaration
Public Function PaletteGetEntry( _
ByVal As Integer, _
ByVal As Integer _
) As Color
Parameters
- ImageID
- GdPicture image identifier.
- Entry
- Index of the color palette. Must be a value between 0 and
PaletteGetColorsCount() - 1 returned value.
Return Value
Color of the selected entry.
Getting information about the specific palette entry of the selected image and showing the result on the screen.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// Open an image file. An empty string allows the control to prompt for selecting a file.
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("");
if (gdpictureImaging.IsPixelFormatIndexed(imageID))
{
int entriesCount = gdpictureImaging.PaletteGetColorsCount(imageID);
if (entriesCount > 255)
{
System.Drawing.Color entryColor = gdpictureImaging.PaletteGetEntry(imageID, 130);
Console.WriteLine("Color value of palette entry [130] is: {0}", entryColor.ToString());
}
else Console.WriteLine("Image do not contain palette with 256 colors!");
}
else Console.WriteLine("Image do not contain indexed colors!");
// Release used resources.
gdpictureImaging.ReleaseGdPictureImage(imageID);
}