[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Graphics' (#lcl)

# TCanvas.Pixels

The color of the Pixels located at the specified position.

## Declaration

Source position: graphics.pp line 1169

`public property TCanvas.Pixels[X: Integer,Y: Integer] : TColor read GetPixel write SetPixel;`

## Description

Pixels is an indexed TColor color property which provides access to the color for pixels on the drawing surface. The X and Y arguments provide the horizontal and vertical offsets on the drawing surface.

Read and write access to color values in the property requires a valid Handle (or device context) for the canvas. RequiredState is called, and allocates a Handle if one does not already exist. An EInvalidGraphicOperation exception may be raised in the method if a valid handle cannot be acquired.

Methods in the widgetset class are called to read or write the pixel color using the Handle.

When setting a new color for a pixel, the Changing method is called to signal the OnChanging event handler (when assigned). After setting the new color, the Changed method is called to signal the OnChange event handler (when assigned).

## See also

TCanvas.Handle |  | Handle (or device context) for the drawing surface.
TCanvas.RequiredState |  | Ensures that all handles needed for the canvas are valid.
TCanvas.Changing |  | Signals the OnChanging event handler (when assigned).
TCanvas.Changed |  | Signals the OnChange event handler (when assigned).
TCanvas.OnChanging |  | Event handler signalled prior to changing the canvas.
TCanvas.OnChange |  | Event handler signalled after a change to the canvas.
TColor |  | Color type used by most LCL drawing functions.
EInvalidGraphicOperation |  | EInvalidGraphicOperation - exception handler for invalid graphic operation.