This method retrieves the RGB values and palette number of the specified pixel in the Device Independent Bitmap (DIB).

[Visual Basic] Public Function GetBitmapPixel(x As Integer, y As Integer, palette As Byte, red As Byte, green As Byte, blue As Byte) As Boolean
[C#] public bool GetBitmapPixel(int x, int y, ref byte palette, ref byte red, ref byte green, ref byte blue);

Parameters

x,y
   The x,y coordinates of the specified pixel

palette
   The palette number of the specified pixel

red
   The red component of the RGB value of the specified pixel

green
   The green component of the RGB value of the specified pixel

blue
   The blue component of the RGB value of the specified pixel

Return Value

Returns True if successful. Returns False if unsuccessful.

Explanation

The GetBitmapPixel method retrieves the RGB values and palette number of the specified pixel in the Device Independent Bitmap (DIB). For 1, 4, and 8 bit images, the applicable values are set in the Palette parameter. For 16, 24, and 32 bit images, the applicable values are set in the red, green, and blue parameters.

The image to be processed is determined by the values set in the LayerNumber property.

To access the bitmap and manipulate pixel data, you must use the following methods as a group:

StartBitmapAccess
    |
GetBitmapPixel, SetBitmapPixel
    |
EndBitmapAccess

 

Example

The following code starts access to the DIB, then loops through each pixel in the image, using the GetBitmapPixel method to retrieve the pixels' rgb values. Then those values are reversed and set using the SetBitmapPixel method (For 1, 16, 24, or 32 bit images).

[Visual Basic]
Dim Ret As Boolean
Dim i As Long, j As Long
Dim PalNo As Integer, Red As Integer, Green As Integer, Blue As Integer

Ret = ImageKit1.GetImageType()
If Ret = False Then Exit Sub
Ret = ImageKit1.Effect.StartBitmapAccess()
If Ret = False Then Exit Sub                            
For i = 0 To ImageKit1.Image.Height - 1 For j = 0 To ImageKit1.Image.Width - 1 Ret = ImageKit1.Effect.GetBitmapPixel(j, i, PalNo, Red, Green, Blue) If ImageKit1.BitCount = 1 Then If PalNo <> 0 Then PalNo = 0 Else PalNo = 1 End If Else If ImageKit1.BitCount > 8 Then Blue = 255 - Blue Green = 255 - Green Red = 255 - Red End If Ret = ImageKit1.Effect.SetBitmapPixel(j, i, PalNo, Red, Green, Blue) Next j Next i Ret = ImageKit1.Effect.EndBitmapAccess() ImageKit1.Refresh()

See Also

ImageKit.Effect Members | Newtone.ImageKit.Win.ImageKit

 

The ImageKit.NET3 is created by Newtone Corporation