Mega Code Archive

 
Categories / Delphi / Graphic
 

How to stretch a bitmap

Title: How to stretch a bitmap function TForm1.ResizeBmp(bitmp: TBitmap; wid, hei: Integer): Boolean; var TmpBmp: TBitmap; ARect: TRect; begin Result := False; try TmpBmp := TBitmap.Create; try TmpBmp.Width := wid; TmpBmp.Height := hei; ARect := Rect(0,0, wid, hei); TmpBmp.Canvas.StretchDraw(ARect, Bitmp); bitmp.Assign(TmpBmp); finally TmpBmp.Free; end; Result := True; except Result := False; end; end;