size : 673
uploaded_on : Tue Aug 24 00:00:00 1999
modified_on : Wed Dec 8 14:02:53 1999
title : Copy bitmap area
org_filename : CopyBMPArea.txt
author : Jeevan James
authoremail : jeevanjj@bigfoot.com
description : How to copy an area of a bitmap into another bitmap
keywords :
tested : not tested yet
submitted_by : The CKB Crew
submitted_by_email : ckb@netalive.org
uploaded_by : nobody
modified_by : nobody
owner : nobody
lang : plain
file-type : text/plain
category : delphi-graphics
__END_OF_HEADER__
{ This function creates a new bitmap object with the selected area copied
into it.
If it returns nil, then there was an error creating the bitmap. If it
doesn't return nil, then you have to manually free it later once you're
finished with it.
}
function CopyBmpArea (Bmp : TBitmap; Top, Left, Width, Height : Integer) :TBitmap;
begin
Result := TBitmap.Create;
try
Result.Width := Width;
Result.Height := Height;
Result.Canvas.CopyRect (Rect (0, 0, Width, Height),
Bmp.Canvas,
Rect (Top, Left, Top + Width, Left + Height));
except
Result.Free;
Result := nil;
finally
end;
end;