TImage32.RotateRect

procedure RotateRect(const rec: TRect; angleRads: single; eraseColor: TColor32 = clNone32);


Rotates part of an image, but also clips those parts of the rotated image that fall outside rec. The 'eraseColor' parameter indicates the color to back fill the rotated corners.

Example

  uses Image32, Image32_PNG;
  ...
  var
    img: TImage32;
    rec: TRect;
  begin
    img := TImage32.Create;
    img.LoadFromFile('fruit.png');
    rec := img.Bounds;
    Windows.InflateRect(rec, -20,-20);
    img.RotateRect(rec, angle45);
    img.SaveToFile('fruit_rotrect45.png');
    img.Free;
  end;
      
Before:
After: