TCustomImageList.AddSlice function
Adds a portion of an image to each of the resolutions in the image list.
Declaration
function AddSlice(Image: TCustomBitmap; AImageRect: TRect): IntegerArguments
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
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
