This method retrieves the palette information for a raster image
[Visual Basic]   [ Boolean = ]imagekitcontrolname.GetPalette(Red As Integer, Green As Integer, Blue As Integer, ImageHandle As LONG_PTR)
[Visual C++]     [ BOOL = ]imagekitcontrolname.GetPalette(short *Red, short *Green, short *Blue, LONG_PTR ImageHandle)
[VB.NET]   [ Boolean = ]imagekitcontrolname.GetPalette(ByRef Red As Short, ByRef Green As Short, ByRef Blue As Short, ImageHandle As Integer(x86) or Long(x64))
[C#.NET]   [ bool = ]imagekitcontrolname.GetPalette(ref short Red, ref short Green, ref short Blue, int(x86) or long(x64) ImageHandle)

(x86) refers to the 32 bit version, (x64) refers to the 64 bit version.

Parameters

Name Explanation
Red Array of the retrieved red palette information. *
Green Array of the retrieved green palette information. *
Blue Array of the retrieved blue palette information. *
ImageHandle The image handle of the raster image.

* (1) In Visual Basic pass the arguments as Red(0)
(2) In Visual C++ pass the pointer to the top of the array
(3) In VB.NET pass the arguments as Red(0)
(4) In C#.NET pass the arguments as Red[0]

Return Value

Returns True (nonzero) if successful, otherwise returns False (0).

Explanation

When the ImageHandle parameter contains a valid image handle
The image data that the ImageHandle parameter refers to will be processed.


When the ImageHandle parameter contains 0
The image data determined by the LayerNo property will be processed. If the LayerNo property is -1 (the base image) then the image data referred to by the ImageHandle property will be processed. If the value of the LayerNo property is between 0 and 99 then the image data referred to by the Layer(LayerNo).ImageHandle property will be processed.


To find out how many items are in the various RGB arrays, please refer to the PalCount property. The PalCount property value is refreshed when ever an image handle is set into the ImageHandle property of the Layer(LayerNo).ImageHandle property. Use the GetImageType method to retrieve the PalCount property value.

For programs in ASP or other scripting languages that use variant types, or in VB.NET or C#.NET x64 build, please refer to the GetPaletteVariant method.

Examples:

In Visual Basic:

    Dim r() As Integer

    Dim g() As Integer

    Dim b() As Integer


    ImageKit1.LayerNo = -1

    If ImageKit1.PalCount < 1 Then Exit Sub

    ReDim r(0 To ImageKit1.PalCount - 1)

    ReDim g(0 To ImageKit1.PalCount - 1)

    ReDim b(0 To ImageKit1.PalCount - 1)

    ImageKit1.GetPalette r(0), g(0), b(0), 0

    'using the rgb values....

    ImageKit1.SetPalette r(0), g(0), b(0), 0



In Visual C++:

    ImageKit1.SetLayerNo(-1);

    if (ImageKit1.GetPalCount() < 1) return;

    short *r = new short[ImageKit1.GetPalCount()];

    short *g = new short[ImageKit1.GetPalCount()];

    short *b = new short[ImageKit1.GetPalCount()];

    ImageKit1.GetPalette(r, g, b, 0);

    // using the rgb values

    ImageKit1.SetPalette(r, g, b, 0);


    delete[] r;

    delete[] g;

    delete[] b;



In VB.NET:

    ImageKit1.LayerNo = -1

    If ImageKit1.PalCount < 1 Then Exit Sub

    Dim r as Short() = New Short(ImageKit1.PalCount - 1){}

    Dim g as Short() = New Short(ImageKit1.PalCount - 1){}

    Dim b as Short() = New Short(ImageKit1.PalCount - 1){}

    ImageKit1.GetPalette(r(0), g(0), b(0), 0)

    'using the rgb values....

    ImageKit1.SetPalette(r(0), g(0), b(0), 0)



In C#.NET:

    ImageKit1.LayerNo = -1;

    if(ImageKit1.PalCount < 1) return;

    short []r = new short[ImageKit1.PalCount];

    short []g = new short[ImageKit1.PalCount];

    short []b = new short[ImageKit1.PalCount];

    ImageKit1.GetPalette(ref r[0], ref g[0], ref b[0], 0);

    //using the rgb values....

    ImageKit1.SetPalette(ref r[0], ref g[0], ref b[0], 0);

Differences from ImageKit7/8

  The ImageHandle argument has a different type.

 

The ImageKit9 ActiveX is a product created by Newtone Corporation