www.pudn.com > GDIPlusCF.zip > GraphicsPath.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenNETCF.GDIPlus
{
public class GraphicsPath: IDisposable
{
public GraphicsPath(): this(FillMode.FillModeAlternate) { }
public GraphicsPath(FillMode fillMode)
{
nativePath = null;
lastResult = NativeMethods.GdipCreatePath(fillMode, out nativePath);
}
//GraphicsPath(GpPointF[] points,
// byte[] types,
// FillMode fillMode)
//{
// nativePath = null;
// lastResult = NativeMethods.GdipCreatePath2(points,
// types,
// points.Length,
// fillMode,
// out nativePath);
//}
//GraphicsPath(GpPoint[] points,
// byte[] types,
// FillMode fillMode)
//{
// nativePath = null;
// lastResult = NativeMethods.GdipCreatePath2I(points,
// types,
// points.Length,
// fillMode,
// out nativePath);
//}
~GraphicsPath()
{
Dispose(true);
}
public void Clear()
{
NativeMethods.GdipDeletePath(nativePath);
NativeMethods.GdipCreatePath(FillMode.FillModeAlternate, out nativePath);
}
GpStatus Transform(Matrix matrix)
{
if (matrix != null)
return SetStatus(NativeMethods.GdipTransformPath(nativePath,
matrix.nativeMatrix));
else
return GpStatus.Ok;
}
public GraphicsPath Clone()
{
GpPath clonepath = null;
SetStatus(NativeMethods.GdipClonePath(nativePath, out clonepath));
return new GraphicsPath(clonepath);
}
// Reset the path object to empty (and fill mode to FillModeAlternate)
public GpStatus Reset()
{
return SetStatus(NativeMethods.GdipResetPath(nativePath));
}
public FillMode GetFillMode()
{
FillMode fillmode = FillMode.FillModeAlternate;
SetStatus(NativeMethods.GdipGetPathFillMode(nativePath, out fillmode));
return fillmode;
}
public GpStatus SetFillMode(FillMode fillmode)
{
return SetStatus(NativeMethods.GdipSetPathFillMode(nativePath,
fillmode));
}
//GpStatus GetPathData(out GpPathData pathData)
//{
// if (pathData == null)
// {
// return SetStatus(InvalidParameter);
// }
// int count = GetPointCount();
// if ((count <= 0) || (pathData.Count>0 && pathData.Count