//---------------------------------------------------------------------------------------- // Helper function: Convert GpPointF* memory block to PointF[] //---------------------------------------------------------------------------------------- internal static PointF[] ConvertGPPOINTFArrayF(IntPtr memory, int count) { if (memory == IntPtr.Zero) throw new ArgumentNullException("memory"); PointF[] points = new PointF[count]; int index; GPPOINTF pt = new GPPOINTF(); int size = (int)Marshal.SizeOf(pt.GetType()); for (index=0; index < count; index++) { pt = (GPPOINTF) UnsafeNativeMethods.PtrToStructure((IntPtr)((long)memory+index*size), pt.GetType()); points[index] = new PointF(pt.X, pt.Y); } return points; }
internal static PointF[] ConvertGPPOINTFArrayF(IntPtr memory, int count) { if (memory == IntPtr.Zero) { throw new ArgumentNullException("memory"); } PointF[] tfArray = new PointF[count]; GPPOINTF gppointf = new GPPOINTF(); int num2 = Marshal.SizeOf(gppointf.GetType()); for (int i = 0; i < count; i++) { gppointf = (GPPOINTF) UnsafeNativeMethods.PtrToStructure((IntPtr) (((long) memory) + (i * num2)), gppointf.GetType()); tfArray[i] = new PointF(gppointf.X, gppointf.Y); } return tfArray; }