[Overview][Types][Procedures and functions][Variables][Index] | Reference for unit 'LCLIntf' (#lcl)

# BitBlt

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

## Declaration

Source position: winapih.inc line 39

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

## Arguments

`DestDC` |  | The destination Device Context.
`X` |  | The origin in the destination DC.
`Y` |  | The origin in the destination DC.
`Width` |  | The image size.
`Height` |  | The image size.
`SrcDC` |  | The source Device Context.
`XSrc` |  | The origin in the source DC.
`YSrc` |  | The origin in the source DC.
`Rop` |  | The raster operation.

## Function result

False on failure.

## 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

BLACKNESS |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with all black.
DSTINVERT |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with (not Dst).
MERGECOPY |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with (Src and Pattern).
MERGEPAINT |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with (Dst or not Src).
NOTSRCCOPY |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with (not Src).
NOTSRCERASE |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with (not (Dst or Src)).
PATINVERT |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with (Dst xor Pattern).
PATPAINT |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with (Dst or (not Src) or Pattern).
SRCAND |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with (Dst and Src).
SRCCOPY |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with Src.
SRCERASE |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with ((not Dst) and Src).
SRCINVERT |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with (Dst xor Src).
SRCPAINT |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with (Dst or Src).
WHITENESS |  | Ternary raster operation (Dst op Src op Pattern): Fills the destination area with all white.