GraphicsPath.IsVisible(REAL, REAL, const Graphics*) method

Applies to: desktop apps only

The GraphicsPath::IsVisible method determines whether a specified point lies in the area that is filled when this path is filled by a specified Graphics object.

Syntax

BOOL IsVisible(
  [in]  REAL x,
  [in]  REAL y,
  [in]  const Graphics *g
);

Parameters

  • x [in]
    Type: REAL

    Real number that specifies the x-coordinate of the point to be tested.

  • y [in]
    Type: REAL

    Real number that specifies the y-coordinate of the point to be tested.

  • g [in]
    Type: const Graphics*

    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

Type:

Type: BOOL

If the test point lies in the interior of this path, this method returns TRUE; otherwise, it returns FALSE.

Examples

The following example creates an elliptical path and draws that path with a narrow black pen. Then the code tests each point in an array to see whether the point lies in the interior of the path. Points that lie in the interior are painted green, and points that do not lie in the interior are painted red.

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

   INT j;
   Pen blackPen(Color(255, 0, 0, 0), 1);
   SolidBrush brush(Color(255, 255, 0, 0));

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

   // Create an array of four 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(50, 100),
      PointF(250, 100),
      PointF(150, 170),
      PointF(180, 60)};

   for(j = 0; j <= 3; ++j)
   {
      if(path.IsVisible(points[j].X, points[j].Y, &graphics))
         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);
   }
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdipluspath.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

GraphicsPath

Graphics

IsOutlineVisible Methods

IsVisible Methods

PointF

Clipping with a Region

Constructing and Drawing Paths

Creating a Path Gradient

Paths

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012