Combine example for Delphi

This example copies the Lead1 bitmap to LeadTmp, trims and filters the copied image, and combines the filtered image with the original Lead1 bitmap. Trimming LeadTmp lets you see the difference between filtered and nonfiltered regions.

var
TrimLeft, TrimTop, TrimWidth, TrimHeight, DstLeft, DstTop, DstWidth, DstHeight, SrcLeft, SrcTop:Integer;
LeadTmp : TLeadImage; 
begin
Screen.Cursor := crHourglass;
LeadTmp := TLeadImage.Create(Self);
LeadTmp.Visible := false;
LeadTmp.Parent := Self;
LeadTmp.Bitmap := Lead1.Bitmap
TrimLeft := Round(LeadTmp.BitmapWidth * 0.2);
TrimTop := Round(LeadTmp.BitmapHeight * 0.2);
TrimWidth := Round(LeadTmp.BitmapWidth * 0.6);
TrimHeight := Round(LeadTmp.BitmapHeight * 0.6);
LeadTmp.Trim(TrimLeft, TrimTop, TrimWidth, TrimHeight);
LeadTmp.SpatialFilter(FLT_LINESEG_LTOR);
DstLeft := TrimLeft;
DstTop := TrimTop;
DstWidth := TrimWidth;
DstHeight := TrimHeight;
SrcLeft := 0;
SrcTop := 0;
Lead1.Combine(DstLeft, DstTop, DstWidth, DstHeight, LeadTmp.Bitmap, SrcLeft, SrcTop, CB_OP_ADD);
LeadTmp.Free;
Lead1.ForceRepaint;
Screen.Cursor := crDefault;
end;