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

# TCustomImageList.InsertMasked

Inserts a transparent image into the image resolutions at the specified position.

## Declaration

Source position: imglist.pp line 383

`public procedure TCustomImageList.InsertMasked(`
`Index: Integer;`
`AImage: TCustomBitmap;`
`MaskColor: TColor`
`);`

## Arguments

`Index` |  | The index for the inserted image.
`AImage` |  | The bitmap to be inserted.
`MaskColor` |  | The color used transparent areas in the image.

## Description

InsertMasked is a procedure used to insert a transparent image into each of the resolutions for the image list.

Index contains the position in the image list where the transparent image is stored in each of the image resolutions.

AImage is a TCustomBitmap instance which contains the image inserted into the image list. No actions are performed in the method when AImage has not been assigned (contains Nil).

MaskColor is a TColor value which represents the transparent pixels in the image. Every pixel using the color in MaskColor is converted into a transparent pixel. InsertMasked creates a temporary TBitmap instance that is used to set the TransparentColor, TransparentMode, and Transparent properties in the image.

InsertMasked calls the CreateDefaultResolution method to ensure that the default resolution exists before inserting the image into the image list. The Resolutions enumerator is used to update each of the TCustomImageListResolution instances in the image list. The ScaleImage method is called to resize both the original image and the temporary mask to the Width and Height needed for the image resolution. The InternalInsert method in the image resolution is called to store the scaled 32-bit RGBA raw image data for the masked image.

## See also

TCustomImageList.Resolutions |  | Provides access to the image resolutions (or sizes) used in the image lists.
TCustomImageList.ScaleImage |  | Scales an image and its optional mask to the specified target size.
TCustomImageListResolutions |  | Provides multiple image resolutions in TCustomImageList.
TCustomImageList.Insert |  | Inserts an image into each image resolution at the specified position.