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

# TCustomImageList.AddSliced

Adds images to the image list from image data stored as adjacent columns and rows.

## Declaration

Source position: imglist.pp line 345

`public function TCustomImageList.AddSliced(`
`Image: TCustomBitmap;`
`AHorizontalCount: Integer;`
`AVerticalCount: Integer`
`):Integer;`

## Arguments

`Image` |  | Image data stored as a row(s) and columns(s) of adjacent images.
`AHorizontalCount` |  | Number of adjacent horizontal images (columns).
`AVerticalCount` |  | Number of adjacent vertical images (rows).

## Function result

Ordinal position where the first image was stored in the image list.

## Description

AddSliced is an Integer function used to add one or more images from image data stored as adjacent images in grid format.

Image is a TCustomBitmap descendant that contains the image data used for the operation. No actions are performed in the method when Image has not been assigned (contains Nil). The return value is set to -1 when Image has not been assigned.

AHorizontalCount is an Integer value that indicates the number of adjacent images stored in Image on the horizontal plane (in a row). The Width of the Image must (should?) be a multiple of the value in AHorizontalCount.

AVerticalCount is an Integer value that indicates the number of adjacent images stored in Image on the vertical plane (in a column). The Height of the Image must (should?) be a multiple of the value in AVerticalCount.

The return value contains the ordinal position in the image list where the first image is stored in the method. It contains the value in the Count property prior to adding any images to the list.

AddSliced calls the CreateDefaultResolution method to ensure that the default resolution exists in the image list prior to adding images in the method.

AddSliced uses the values in AVerticalCount and AHorizontalCount to process the partial images stored in Image. Each image portion (or slice) is added to all of the resolutions available in the image list. The image slice is resized to the height and width required for an image resolution by calling ScaleImage for the current image rectangle. The image resolution calls its InternalInsert method to store the scaled 32-bit RGBA raw image data for the partial image. The process is repeated until all partial images defined by AVerticalCount and AHorizontalCount have been added to the image resolutions.

## See also

TCustomImageList.Count |  | Number of images stored in the default resolution for the image list.
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.
TRGBAQuadArray