I am trying to draw a polygon using GDI. This code works:
type
TPolygon: Array[0..2] of TPoint;
var
ACanvas: TGPGraphics;
MyBrush: TGPLinearGradientBrush;
...
procedure DrawPolygon;
var
Polygon: TPolygon;
begin
Polygon[0].X := 1;
Polygon[0].Y := 5;
Polygon[1].X := 10;
Polygon[1].Y := 15;
Polygon[2].X := 1;
Polygon[2].Y := 5;
ACanvas.FillPolygon(MyBrush, PGPPoint(@Polygon), length(Polygon));
end;
...
This code produces a GDI Value Overflow error:
type
TPolygon: Array of TPoint;
var
ACanvas: TGPGraphics;
MyBrush: TGPLinearGradientBrush;
...
procedure DrawPolygon;
var
Polygon: TPolygon;
begin
SetLength(Polygon, 3);
Polygon[0].X := 1;
Polygon[0].Y := 5;
Polygon[1].X := 10;
Polygon[1].Y := 15;
Polygon[2].X := 1;
Polygon[2].Y := 5;
ACanvas.FillPolygon(MyBrush, PGPPoint(@Polygon), length(Polygon));
end;
...
The only difference is that one point array is dynamic, the other is static. Obviously the underlying memory values are different, but in what way?