1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22:
| procedure schneide_bloecke_aus_level_block(AParent:TWinControl;Const Name:String;theBounds:Trect;Source:Timage;SourceRect:Trect); var Img:TImage; paintrect: Trect; begin paintrect := rect(0,0,theBounds.Right - theBounds.Left,theBounds.Bottom - theBounds.top); img := Timage.Create(AParent); with img do begin Parent := AParent; Name := 'test'; boundsrect := theBounds; Canvas.FillRect(paintrect); end;
img.Picture.Bitmap.Canvas.CopyRect(Paintrect,Source.Picture.Bitmap.Canvas , SourceRect); end;
procedure TForm1.Button1Click(Sender: TObject); begin schneide_bloecke_aus_level_block(Form1,'test',Rect(500,500,575,575),Image1,Rect(0,0,75,75)); end |