private System.Drawing.Drawing2D.PathData _GetPathData()
        {
            int num        = Marshal.SizeOf(typeof(GPPOINTF));
            int pointCount = this.PointCount;

            System.Drawing.Drawing2D.PathData data = new System.Drawing.Drawing2D.PathData {
                Types = new byte[pointCount]
            };
            IntPtr ptr       = Marshal.AllocHGlobal((int)(3 * IntPtr.Size));
            IntPtr structure = Marshal.AllocHGlobal((int)(num * pointCount));

            try
            {
                GCHandle handle = GCHandle.Alloc(data.Types, GCHandleType.Pinned);
                try
                {
                    IntPtr ptr3 = handle.AddrOfPinnedObject();
                    Marshal.StructureToPtr(pointCount, ptr, false);
                    Marshal.StructureToPtr(structure, (IntPtr)(((long)ptr) + IntPtr.Size), false);
                    Marshal.StructureToPtr(ptr3, (IntPtr)(((long)ptr) + (2 * IntPtr.Size)), false);
                    int status = SafeNativeMethods.Gdip.GdipGetPathData(new HandleRef(this, this.nativePath), ptr);
                    if (status != 0)
                    {
                        throw SafeNativeMethods.Gdip.StatusException(status);
                    }
                    data.Points = SafeNativeMethods.Gdip.ConvertGPPOINTFArrayF(structure, pointCount);
                }
                finally
                {
                    handle.Free();
                }
            }
            finally
            {
                Marshal.FreeHGlobal(ptr);
                Marshal.FreeHGlobal(structure);
            }
            return(data);
        }
Ejemplo n.º 2
0
        public override void DrawPath(GraphicsPath gfxPath)
        {
            var innerPath2 = gfxPath.InnerPath2;

            if (innerPath2 == null)
            {
                System.Drawing.Drawing2D.PathData pathData = gfxPath.GetPathData() as System.Drawing.Drawing2D.PathData;
                PixelFarm.Agg.VertexStore         vxs      = new PixelFarm.Agg.VertexStore();
                PixelFarm.Agg.GdiPathConverter.ConvertToVxs(pathData, vxs);
                PixelFarm.Agg.VertexSource.CurveFlattener flattener = new PixelFarm.Agg.VertexSource.CurveFlattener();
                vxs = flattener.MakeVxs2(vxs);
                gfxPath.InnerPath2 = vxs;
                this.canvasGL2d.DrawVxs(vxs);
            }
            else
            {
                PixelFarm.Agg.VertexStore vxs = innerPath2 as PixelFarm.Agg.VertexStore;
                if (vxs != null)
                {
                    this.canvasGL2d.DrawVxs(vxs);
                }
            }
        }
Ejemplo n.º 3
0
 private PathData(System.Drawing.Drawing2D.PathData pathData)
 {
     WrappedPathData = pathData;
 }