IGPGraphicsPath.GetPathData
From Mitov Wiki Doc
This is a Beta Read Only version of this page. Please review and send recommendations to mitov@mitov.com. We will enable the editing as soon as we are happy with the overall Wiki site.
Description
Call this method to get an IGPPathData interface to object
containing an array of points and an array of point types from this path. Together, these two arrays define the lines, curves, figures, and markers of this path. Example: The following example creates and draws a path that has a line, a rectangle, an ellipse, and a curve. The code gets the path's points and types by passing the address of a PathData object to the GetPathData method. Then the code draws each of the path's data points.
var AGraphics : IGPGraphics; APath : IGPGraphicsPath; APathData : IGPPathData; ABrush : IGPPen; I : Integer; begin AGraphics := TGPGraphics.Create( ACanvas ); APath := TGLPath.Create();
APath.AddLine(20, 100, 150, 200);
APath.AddRectangle(MakeRect(40, 30, 80, 60));
APath.AddEllipse(MakeRect(200, 30, 200, 100));
APath.AddCurve([
MakePointF(200, 200), MakePointF(250, 240), MakePointF(200, 300), MakePointF(300, 310), MakePointF(250, 350) ]);
// Draw the path.
AGraphics.DrawPath( TGPPen.Create( aclBlue ), &path);
// Get the path data.
APathData := APath.GetPathData();
// Draw the path's data points.
ABrush := TGPSolidBrush.Create( aclRed );
for I := 0 to APathData.Count - 1 do
{
AGraphics.FillEllipse(
ABrush,
APathData.Points[ I ].X - 3.0,
APathData.Points[ I ].Y - 3.0,
6.0,
6.0);
}
end;
Remarks A IGPGraphicsPath object has an array of points and an array of types. Each element in the array of types is a byte that specifies the point type and a set of flags for the corresponding element in the array of points. Possible point types and flags are listed in the TGPPathPointType enumeration.