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

TCustomImageList.ScaleImage

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

Declaration

Source position: imglist.pp line 324

public class procedure TCustomImageList.ScaleImage(

  const ABitmap: TCustomBitmap;

  const AMask: TCustomBitmap;

  TargetWidth: Integer;

  TargetHeight: Integer;

  var AData: TRGBAQuadArray

);

class procedure TCustomImageList.ScaleImage(

  const ABitmap: TCustomBitmap;

  const AMask: TCustomBitmap;

  SourceRect: TRect;

  TargetWidth: Integer;

  TargetHeight: Integer;

  var AData: TRGBAQuadArray

);

class procedure TCustomImageList.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.

Arguments

ABitmap

  

Bitmap with the image scaled in the method.

AMask

  

Optional mask that defines the transparent areas of the image.

SourceRect

  

Defines the area in the original image scaled in the method.

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.

Arguments

ABitmap

  

Bitmap with the image scaled in the method.

AMask

  

Optional mask that defines the transparent areas of the image.

SourceRect

  

Defines the area in the original image scaled in the method.

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.

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:

See also

TCustomImageList.AddMultipleResolutions

  

Adds images with varying sizes to the corresponding image resolution.

TCustomImageList.AddSlice

  

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

TCustomImageList.AddSliced

  

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

TCustomImageList.Insert

  

Inserts an image into each image resolution at the specified position.

TCustomImageList.InsertIcon

  

Inserts an Icon into each of the resolutions for the image list.

TCustomImageList.InsertMasked

  

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

TCustomImageList.Replace

  

Replaces an image at the specified position with the given bitmap.

TCustomImageList.ReplaceIcon

  

Replaces the icon at the specified position in all resolutions for the image list.

TCustomImageList.ReplaceMasked

  

Replaces the image at the specified position with a masked image.

TRGBAQuadArray


Version 3.2 Generated 2024-02-25 Home