Draw

Graphics32

TBitmap32.Draw

procedure Draw(DstX, DstY: Integer; Src: TBitmap32); overload;

procedure Draw(DstX, DstY: Integer; const SrcRect: TRect; Src: TBitmap32); overload;

procedure Draw(const DstRect, SrcRect: TRect; Src: TBitmap32); overload;

procedure Draw(const DstRect, SrcRect: TRect; hSrc: HDC); overload; // VCL version

procedure Draw(const DstRect, SrcRect: TRect; SrcPixmap: QPixmapH); overload; // CLX version

Description

Renders the image specified by Src/hSrc parameter (or part of it specified by SrcRect parameter) at the location given by the coordinates (DstX, DstY) or the DstRect rectangle.

The method provides both: block transfer (versions with DstX, DstY parameters) and stretching (versions with DstRect parameter).

When the source is another TBitmap32 object (Src parameter), the method uses Src.DrawMode do determine how it should be blended with the background, and if stretching, Src.StretchFilter specifies how the image should be stretched.

The version with hSrc parameter, is introduced mainly for compatibility reasons. You may use it to transfer data from bitmaps with other formats, or any other windows objects that have device handle (DC). It is based on StretchDIBits GDI call, it does not support transparency and always uses nearest neighbor interpolation when stretching.

The version that uses the SrcPixmap is only available in the CLX version of Graphics32. You may use it to transfer data directly from QPixmap instances such as TBitmap.

The Dst parameter must not be necessarily some other bitmap. In fact, it is possible to copy/stretch areas inside the same bitmap that calls the Draw method. However, in this case, if source and destination areas intersect, the result is not specified (this is a limitation of the current version).

See Also

BlockTransfer, DrawMode, DrawTo, StretchFilter, StretchTransfer, TBitmap32, TRect