GetPixelColor Method
The GetPixelColor method returns the color of a pixel defined by position.
GetPixelColor enables you to determine the color of:
• A clicked pixel
• A pixel at the corner locations
• A sequence of pixels in a row or column
This enables you to tell whether:
• A transparent area was clicked (take no action)
• The bitmap has transparency built in
• There is a structural feature in the bitmap like a border or an arrow
If no coordinates parameter is provided, the color of the pixel identified by the x and y parameters is returned. If the coordinates parameter is provided, the values of x and y are treated as offsets, and the pixels at the indexed position in the coordinates, offset by x,y, is returned (the index is provided by the coordindex parameter, which defaults to 1).
If x or y parameters are provided byref, their values on return will reflect the exact position from which the pixel color was retrieved.
This method has the following syntax:
integer = BitmapObject.GetPixelColor([x = integer, y = integer, ]
[coordinates = LongByteObject, coordindex = integer])
or
integer = BitmapObject.GetPixelColor([x = Byref(integer), y = Byref(integer), ]
[coordinates = LongByteObject, coordindex = integer])
This method has the following parameters:
x
Specifies the x location on the bitmap of the pixel to be examined.
y
Specifies the y location on the bitmap of the pixel to be examined.
coordinates
Contains the coordinates defining the pixel positions relative to x,y that may be used to identify the color to be examined; coordindex specifies which coordinate to use.
The coordinates must be supplied as a LongByteObject. These are created by the
FillBitmap Method and
ReplaceBitmap Method; see their documentation for information about how to create a coordinates long byte object.
coordindex
Specifies the index of the position in the coordinates to use when identifying the pixel to be examined.
Default: 1
The method returns the color of the position-specified pixel if successful. If the call fails, the bitmap's errorstatus is set to non-zero.
Last modified date: 12/20/2023