Procedure Flip1Click(Sender: TObject);
Var DummyImage : TImage; X,Y : Integer; SrcRect,DstRect : TRect;
Begin //Assumes that Image1 holds the picture to be flipped X := Image1.Picture.Width; Y := Image1.Picture.Height; SrcRect := Rect(0,0,X,Y); DstRect := Rect(X,0,0,Y); //This is the trick! DummyImage := TImage.Create(Self); DummyImage.Width := X; DummyImage.Height := Y; //DummyImage.Canvas.CopyMode := cmSrcCopy DummyImage.Canvas.CopyRect(DstRect,Image1.Canvas,SrcRect); //Flipping the image Image1.Picture := DummyImage.Picture; //Copy the flipped image to Image1 DummyImage.Free; end;
|