GraphicsPath::Outline method

The GraphicsPath::Outline method transforms and flattens this path, and then converts this path's data points so that they represent only the outline of the path.


Status Outline(
  IN const Matrix *matrix,
  IN REAL         flatness



Type: const Matrix*

Optional. Pointer to a Matrix object that specifies the transformation. If this parameter is NULL, no transformation is applied. The default value is NULL.


Type: REAL

Optional. Real number that specifies the maximum error between the path and its flattened approximation. Reducing the flatness increases the number of line segments in the approximation. The default value is FlatnessDefault, which is a constant defined in Gdiplusenums.h.

Return Value

Type: Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.


A GraphicsPath object stores a collection of data points that represent lines and curves. The GraphicsPath::Outline method changes those data points, and the original data points are lost.


The following example creates a GraphicsPath object and calls the GraphicsPath::AddClosedCurve method to add a closed cardinal spline to the path. The code calls the GraphicsPath::Widen method to widen the path and then draws the path. Next, the code calls the path's Outline method. The code calls the TranslateTransform method of a Graphics object so that the outlined path drawn by the subsequent call to DrawPath sits to the right of the first path.

VOID OutlineExample(HDC hdc)
   Graphics graphics(hdc);

   Pen bluePen(Color(255, 0, 0, 255));
   Pen greenPen(Color(255, 0, 255,  0), 10);

   PointF points[] = {
      PointF(20.0f, 20.0f),
      PointF(160.0f, 100.0f),
      PointF(140.0f, 60.0f),
      PointF(60.0f, 100.0f)};

   GraphicsPath path;
   path.AddClosedCurve(points, 4);

   graphics.DrawPath(&bluePen, &path);


   graphics.TranslateTransform(180.0f, 0.0f);
   graphics.DrawPath(&bluePen, &path);


Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdipluspath.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See Also

Clipping with a Region

Constructing and Drawing Paths

Creating a Path Gradient