GraphicsPath::IsOutlineVisible method

The GraphicsPath::IsOutlineVisible method determines whether a specified point touches the outline of this path when the path is drawn by a specified Graphics object and a specified pen.

Syntax

BOOL IsOutlineVisible(
  IN const PointF & point,
  IN const Pen      *pen,
  IN const Graphics *g
);

Parameters

point

Reference to the point to be tested.

pen

Pointer to a Pen object. This method determines whether the test point touches the path outline that would be drawn by this pen. More points will touch an outline drawn by a wide pen than will touch an outline drawn by a narrow pen.

g

Optional. Pointer to a Graphics object that specifies a world-to-device transformation. If the value of this parameter is NULL, the test is done in world coordinates; otherwise, the test is done in device coordinates. The default value is NULL.

Return Value

If the test point touches the outline of this path, this method returns TRUE; otherwise, it returns FALSE.

Remarks

Examples

The following example creates an elliptical path and draws that path with a wide yellow pen. Then the code tests each point in an array to see whether the point touches the outline (as it would be drawn by the wide yellow pen) of the path. Points that touch the outline are painted green, and points that don't touch the outline are painted red.

VOID Example_IsOutlineVisibleExample(HDC hdc)
{
   Graphics graphics(hdc);

   INT j;
   Pen yellowPen(Color(255, 255, 255, 0), 20);
   SolidBrush brush(Color(255, 255, 0,  0));

   // Create and draw a path.
   GraphicsPath path;
   path.AddEllipse(50, 50, 200, 100);
   graphics.DrawPath(&yellowPen, &path);

   // Create an array of three points, and determine whether each
   // point in the array touches the outline of the path.
   // If a point touches the outline, paint it green.
   // If a point does not touch the outline, paint it red.
   PointF[] = {
      PointF(230, 138),
      PointF(100, 120),
      PointF(150, 170)};

   for(j = 0; j <= 2; ++j)
   {
      if(path.IsOutlineVisible(points[j], &yellowPen, NULL))
         brush.SetColor(Color(255, 0, 255,  0));
      else
         brush.SetColor(Color(255, 255, 0,  0));

      graphics.FillEllipse(&brush, points[j].X - 3.0f, points[j].Y - 3.0f, 6.0f, 6.0f);
   }
}

Color(255, 255, 0,  0)Color(255, 255, 0,  0)

Requirements

   
Header gdipluspath.h

See Also

Clipping with a Region

Constructing and Drawing Paths

Creating a Path Gradient

Graphics

GraphicsPath

IsOutlineVisible Methods

IsVisible Methods

Paths

Pen

Pens, Lines, and Rectangles

PointF

Setting Pen Width and Alignment