c++delphiC++转delphi
哪位能帮我把下面这段代码转为delphi代码?procedure TForm1.Button1Click(Sender: TObject);
var
Graphics: TGPGraphics;
tmppen1, tmppen2, tmppen3: TGPPen;
tmpbrush: TGPSolidBrush;
tmpfontFamily: TGPFontFamily;
tmpfont: TGPFont;
tmppath, subpath: TGPGraphicsPath;
iterator: TGPGraphicsPathIterator;
str: string;
fsize: integer;
X: integer;
Y: integer;
spx: integer;
spy: integer;
dx: integer;
dy: integer;
i, count: integer;
aunit: TUnit;
tmprect: TGPRect;
isClosed: BOOL;
pointf: TGPPointF;
begin
str := '我';
fsize := 32;
X := 0;
Y := 0;
spx := 5;
spy := 5;
dx := 0;
dy := 0;
Graphics := TGPGraphics.Create(Canvas.Handle);
tmppen1 := TGPPen.Create(MakeColor(255, 0, 0));
tmppen2 := TGPPen.Create(MakeColor(0, 255, 0));
tmppen3 := TGPPen.Create(MakeColor(0, 0, 255));
tmpbrush := TGPSolidBrush.Create(MakeColor(0, 255, 0));
// 幼圆 楷体_GB2312
tmpfontFamily := TGPFontFamily.Create('仿宋_GB2312');
tmpfont := TGPFont.Create(&tmpfontFamily, fsize, FontStyleRegular);
aunit := tmpfont.GetUnit();
Graphics.SetPageUnit(aunit);
Graphics.SetSmoothingMode(SmoothingModeHighQuality);
pointf.X := X;
pointf.Y := Y;
tmppath.AddString(str, -1, tmpfontFamily, FontStyleRegular, fsize, pointf, nil);
// delete[] strSrc;
iterator := TGPGraphicsPathIterator.Create(tmppath);
tmppath.GetBounds(tmprect);
dx := tmprect.Width + spx;
count := iterator.GetSubpathCount();
isClosed := FALSE;
for i := 0 to count - 1 do
begin
if (((i div 10) = 0) and (i <> 0)) then
begin
Graphics.ResetTransform();
Graphics.TranslateTransform(0, (tmprect.Height + spy) * i / 10);
end;
Graphics.DrawPath(&tmppen1, &tmppath);
iterator.NextSubpath(subpath, isClosed);
Graphics.FillPath(&tmpbrush, &subpath);
Graphics.TranslateTransform(dx, dy);
end;
tmppen1.free;
tmppen2.free;
tmppen3.free;
Graphics.free;
end;