Da das Drehen auf Bitmapebene passiert, müssen die Daten erstmal umgewandelt werden:
Delphi-Quellcode:
function Graphic2Bmp(AGraphic : TGraphic) : TBitmap;
begin
result := TBitmap.Create;
result.PixelFormat := pf24bit;
result.Height := AGraphic.Height;
result.Width := AGraphic.Width;
result.Canvas.Draw(0, 0, AGraphic);
end;
Delphi-Quellcode:
procedure TForm1.Button2Click(Sender: TObject);
begin
If not image1.Picture.Graphic.Empty then
image1.Picture.bitmap := Graphic2Bmp(image1.Picture.Graphic);
image1.Picture.bitmap.PixelFormat := pf24bit;
Drehen90Grad(image1.picture.bitmap);
end;