GraphicsPath::Outline method (gdipluspath.h)

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.

Syntax

Status Outline(
  [in] const Matrix *matrix,
  [in] REAL         flatness
);

Parameters

[in] matrix

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.

[in] flatness

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: 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.

Remarks

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.

Examples

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);

   path.Widen(&greenPen);
   graphics.DrawPath(&bluePen, &path);

   path.Outline();

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

Requirements

Requirement Value
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

GraphicsPath

GraphicsPath::Flatten

GraphicsPath::Warp

GraphicsPath::Widen

Matrix

Paths