PaletteGetEntry Method (GdPictureImaging)
In This Topic
Returns the color of a specific entry of the palette of a GdPicture image.
Syntax
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.
Example
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);
}
Example
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);
}
See Also