ScaleImg procedure
Scales the specified bitmap image to the required dimensions.
Declaration
procedure ScaleImg(AImage: TCustomBitmap; AWidth: Integer;
AHeight: Integer)Arguments
AImage | Bitmap image resized in the routine. |
AWidth | New width requested for the image. |
AHeight | New height requested for the image. |
Description
ScaleImg is a procedure used to scale the bitmap in
AImage to the dimensions in
AWidth and
AHeight.
No actions are performed in the routine if AImage already has the dimensions specified in AWidth and AHeight.
ScaleImg uses the CreateIntfImage method in the bitmap image to create TLazIntfImage instances for both the original source image and a destination image. The destination image is configured with the new width and height. A TLazCanvas instance is created for the scaled image and its StretchDraw method is used to resize and draw the original image on the Canvas.
The Canvas is configured to use interpolation when both the width and height for the scaled image are larger than the values in the original image. Pixels generated / inserted into the destination image are an estimate of the surrounding pixel values from the original image.
AImage is updated with the resized image content prior to exiting from the routine.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
