MatrixApply

procedure MatrixApply(const matrix: TMatrixD; var pt: TPointD); overload;

procedure MatrixApply(const matrix: TMatrixD; var path: TPathD); overload;

procedure MatrixApply(const matrix: TMatrixD; var paths: TPathsD); overload;


Applies a matrix transformation either to a single coordinate, or to a series of path coordinates.

uses Image32, Image32_PNG, Image32_Vector;
...
var
  img: TImage32;
  m: TMatrixD;
begin
  img := TImage32.Create;
  img.SetSize(256,256);

  //draw buttons at the corners of a square inset 50px from the image's edges.
  pts := Rectangle(50, 50, 206, 206);
  for i := 0 to high(pts) do
    DrawButton(img, pts[i], DpiAware(20), $FF00AA00, [boDropShadow]);

  //create a matrix that rotates 15 degrees about the point [128,128] and
  //draw shrinking buttons while rotating these a total of 4 * 15 degrees
  m := IdentityMatrix;
  MatrixRotate(m, PointD(128,128), pi/12);
  for i := 1 to 4 do
  begin
    MatrixApply(m, pts);
    for j := 0 to high(pts) do
      DrawButton(img, pts[j], DpiAware(14 - i), $CC00CC00, [boDropShadow]);
  end;
    
  img.SaveToFile('Rotate4Buttons.png');
  img.Free;
end;