Path



public ref class Path
{
public:

Handle pathHandle;

Path(Path^ Copy)
{
 pathHandle = GdiPlus::ClonePath(Copy->pathHandle);
}

static Path^ operator*(Transform^ transform,
                       Path^ path)
{
 Path^ PathOut = gcnew Path(path);
 PathOut->Transform(gcnew Matrix(transform));
 return PathOut;
}


Path()
{
	pathHandle = GdiPlus::CreatePath(IPlusPlus::Drawing::FillMode::Alternate);
}


Path(IPlusPlus::Drawing::FillMode fillMode)
{
 pathHandle = GdiPlus::CreatePath(fillMode);
}

Path(Array<PointF>^ points,
     Array<Byte>^ types,
     FillMode fillMode)
{
 pathHandle =  GdiPlus::CreatePath(points,
                                    types,
                                    fillMode);
}

Path(Array<Point>^ points,
     Array<Byte>^ types,
     FillMode fillMode)
{
 pathHandle =  GdiPlus::CreatePath(points,
                                    types,
                                    fillMode);
}

Path(Handle pathHandleSet)
{
 pathHandle = pathHandleSet;
}

~Path()  { GdiPlus::DeletePath(pathHandle); }

static operator Handle(Path^ pathToConvert) {return pathToConvert->pathHandle;}

void Reset() { GdiPlus::ResetPath(pathHandle); }

property IPlusPlus::Drawing::FillMode FillMode
{
 IPlusPlus::Drawing::FillMode get() {return (IPlusPlus::Drawing::FillMode)GdiPlus::GetPathFillMode(pathHandle);}
 void set(IPlusPlus::Drawing::FillMode value) { GdiPlus::SetPathFillMode(pathHandle,(unsigned)value); }
}

void StartFigure() { GdiPlus::StartPathFigure(pathHandle); }

void CloseFigure() { GdiPlus::ClosePathFigure(pathHandle); }

void CloseAllFigures() { GdiPlus::ClosePathFigures(pathHandle); }

void SetMarker() { GdiPlus::SetPathMarker(pathHandle); }

void ClearMarkers() { GdiPlus::ClearPathMarkers(pathHandle); }

void Reverse() { GdiPlus::ReversePath(pathHandle); }

PointF GetLastPoint() { return GdiPlus::GetPathLastPoint(pathHandle); }

void AddLine(PointF pt1, 
             PointF pt2)
{
 AddLine(pt1.X, pt1.Y, pt2.X, pt2.Y);
}

void AddLine(double x1,
             double y1, 
             double x2, 
             double y2)
{
 GdiPlus::AddPathLine(pathHandle,
                       x1,
                       y1, 
                       x2,
                       y2);
}

void AddLines(Array<PointF>^ points)
{
  GdiPlus::AddPathLine(pathHandle,
                        points);
}

void AddLine(Point pt1, 
             Point pt2)
{
 AddLine(pt1.X,
         pt1.Y,
         pt2.X,
         pt2.Y);
}

void AddLine(int x1, 
             int y1, 
             int x2, 
             int y2)
{
  GdiPlus::AddPathLine(pathHandle,
                        x1,
                        y1,
                        x2,
                        y2);
}

void AddLines(Array<Point>^ points)
{
 GdiPlus::AddPathLine(pathHandle,
                       points);
}


void AddArc(RectangleF rect, 
            double startAngle, 
            double sweepAngle)
{
 AddArc(rect.X,
        rect.Y,
        rect.Width,
        rect.Height,
        startAngle,
        sweepAngle);
}

void AddArc(double x, 
            double y, 
            double width, 
            double height,
            double startAngle, 
            double sweepAngle)
{
 GdiPlus::AddPathArc(pathHandle,
                      x,
                      y,
                      width, 
                      height,
                      startAngle, 
                      sweepAngle);
}

void AddArc(Rectangle rect, 
            double startAngle, 
            double sweepAngle)
{
 AddArc(rect.X,
        rect.Y,
        rect.Width,
        rect.Height,
        startAngle,
        sweepAngle);
}

void AddArc(int x, 
            int y, 
            int width, 
            int height,
            double startAngle, 
            double sweepAngle)
{
 GdiPlus::AddPathArc(pathHandle,
                      x,
                      y,
                      width,
                      height,
                      startAngle,
                      sweepAngle);
}

void AddSpline(PointF pt1, 
               PointF pt2,
               PointF pt3, 
               PointF pt4)
{
 AddSpline(pt1.X,
           pt1.Y,
           pt2.X,
           pt2.Y,
           pt3.X,
           pt3.Y,
           pt4.X,
           pt4.Y);
}

void AddSpline(double x1, 
               double y1, 
               double x2, 
               double y2,
               double x3, 
               double y3, 
               double x4, 
               double y4)
{
 GdiPlus::AddPathSpline(pathHandle,
                         x1,
                         y1,
                         x2, 
                         y2,
                         x3,
                         y3,
                         x4,
                         y4);
}

void AddSplines(Array<PointF>^ points)
{
 GdiPlus::AddPathSplines(pathHandle,
                          points);
}

void AddSpline(Point pt1, 
               Point& pt2,
               Point& pt3, 
               Point& pt4)
{
  AddSpline(pt1.X,
            pt1.Y,
            pt2.X,
            pt2.Y,
            pt3.X,
            pt3.Y,
            pt4.X,
            pt4.Y);
}

void AddSpline(int x1, 
               int y1, 
               int x2, 
               int y2,
               int x3,
               int y3, 
               int x4, 
               int y4)
{
 GdiPlus::AddPathSpline(pathHandle,
                         x1,
                         y1,
                         x2,
                         y2,
                         x3,
                         y3,
                         x4,
                         y4);
}

void AddSplines(Array<Point>^ points)
{
 GdiPlus::AddPathSplines(pathHandle,
                          points);
}

void AddCurve(Array<PointF>^ points)
{
 GdiPlus::AddPathCurve(pathHandle,
                        points);
}

void AddCurve(Array<PointF>^ points, 
              double tension)
{
 GdiPlus::AddPathCurve(pathHandle,
                        points,
                        tension);
}

void AddCurve(Array<PointF>^ points, 
              int offset,
              int numberOfSegments, 
              double tension)
{
 GdiPlus::AddPathCurve(pathHandle,
                        points,
                        offset,
                        numberOfSegments,
                        tension);
}

void AddCurve(Array<Point>^ points) 
{
 GdiPlus::AddPathCurve(pathHandle,
                        points);
}

void AddCurve(Array<Point>^ points, 
              double tension)
{
 GdiPlus::AddPathCurve(pathHandle,
                        points,
                        tension);
}

void AddCurve(Array<Point>^ points, 
              int offset,
              int numberOfSegments, 
              double tension)
{
  GdiPlus::AddPathCurve(pathHandle,
                         points,
                         offset,
                         numberOfSegments,
                         tension);
}

 void AddClosedCurve(Array<PointF>^ points) 

 {
  GdiPlus::AddPathClosedCurve(pathHandle,
                               points);
 }

 void AddClosedCurve(Array<PointF>^ points, 
                     double tension)
{
 GdiPlus::AddPathClosedCurve(pathHandle,
                              points,
                              tension);
}

void AddClosedCurve(Array<Point>^ points)
{
 GdiPlus::AddPathClosedCurve(pathHandle,
                              points);
}

void AddClosedCurve(Array<Point>^ points, 
                    double tension)
{
 GdiPlus::AddPathClosedCurve(pathHandle,
                              points,
                              tension);
}

void AddRectangle(RectangleF rect)
{
 GdiPlus::AddPathRectangle(pathHandle,
                            rect.X,
                            rect.Y,
                            rect.Width,
                            rect.Height);
}

 void AddRectangles(Array<RectangleF>^ rects)
 {
  GdiPlus::AddPathRectangles(pathHandle,
                              rects);
 }

 void AddRectangle(Rectangle rect)
 {
  GdiPlus::AddPathRectangle(pathHandle,
                             rect.X,
                             rect.Y,
                             rect.Width,
                             rect.Height);
 }

 void AddRectangles(Array<Rectangle>^ rects)
 {
   GdiPlus::AddPathRectangles(pathHandle,
                               rects);
 }

void AddEllipse(RectangleF rect)
{
 AddEllipse(rect.X,
            rect.Y,
            rect.Width,
            rect.Height);
}

void AddEllipse(double x, 
                double y, 
                double width, 
                double height)
{
 GdiPlus::AddPathEllipse(pathHandle,
                          x,
                          y,
                          width,
                          height);
}

void AddEllipse(Rectangle rect)
{
  AddEllipse(rect.X, rect.Y, rect.Width, rect.Height);
}

void AddEllipse(int x, 
                int y, 
                int width, 
                int height)
{
 GdiPlus::AddPathEllipse(pathHandle,
                          x,
                          y,
                          width,
                          height);
}

void AddPie(RectangleF rect, 
            double startAngle, 
            double sweepAngle)
{
 AddPie(rect.X,
        rect.Y,
        rect.Width,
        rect.Height,
        startAngle,
        sweepAngle);
}

void AddPie(double x, 
            double y, 
            double width, 
            double height, 
            double startAngle,
            double sweepAngle)
{
 GdiPlus::AddPathPie(pathHandle,
                      x,
                      y,
                      width,
                      height,
                      startAngle, 
                      sweepAngle);
}

void AddPie(Rectangle rect, 
            double startAngle, 
            double sweepAngle)
{
 AddPie(rect.X,
        rect.Y,
        rect.Width,
        rect.Height,
        startAngle,
        sweepAngle);
}

void AddPie(int x, 
            int y, 
            int width, 
            int height, 
            double startAngle,
            double sweepAngle)
{
  GdiPlus::AddPathPie(pathHandle,
                       x,
                       y,
                       width,
                       height,
                       startAngle,
                       sweepAngle);
}

void AddPolygon(Array<PointF>^ points)
{
 GdiPlus::AddPathPolygon(pathHandle,
                          points);
}

void AddPolygon(Array<Point>^ points)
{
 GdiPlus::AddPathPolygon(pathHandle,
                          points);
}

void AddPath(Path^ addingPath, 
             bool connect)
{
 GdiPlus::AddPathPath(pathHandle,
                       addingPath->pathHandle, 
                       connect);
}

void AddString(String^ string,
               FontFamily^ family,
               int style,
               double  emSize,
               PointF origin,
               Handle format)
{
 RectangleF rect(origin.X, origin.Y, 0.0f, 0.0f);

 GdiPlus::AddPathString(pathHandle,
                         string,
                         family,
                         style,
                         emSize,
                         rect,
                         format);
}

void AddString(String^ string,
               FontFamily^ family,
               int style,
               double emSize,
               RectangleF& layoutRect,
               Handle format)
{
 GdiPlus::AddPathString(pathHandle,
                         string,
                         family,
                         style,
                         emSize,
                         layoutRect,
                         format);
}

void AddString(String^ string,
               FontFamily^ family,
               int style,
               double emSize,
               Point origin,
               Handle format)
{
 Rectangle rect(origin.X, origin.Y, 0, 0);

 GdiPlus::AddPathString(pathHandle,
                         string,
                         family,
                         style,
                         emSize,
                         rect,
                         format);
}

void AddString(String^ string,
               FontFamily^ family,
               int style,
               double emSize,
               Rectangle layoutRect,
               Handle format)
{
 GdiPlus::AddPathString(pathHandle,
                         string,
                         family,
                         style,
                         emSize,
                         layoutRect,
                         format);
}

void AddString(String^ string,
               FontFamily^ family,
               int style,
               double  emSize,
               PointF origin)
{
 RectangleF rect(origin.X, origin.Y, 0.0f, 0.0f);

 GdiPlus::AddPathString(pathHandle,
                         string,
                         family,
                         style,
                         emSize,
                         rect,
                         Handle((void*)0));
}

void AddString(String^ string,
               FontFamily^ family,
               int style,
               double emSize,
               RectangleF layoutRect)
{
 GdiPlus::AddPathString(pathHandle,
                         string,
                         family,
                         style,
                         emSize,
                         layoutRect,
                         Handle((void*)0));
}

void AddString(String^ string,
               FontFamily^ family,
               int style,
               double emSize,
               Point& origin)
{
 Rectangle rect(origin.X, origin.Y, 0, 0);

 GdiPlus::AddPathString(pathHandle,
                         string,
                         family,
                         style,
                         emSize,
                         rect,
                         Handle((void*)0));
}

void AddString(String^ string,
               FontFamily^ family,
               int style,
               double emSize,
               Rectangle layoutRect)
{
 GdiPlus::AddPathString(pathHandle,
                         string,
                         family,
                         style,
                         emSize,
                         layoutRect,
                         Handle((void*)0));
}

void Transform(Handle matrix)
{
 GdiPlus::TransformPath(pathHandle, 
                         matrix);
}

void Flatten(double flatness)
{
 GdiPlus::FlattenPath(pathHandle, 
                       Handle((void*)0), 
                       flatness);
}

void Flatten(Handle matrix, 
             double flatness)
{
 GdiPlus::FlattenPath(pathHandle, 
                       matrix, 
                       flatness);
}

void Outline(Handle matrix,
             double flatness)
{
 GdiPlus::WindingModeOutline(pathHandle,
                              matrix,
                              flatness);
}

void Outline(double flatness)
{
  GdiPlus::WindingModeOutline(pathHandle,
                               Handle((void*)0),
                               flatness);
}

void Widen(Pen^ pen, 
           double flatness)
{
 GdiPlus::WidenPath(pathHandle, 
                     pen,
                     Handle((void*)0), 
                     flatness);
}

void Widen(Pen^ pen, 
           Handle matrix,
           double flatness)
{
 GdiPlus::WidenPath(pathHandle, 
                     pen,
                     matrix, 
                     flatness);
}

void Warp(Array<PointF>^ destPoints, 
          RectangleF srcRect, 
          WarpMode warpMode,
          double flatness)
 {
  GdiPlus::WarpPath(pathHandle,
                     Handle((void*)0),
                     destPoints,
                     srcRect.X, 
                     srcRect.Y,
                     srcRect.Width,
                     srcRect.Height,
                     (unsigned)warpMode,
                     flatness);
 }

void Warp(Handle matrix,
          Array<PointF>^ destPoints, 
          RectangleF srcRect, 
          WarpMode warpMode,
          double flatness)
{
 GdiPlus::WarpPath(pathHandle,
                    matrix,
                    destPoints,
                    srcRect.X, 
                    srcRect.Y,
                    srcRect.Width,
                    srcRect.Height,
                    (unsigned)warpMode,
                    flatness);
}

int GetPointCount()
{
 return GdiPlus::GetPointCount(pathHandle);
}

Array<Byte>^ GetPathTypes()
{
 return  GdiPlus::GetPathTypes(pathHandle);
}

Array<PointF>^ GetPathPoints()
{
 return GdiPlus::GetPathPoints(pathHandle);
}

Array<Point>^ GetPathPointsInteger()
{
 return GdiPlus::GetPathPointsInteger(pathHandle);
}


RectangleF GetBounds(Pen^ pen)
{
  return GdiPlus::GetPathWorldBounds(pathHandle,
                                      Handle((void*)0),
                                      pen);
}

Rectangle GetBoundsInteger(Pen^ pen)
 {
  return GdiPlus::GetPathWorldBoundsInteger(pathHandle,
                                             Handle((void*)0),
                                             pen);
}

RectangleF GetBounds(Pen^ pen,
                     Handle matrix)
{
  return GdiPlus::GetPathWorldBounds(pathHandle,
                                      matrix,
                                      pen);
}

Rectangle GetBoundsInteger(Pen^ pen,
                           Handle matrix)
{
  return GdiPlus::GetPathWorldBoundsInteger(pathHandle,
                                             matrix,
                                             pen);
}

bool IsVisible(double x,
               double y)
{
 return GdiPlus::IsVisiblePathPoint(pathHandle,
                                     x,
                                     y,
                                     Handle((void*)0));
}

bool IsVisible(double x,
               double y,
               Graphics^ g);

bool IsVisible(int x,
               int y,
               Graphics^ g);

bool IsVisible(int x,
               int y)
{
 return GdiPlus::IsVisiblePathPoint(pathHandle,
                                    x,
                                    y,
                                    Handle((void*)0));
}

bool IsOutlineVisible(double x,
                      double y,
                      Pen^ pen,
                      Graphics^ g);

bool Path::IsOutlineVisible(double x,
                            double y,
                            Pen^ pen)
{
  return GdiPlus::IsOutlineVisiblePathPoint(pathHandle,
                                            x,
                                            y,
                                            pen,
                                            Handle((void*)0));
}

bool Path::IsOutlineVisible(int x,
                            int y,
                            Pen^ pen)
{
  return GdiPlus::IsOutlineVisiblePathPoint(pathHandle,
                                            x,
                                            y,
                                            pen,
                                            Handle((void*)0));
}

bool IsVisible(PointF point, 
               Graphics^ g);
    
bool IsVisible(Point point,
               Graphics^ g);

bool IsOutlineVisible(int x,
                      int y,
                      Pen^ pen, 
                      Graphics^ g);

bool IsOutlineVisible(PointF point,
                      Pen^ pen, 
                      Graphics^ g);

bool IsOutlineVisible(Point point,
                      Pen^ pen, 
                      Graphics^ g);

};
 
CustomLineCap::CustomLineCap(Path^ fillPath,
                             Path^ strokePath,
                             unsigned baseCap,
                             double baseInset)
{

 capHandle = GdiPlus::CreateCustomLineCap(fillPath,
                                          strokePath,
                                          baseCap,
                                          baseInset);
}

PathGradientBrush::PathGradientBrush(IPlusPlus::Drawing::Path^ path)
{
 brushHandle = GdiPlus::CreatePathGradient(path);
}

IPlusPlus::Drawing::Path^ PathGradientBrush::Path::get()
{
 return gcnew IPlusPlus::Drawing::Path(GdiPlus::GetPathGradientPath(brushHandle));
}

void PathGradientBrush::Path::set(IPlusPlus::Drawing::Path^ pathSet)
{
   GdiPlus::SetPathGradientPath(brushHandle,
                                pathSet);
}

Details

Name Space IPlusPlus::Drawing
Assembly IPlusPlus.Drawing.dll