TCustomBitmap.SetSize procedure
Sets the Height and Width for the image to the specified values.
Declaration
procedure SetSize(AWidth: Integer; AHeight: Integer); overrideArguments
AWidth | New width for the image. |
AHeight | New height for the image. |
Description
SetSize is an overridden method in
TCustomBitmap used
to change the
Height and
Width for the bitmap image to
the specified values. SetSize implements the abstract virtual method defined
in the ancestor class.
Calls RawImageNeeded to ensure that the image header in RawImage is valid for the image.
The values in AWidth and AHeight contain the new dimensions for the image. Both values must contain a positive value or 0. The default value for an argument is set to 0 when a negative value is found. Their values are assigned to the image desriptor in the shared imaged to change the size for the image content. No additional actions are performed in the method if either value is not successfully applied to the raw image descriptor.
Calls UnshareImage and RawImageNeeded to re-create the raw image data for the shared image.
Copies existing pixel data for the image into the resized image. When the new image size is smaller, only the portion of the image that fits within the new dimensions is copied. Uses the CopyPixels method in the TLazIntfImage instance to copy the image content.
Ensures that the Canvas context, BitMapHandle, and MaskHandle are updated for the image. Calls the Changed method to update the shared image data and signal the OnChange event handler (when assigned).
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
