//比例變化
var
g: TGPGraphics;
p: TGPPen;
rect: TGPRect;
begin
g := TGPGraphics.Create(Canvas.Handle);
p := TGPPen.Create(MakeColor(255,255,0,0),0);
rect := MakeRect(10,10,100,100);
g.DrawRectangle(p, rect); {原始}
g.ScaleTransform(2, 0.5); {橫向放大、縱向縮小}
p.SetColor(aclBlue); {變個顏色看清楚}
g.DrawRectangle(p, rect); {重繪}
g.ResetTransform; {恢復變化, 不然下一個變化將基於現在的狀態}
p.Free;
g.Free;
end;
//角度變化(旋轉)
var
g: TGPGraphics;
p: TGPPen;
rect: TGPRect;
begin
g := TGPGraphics.Create(Canvas.Handle);
p := TGPPen.Create(MakeColor(255,255,0,0),0);
rect := MakeRect(10,10,100,100);
g.DrawRectangle(p, rect);
g.RotateTransform(28); {旋轉28度角, 正值順時針、負值逆時針}
p.SetColor(aclBlue);
g.DrawRectangle(p, rect);
g.ResetTransform;
p.Free;
g.Free;
end;
//位置變化(移動)
var
g: TGPGraphics;
p: TGPPen;
rect: TGPRect;
begin
g := TGPGraphics.Create(Canvas.Handle);
p := TGPPen.Create(MakeColor(255,255,0,0),0);
rect := MakeRect(10,10,100,100);
g.DrawRectangle(p, rect);
g.TranslateTransform(111,111); {移動}
p.SetColor(aclBlue);
g.DrawRectangle(p, rect);
g.ResetTransform;
p.Free;
g.Free;
end;