This method retrieves the palette information for a raster image.

[Visual Basic] Public Function GetPalette(By Ref Red() As Byte, ByRef Green() As Byte, ByRef Blue() As Byte, GetImg As Image) As Boolean
[C#] public bool GetPalette(ref byte []Red, ref byte []Green, ref byte []Blue, Image GetImg) ;

Parameters

Red
   Array of the retrieved red palette information
   (1)Visual Basic: the syntax of the argument is Red(0)
   (2)C#: the syntax of the argument is ref Red[]

Green
   Array of the retrieved green palette information
   (1)Visual Basic: the syntax of the argument is Green(0)
   (2)C#: the syntax of the argument is ref Green[]

Blue
   Array of the retrieved blue palette information
   (1)Visual Basic: the syntax of the argument is Blue(0)
   (2)C#: the syntax of the argument is ref Blue[]

GetImg
   The raster image

Return Value

Returns True if successful. Returns False if unsuccessful.

Explanation

The GetPalette method retrieves the palette information for a raster image.

When the GetImg parameter contains a valid image

The image data that the GetImg parameter refers to will be processed.

When the GetImg parameter contains 0

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

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

Example

[Visual Basic]
Dim r() As Byte
Dim g() As Byte
Dim b() As Byte

ImageKit1.LayerNumber = -1
If ImageKit1.PaletteCount = 1 Then
  Exit Sub
End If

ReDim r(0 To ImageKit1.PaletteCount - 1)
ReDim g(0 To ImageKit1.PaletteCount - 1)
ReDim b(0 To ImageKit1.PaletteCount - 1)

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

[C#]
byte[] r = new byte[imageKit1.PaletteCount];
byte[] g = new byte[imageKit1.PaletteCount];
byte[] b = new byte[imageKit1.PaletteCount];

imageKit1.LayerNumber := -1;
if (imageKit1.PaletteCount == 1) return false;
imageKit1.GetPalette(ref r, ref g, ref b, null); 

See Also

ImageKit Members | Newtone.ImageKit.Wpf.ImageKit

 

The ImageKit WPF is created by Newtone Corporation