GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / PaletteGetEntry Method
GdPicture image identifier.
Index of the color palette. Must be a value between 0 and PaletteGetColorsCount() - 1 returned value.
Example





In This Topic
PaletteGetEntry Method (GdPictureImaging)
In This Topic
Returns the color of a specific entry of the palette of a GdPicture image.
Syntax
'Declaration
 
Public Function PaletteGetEntry( _
   ByVal ImageID As Integer, _
   ByVal Entry As Integer _
) As Color
public Color PaletteGetEntry( 
   int ImageID,
   int Entry
)
public function PaletteGetEntry( 
    ImageID: Integer;
    Entry: Integer
): Color; 
public function PaletteGetEntry( 
   ImageID : int,
   Entry : int
) : Color;
public: Color PaletteGetEntry( 
   int ImageID,
   int Entry
) 
public:
Color PaletteGetEntry( 
   int ImageID,
   int Entry
) 

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);
}
See Also