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

# TCanvas.Draw

Draws the image content in SrcGraphic on the canvas at the specified position.

## Declaration

Source position: graphics.pp line 1113

`public procedure TCanvas.Draw(`
`X: Integer;`
`Y: Integer;`
`SrcGraphic: TGraphic`
`); virtual;`

## Arguments

`X` |  | Horizontal coordinate where the content is drawn.
`Y` |  | Vertical coordinate where the content is drawn.
`SrcGraphic` |  | TGraphic instance with the image content drawn in the method.

## Description

Draw is reintroduced method in TCanvas; it reimplements the inherited method to use the TGraphic instance in SrcGraphic as the container with the image content drawn in the method.

No actions are performed in the method if SrcGraphic has not been assigned.

Draw calls the StretchDraw method to render the content in SrcGraphic on the canvas at the position specified in X and Y. The Width and Height in SrcGraphic set the bounds for the image rectangle applied to the canvas using StretchDraw. Since a stretch mode is not enabled when StretchDraw is called, the source graphic is not enlarged or shrunk to the canvas size. The source graphic is clipped if its bounds exceeds the canvas bounds. The Draw method in SrcGraphic performs the actions needed to position and rendering the content to the Pixels in the canvas.

CopyMode determines the raster operation performed for the Pixels affected on the canvas.

Calling Draw causes the OnChanging and OnChange events to be signalled (when assigned). OnChanging occurs prior to calling Draw in the TGraphic instance. OnChange occurs after calling Draw in the TGraphic instance.

## See also

TCanvas.StretchDraw |  | Expands or contracts the specific graphic content to fit the specified destination rectangle on the canvas.
TCanvas.CopyMode |  | Indicates the raster operation used to combine pixel colors on the drawing surface.
TCanvas.OnChange |  | Event handler signalled after a change to the canvas.
TCanvas.OnChanging |  | Event handler signalled prior to changing the canvas.
TGraphic.Width |  | Width - The native, unstretched, width of the graphic.
TGraphic.Height |  | The native, unstretched height for the graphic.
TGraphic.Draw |  | Method used to draw the Graphic on the specified Canvas, in the specified Rectangle.
TRect