BlockTransfer

Graphics32

BlockTransfer

procedure BlockTransfer(
  Dst: TBitmap32;
  DstX: Integer;
  DstY: Integer;
  DstClip: TRect;
  Src: TBitmap32;
  SrcRect: TRect;
  CombineOp: TDrawMode;
  CombineCallBack: TPixelCombineEvent = nil);

Description

BlockTransfer is similar to the BitBlt function from Windows GDI. It performs copying of a bitmap fragment specified by SrcRect into location (DstX, DstY) with optional alpha blending or using user-specified combining function. This operation is constrained to the DstClip rectangle specified in the destination bitmap coordinates.

If CombineOp=dmOpaque, the fragment simply replaces destination pixels. In dmBlend mode it is blended to destination using its alpha channel and MasterAlpha property. In dmCusom mode, the function calls CombineCallBack function for pixel combining.

It is not required for DstRect and SrcRect to lie entirely inside the corresponding bitmap, since the function provides necessary clipping.

The result is not specified when transferring data inside the same bitmap (Src=Dst) and if in the same time SrcRect intersects with DstRect. In this case it is recommended to use a temporary bitmap buffer.

Neither Src nor Dst bitmaps may be equal to nil. In this case, function will generate an exception. They may be empty however, in this case no transformation will be performed.

This routine used in TBitmap32.Draw and TBitmap32.DrawTo methods.

See Also

TBitmap32.Draw, TBitmap32.DrawTo, TBitmap32.MasterAlpha, StretchTransfer, TBitmap32, TDrawMode, TPixelCombineEvent, TRect