Language Reference Guide : 4. System Classes : BitmapObject Class : SetPixelColor Method
 
Share this page                  
SetPixelColor Method
The SetPixelColor method applies a specified replacement color to one or more pixels defined by position.
SetPixelColor enables you to adjust bitmaps at runtime, for example, to recolor areas of a bitmap to a specified color, to dim them, or make some other indication of status. SetPixelColor uses FillBitmap with a seed pixel of the required color. Since you do not know which pixels are the seed pixel color, you must set one (and afterward, reset it) using SetPixelColor.
If no coordinates parameter is provided, the single pixel identified by the x and y parameters is recolored. If the coordinates parameter is provided, the values of x and y are treated as offsets, and the pixels at each position listed in the coordinates, offset by x,y, are recolored.
If the BitmapObject is attached to a FormField or a stored TaggedValue Item, using this in your program during development may change your frame's source definition. See BitmapObject Attributes and Methods Affecting the Frame Source (see BitmapObject Class).
This method has the following syntax:
integer = BitmapObject.SetPixelColor([x = integer, y = integer, ]
          color = integer[, coordinates = LongByteObject])
This method has the following parameters:
x
Specifies the x location on the bitmap of the pixel to be recolored.
y
Specifies the y location on the bitmap of the pixel to be recolored.
color
(Required) Specifies the color used to recolor the pixels.
This parameter is mandatory (there is no default).
coordinates
Contains the coordinates defining the pixel positions relative to x,y at which the new color is to be applied. The coordinates must be supplied as a LongByteObject. These are created by the FillBitmap (see FillBitmap Method) and ReplaceBitmap (see ReplaceBitmap Method) methods; see their documentation for information about how to create a coordinates long byte object.
The method returns the previous color of the last changed pixel if successful. If the call fails, the bitmap's errorstatus is set to non-zero.