How to crop an FMX TBitmap
I receive a bitmap via TCameraComponent.SampleBufferReady event. Then I need to crop the received image so that I get a, for instance, recangular image. I calculate the necessary parameters in the following method: procedure TPersonalF.SampleBufferReady(Sender: TObject; const ATime: TMediaTime); var BMP: TBitmap; X, Y, W, H: Word; begin Try BMP := TBitmap.Create; CameraComponent.SampleBufferToBitmap(BMP, true); if BMP.Width >= BMP.Height then //landscape begin W:=BMP.Height; H:=W; Y:=0; X:=trunc((BMP.Width-BMP.Height)/2); end else //portrait begin W:=BMP.Width; H:=W; X:=0; Y:=trunc((BMP.Height