PaletteSwapEntries Method (GdPictureImaging)
Returns the color of a specific entry of the palette of a GdPicture image.
public function PaletteSwapEntries(
: Integer;
: Integer;
: Integer
): GdPictureStatus;
public function PaletteSwapEntries(
: int,
: int,
: int
) : GdPictureStatus;
'Declaration
Public Function PaletteSwapEntries( _
ByVal As Integer, _
ByVal As Integer, _
ByVal As Integer _
) As GdPictureStatus
Parameters
- ImageID
- GdPicture image identifier.
- Entrie1
- Index of the color palette to swap with the second. Must be a value between 0
and PaletteGetColorsCount() - 1 returned value.
- Entrie2
- Index of the color palette to swap with the first. Must be a value between 0
and PaletteGetColorsCount() - 1 returned value.
Return Value
A member of the GdPictureStatus enumeration.
Opening a B&W indexed image, swapping palette entries and saving the result into a PNG file.
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.PaletteGetColorsCount(imageID) == 2)
{
// Swapping palette entries in B&W image means that the image will be inverted.
gdpictureImaging.PaletteSwapEntries(imageID, 0, 1);
gdpictureImaging.SaveAsPNG(imageID, "output.png");
}
else Console.WriteLine("The loaded image is not of B&W type!");
// Release used resources.
gdpictureImaging.ReleaseGdPictureImage(imageID);
}