Mega Code Archive

 
Categories / Delphi / Graphic
 

Stretch a bitmap

Title: stretch a bitmap? // This function stretches a bitmap with specified number of pixels // in horizontal, vertical dimension // Example Call : ResizeBmp(Image1.Picture.Bitmap , 200 , 200); // Diese Funktion zerrt eine Bitmap in die anzugebenden Pixel // Beispielaufruf : ResizeBmp(Image1.Picture.Bitmap , 200 , 200); 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;