TCustomImageList.ScaleImage procedure
Scales an image and its optional mask to the specified target size.
Declaration
class procedure ScaleImage(const ABitmap: TCustomBitmap;
const AMask: TCustomBitmap;
TargetWidth: Integer; TargetHeight: Integer;
var AData: TRGBAQuadArray)
class procedure ScaleImage(const ABitmap: TCustomBitmap;
const AMask: TCustomBitmap;
SourceRect: TRect; TargetWidth: Integer;
TargetHeight: Integer;
var AData: TRGBAQuadArray)
class procedure ScaleImage(const ABitmap: HBITMAP;
const AMask: HBITMAP; SourceRect: TRect;
TargetWidth: Integer; TargetHeight: Integer;
var AData: TRGBAQuadArray)Arguments
ABitmap | Bitmap with the image scaled in the method. |
AMask | Optional mask that defines the transparent areas of the image. |
TargetWidth | Target width for the scaled image. |
TargetHeight | Target Height for the scaled image. |
AData | 32-bit RGBA raw image data for the scaled image. |
SourceRect | Defines the area in the original image scaled in the method. |
Description
ScaleImage is an overloaded class procedure used to scale an image
and its optional mask to the specified target size.
ABitmap is the
TCustomBitmap with the original image
scaled in the method.
AMask is the optional mask that defines the transparent areas in
ABitmap. When AMask is a valid TCustomBitmap instance, the handle to its
bitmap is used in the scaling operation. When AMask has not been assigned
(contains
Nil), the handle to the mask in ABitmap is used for the
transparent areas in the image.
TargetWidth and
TargetHeight contain the size requested
for the scaled image.
AData is a variable
TRGBAQuadArray parameter where the
32-bit RGBA raw image data for the scaled image is stored.
An overloaded variant of the method provides the SourceRect
parameter which defines the area in ABitmap that is scaled in the method.
ScaleImage sets the size of AData to the number of bytes needed for the target image size (TargetHeight * TargetWidth * 32).
ScaleImage tries to load a bitmap that uses the image and mask specified in
ABitmap and AMask. If they cannot be combined and loaded, no additional
actions are performed in method. If they are loaded successfully, their pixel
data is examined and used to set the alpha channel and transparency for each
pixel. The adjusted image is rendered for the target image size using
TFPImageCanvas. The pixel data for the rendered image is stored in
AData using the RGBA attributes for the scaled image.
ScaleImage is used in the implementation of several methods, including:
- TCustomImageList.AddMultipleResolutions
- TCustomImageList.AddSlice
- TCustomImageList.AddSliced
- TCustomImageList.Insert
- TCustomImageList.InsertIcon
- TCustomImageList.InsertMasked
- TCustomImageList.Replace
- TCustomImageList.ReplaceIcon
- TCustomImageList.ReplaceMasked
- TCustomImageListResolution.Add
- TCustomImageListResolution.AddImages
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
