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

# DrawOverlay

Draws an image with an overlay at the specified canvas position.

## Declaration

Source position: imglist.pp line 210

`procedure TScaledImageListResolution.DrawOverlay(`
`ACanvas: TCanvas;`
`AX: Integer;`
`AY: Integer;`
`AIndex: Integer;`
`AOverlay: TOverlay;`
`AEnabled: Boolean = True`
`); overload; procedure TScaledImageListResolution.DrawOverlay(`
`ACanvas: TCanvas;`
`AX: Integer;`
`AY: Integer;`
`AIndex: Integer;`
`AOverlay: TOverlay;`
`ADrawEffect: TGraphicsDrawEffect`
`); overload; procedure TScaledImageListResolution.DrawOverlay(`
`ACanvas: TCanvas;`
`AX: Integer;`
`AY: Integer;`
`AIndex: Integer;`
`AOverlay: TOverlay;`
`ADrawingStyle: TDrawingStyle;`
`AImageType: TImageType;`
`ADrawEffect: TGraphicsDrawEffect`
`); overload;`

## Arguments

`ACanvas` |  | Canvas where the image and overlay are drawn.
`AX` |  | Horizontal coordinate on the canvas where the image is drawn.
`AY` |  | Vertical coordinate on the canvas where the image is drawn.
`AIndex` |  | Ordinal position for the image drawn in the method.
`AOverlay` |  | Position for the overlay image applied in the method.
`AEnabled` |  | True when the image is drawn in the enabled state (default).

## Arguments

`ACanvas` |  | Canvas where the image and overlay are drawn.
`AX` |  | Horizontal coordinate on the canvas where the image is drawn.
`AY` |  | Vertical coordinate on the canvas where the image is drawn.
`AIndex` |  | Ordinal position for the image drawn in the method.
`AOverlay` |  | Position for the overlay image applied in the method.
`ADrawEffect` |  | TGraphicsDrawEffect value applied to the image.

## Arguments

`ACanvas` |  | Canvas where the image and overlay are drawn.
`AX` |  | Horizontal coordinate on the canvas where the image is drawn.
`AY` |  | Vertical coordinate on the canvas where the image is drawn.
`AIndex` |  | Ordinal position for the image drawn in the method.
`AOverlay` |  | Position for the overlay image applied in the method.
`ADrawingStyle` |  | TDrawingStyle value applied to the image.
`AImageType` |  | Indicates if the content is the image or a mask.
`ADrawEffect` |  | TGraphicsDrawEffect value applied to the image.

## Description

DrawOverlay is an overloaded method used to draw an image with an overlay at the given position on a canvas. The overloaded variants allow the enabled state, drawing effect, or drawing style for the image(s) to be specified.

DrawOverlay scales both the image and the overlay (when needed) using the internal scaling factor stored in the image Resolution.

Image scaling is not performed when the scaling factor is 1.0. In this case the Draw method in Resolution is called to draw the image. When a valid image index has been assigned in AOverlay, The Draw method is called to draw the overlay image.

When image scaling is needed, the StretchDraw method in Resolution is called to draw both the image and a valid overlay. The images are resized to the Width and Height for the image Resolution. StretchDraw uses the enabled state for the images when ADrawEffect contains any value other than gdeDisabled.

Use the Draw or StretchDraw methods when an overlay image is not needed.

## See also

TScaledImageListResolution.Height |  | Height of the images stored in the scaled image resolution.
TScaledImageListResolution.Width |  | Width of the images stored in the scaled image resolution.
TScaledImageListResolution.Resolution |  | Resolution used as the bases for scaled images.
TScaledImageListResolution.Draw |  | Draws the scaled image to the specified canvas.
TScaledImageListResolution.StretchDraw |  | Draws the scaled image sized to the target rectangle.
TCustomImageListResolution.Draw |  | Renders an image to the specified canvas.
TCustomImageListResolution.StretchDraw |  | Draws an image stretched to the dimensions for the target rectangle.
TCustomImageListResolution.DrawOverlay |  | Draws the specified image with the given overlay.