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

TCustomImageList.AddSlice

Adds a portion of an image to each of the resolutions in the image list.

Declaration

Source position: imglist.pp line 346

public function TCustomImageList.AddSlice(

  Image: TCustomBitmap;

  AImageRect: TRect

):Integer;

Arguments

Image

  

Image added in the method.

AImageRect

  

Area from the source image added in the method.

Function result

Ordinal position where the new image was stored in each of the image resolutions.

Description

AddSlice is an Integer function used to add a portion of an image to each of the resolutions in the image list.

Image is a TCustomBitmap instance which contains the image added in the method. Image can contain a single image, or multiple combined images like the format returned from GetFullBitmap. No actions are performed in the method when Image has not been assigned (contains Nil), and the return value is set to -1.

AImageRect is a TRect type that specifies the area in Image added to the resolutions in the image list. When Image contains a single image, the image rectangle should match the dimensions for the entire image. When Image consists of multiple images, the image rectangle defines the portion (or slice) added to the image list.

The Count property is used as the position where the new image is stored in each of the image resolutions. It is also used as the return value for the method.

AddSlice calls CreateDefaultResolution to ensure that the default resolution for the image list exists before images are added in the method. AddSlice visits each of the image resolutions in the image list. The Width and Height properties in the image resolution are used to resize the image rectangle using the ScaleImage method. The InternalInsert method in the image resolution is called to store the scaled 32-bit RGBA raw image data to the position in the return value.

Use AddSliced to add multiple images to the image list from an image stored as adjacent images in row and column format.

AddSlice is used in the implementation of the AddSliceCentered method.

See also

TCustomImageList.Count

  

Number of images stored in the default resolution for the image list.

TCustomImageList.ScaleImage

  

Scales an image and its optional mask to the specified target size.

TCustomImageList.AddSliceCentered

  

Adds an image centered in the height and width for the image resolutions.

TCustomImageListResolution.Height

  

Height of the images stored in the resolution.

TCustomImageListResolution.Width

  

Width of the images stored in the resolution.

TCustomImageListResolutions

  

Provides multiple image resolutions in TCustomImageList.

TRGBAQuadArray


Version 3.2 Generated 2024-02-25 Home