Property

Graphics.Pixel


Warning

This item was deprecated in version 2016r1. Please use RGBSurface as a replacement.

Description

Used to get and set the color of a particular Pixel. You can do the same thing with RGBSurface.Pixel which is significantly faster.

Notes

Pixel has been updated to properly support alpha channels by taking them into account when rendering them. Additionally, Pixel with always return Nil for pointers with alpha channels. For pictures without alpha channels, the mask functionality will continue to work.

In macOS builds, you can read from Graphics.Pixel only for Graphics objects obtained from a Picture. Doing so from other Graphics objects will result in an UnsupportedOperationException. You can however assign a value to Graphics.Pixel for a Graphics object obtained from any object.

Sample code

This example assigns the color of a particular Pixel in a Canvas control to a variable.

Dim c As Color
c = Canvas1.Graphics.Pixel(10, 10)

This example sets a particular Pixel of a Canvas control to a specific Color.RGB value.

Canvas1.Graphics.Pixel(10, 10) =Color.RGB(100, 105, 225)

Compatibility

All project types on all supported operating systems.

See also

Graphics parent class; RGBSurface class.