RGBSurface.Pixel

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

RGBSurface.Pixel(x as Double, y as Double) As Color

Supported for all project types and targets.

Returns the color of the object at location specified by the x and y parameters.

Sample Code

This example replaces all the black pixels in a Picture, somePicture, with white:

Var surf As RGBSurface = somePicture.RGBSurface
Var lastX As Integer = somePicture.Width - 1
Var lastY As Integer = somePicture.Height - 1
For y As Integer = 0 To lastY
For x As Integer = 0 To lastX
If surf.Pixel(x, y) = &c000000 Then
surf.Pixel(x, y) = &cFFFFFF
End if
Next
Next