Sign in Join
FPDoc Onlineexperiment

BitBlt function

In unit LCLIntf

Copies a section of a Canvas to another one, performing a raster operation (ROP).

Declaration

pascal
function BitBlt(DestDC: HDC; X: Integer; Y: Integer; Width: Integer; 
 Height: Integer; SrcDC: HDC; XSrc: Integer; 
 YSrc: Integer; Rop: DWORD): Boolean

Description

This routine implements the equivalent Windows GDI API of the same name in all platforms supported by Lazarus. It copies a section of a Canvas to another one, without any stretching. It allows one to select the kind of operation which should be performed to draw the pixels into the destination in the parameter ROP. Allowed operations go from simply copying the pixels without change to inverting them and also to executing logical operations involving the source pixels and the previously existing pixels in the destination Canvas.

For normal usage one should only use SRCOPY in the ROP parameter, other operations may not be supported by all widgetsets.

There exist 16 raster operations, according to the possible combinations of two (boolean) values. Excluding the NOP case, that doesn't modify the target area, the possible values for ROP are:

BLACKNESS
Fills the destination rectangle with black
DSTINVERT
Inverts the colors of the destination area
MERGECOPY
Fills the destination area with (Src and Pattern)
MERGEPAINT
Fills the destination area with (Dst or not Src)
NOTSRCCOPY
Fills the destination area with (not Src)
NOTSRCERASE
Fills the destination area with (not (Dst or Src))
PATCOPY
Fills the destination area with (Pattern)
PATINVERT
Fills the destination area with (Dst xor Pattern)
PATPAINT
Fills the destination area with (Dst or (not Src) or Pattern)
SRCAND
Fills the destination area with (Dst and Src)
SRCCOPY
Fills the destination area with Src
SRCERASE
Fills the destination area with ((not Dst) and Src)
SRCINVERT
Fills the destination area with (Dst xor Src)
SRCPAINT
Combines the colors of the source and the destination using the operator OR on each pixel
WHITENESS
Fills the destination rectangle with white

These flags can be added to above ROPs:

CAPTUREBLT
Includes windows which are on top of the specified Canvas. This option is not recommended and is very hard to implement in all supported platforms.
NOMIRRORBITMAP
Prevents the bitmap from being mirrored.

See also

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.