I am trying to paint a following polygon:
with this code:
procedure TForm1.Paint;
var
g: TGPGraphics;
pen: TGPPen;
i: Integer;
p: TGPGraphicsPath;
m: TGPMatrix;
br: TGpSolidBrush;
begin
inherited;
g := TGPGraphics.Create(Canvas.Handle);
pen := TGPPen.Create(MakeColor(141, 63, 0), 3);
p := TGPGraphicsPath.Create();
m := TGPMatrix.Create;
br := TGpSolidBrush.Create(MakeColor(244, 146, 32));
try
g.SetSmoothingMode(SmoothingModeHighQuality);
g.Clear(MakeColor(255, 255, 255));
g.TranslateTransform(ClientWidth div 2, ClientHeight div 2);
m.Rotate(45);
p.StartFigure;
for i := 0 to 7 do begin
p.AddLine(-14, -33, 0, -55); // To upper right
p.AddLine(0, -55, 14, -33); // To lower right
p.Transform(m); // Rotate by 45 degree
end;
p.CloseFigure;
g.DrawPath(pen, p);
finally
br.Free;
m.Free;
p.Free;
pen.Free;
g.Free;
end;
end;
but GDI+ closes every star ray path, and produces following painting:
What is wrong here?
P.S.: I have to use the AddLine method, each call with two coordinates, to paint two sides of a ray. Is there some method like LineTo, with only one pair of X and Y, that takes the last point as the beginning?
Or is there some method to transform a TGPPointF by rotating around some other point, without actually painting it?


The problem was solved by rotating in the other direction:
It seems that it paints the left side of a ray, then the right side, but when it rotates by positive number, it rotates counter clockwise, so the next ray will be on the left side of the previous one ... Strange.