public static void gpc_polygon_clip( [In] NativeConstants.gpc_op set_operation, [In] ref NativeStructs.gpc_polygon subject_polygon, [In] ref NativeStructs.gpc_polygon clip_polygon, [In, Out] ref NativeStructs.gpc_polygon result_polygon) { if (Processor.Architecture == ProcessorArchitecture.X64) { X64.gpc_polygon_clip(set_operation, ref subject_polygon, ref clip_polygon, ref result_polygon); } else if (Processor.Architecture == ProcessorArchitecture.X86) { X86.gpc_polygon_clip(set_operation, ref subject_polygon, ref clip_polygon, ref result_polygon); } else { throw new InvalidOperationException(); } }
public static Polygon Clip(CombineMode clipMode, Polygon subject_polygon, Polygon clip_polygon) { Validate(clipMode); NativeConstants.gpc_op gpcOp = Convert(clipMode); NativeStructs.gpc_polygon gpc_polygon = new NativeStructs.gpc_polygon(); NativeStructs.gpc_polygon gpc_subject_polygon = PolygonTo_gpc_polygon(subject_polygon); NativeStructs.gpc_polygon gpc_clip_polygon = PolygonTo_gpc_polygon(clip_polygon); NativeMethods.gpc_polygon_clip(gpcOp, ref gpc_subject_polygon, ref gpc_clip_polygon, ref gpc_polygon); Polygon polygon = gpc_polygon_ToPolygon(gpc_polygon); Free_gpc_polygon(gpc_subject_polygon); Free_gpc_polygon(gpc_clip_polygon); NativeMethods.gpc_free_polygon(ref gpc_polygon); return(polygon); }
//private static class X64 //{ // [DllImport("ShellExtension_x64.dll")] // public static extern void gpc_polygon_clip( // [In] NativeConstants.gpc_op set_operation, // [In] ref NativeStructs.gpc_polygon subject_polygon, // [In] ref NativeStructs.gpc_polygon clip_polygon, // [In, Out] ref NativeStructs.gpc_polygon result_polygon); // [DllImport("ShellExtension_x64.dll")] // public static extern void gpc_free_polygon([In] ref NativeStructs.gpc_polygon polygon); //} //private static class X86 //{ // [DllImport("ShellExtension_x86.dll")] // public static extern void gpc_polygon_clip( // [In] NativeConstants.gpc_op set_operation, // [In] ref NativeStructs.gpc_polygon subject_polygon, // [In] ref NativeStructs.gpc_polygon clip_polygon, // [In, Out] ref NativeStructs.gpc_polygon result_polygon); // [DllImport("ShellExtension_x86.dll")] // public static extern void gpc_free_polygon([In] ref NativeStructs.gpc_polygon polygon); //} public static void gpc_polygon_clip( [In] NativeConstants.gpc_op set_operation, [In] ref NativeStructs.gpc_polygon subject_polygon, [In] ref NativeStructs.gpc_polygon clip_polygon, [In, Out] ref NativeStructs.gpc_polygon result_polygon) { throw new NotSupportedException(); //if (Processor.Architecture == ProcessorArchitecture.X64) //{ // X64.gpc_polygon_clip(set_operation, ref subject_polygon, ref clip_polygon, ref result_polygon); //} //else if (Processor.Architecture == ProcessorArchitecture.X86) //{ // X86.gpc_polygon_clip(set_operation, ref subject_polygon, ref clip_polygon, ref result_polygon); //} //else //{ // throw new InvalidOperationException(); //} }
public static extern void gpc_polygon_clip( [In] NativeConstants.gpc_op set_operation, [In] ref NativeStructs.gpc_polygon subject_polygon, [In] ref NativeStructs.gpc_polygon clip_polygon, [In, Out] ref NativeStructs.gpc_polygon result_polygon);